예제 #1
0
 private void unselectGarnish()
 {
     setAddButtonState(false);
     this._selectedGarnIndex = -1;
     if (_pathImage != null)
     {
         _pathImage.Fill = _dishImageBrush;
     }
     _descrText.Text = AppLib.GetLangText(_dishItem.langDescriptions);
 }
예제 #2
0
        private void addTotalLine(FlowDocument doc, double fontSize, decimal totalPrice, string currencyName, int leftMargin)
        {
            Table t = new Table();

            t.FontSize        = fontSize;
            t.CellSpacing     = 0;
            t.BorderThickness = new Thickness(0, 1, 0, 0);
            t.BorderBrush     = new SolidColorBrush(Colors.Black);
            t.Margin          = new Thickness(0);
            t.Padding         = new Thickness(leftMargin, 10, 0, 0);

            // две колонки
            t.Columns.Add(new TableColumn()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            t.Columns.Add(new TableColumn()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            TableRowGroup rg = new TableRowGroup();

            t.RowGroups.Add(rg);

            string    totalText = AppLib.GetLangText((Dictionary <string, string>)AppLib.GetAppGlobalValue("lblTotalText"));
            Run       r         = new Run(totalText);
            Paragraph p         = new Paragraph(r);

            p.TextAlignment = TextAlignment.Left;
            TableCell totalTextCell = new TableCell();

            totalTextCell.Blocks.Add(p);

            string priceText = string.Format("{0:0.00} {1}", totalPrice, currencyName);

            r               = new Run(priceText);
            r.FontWeight    = FontWeights.Bold;
            p               = new Paragraph(r);
            p.TextAlignment = TextAlignment.Right;
            TableCell priceTextCell = new TableCell();

            priceTextCell.Blocks.Add(p);

            TableRow tr = new TableRow();

            tr.Cells.Add(totalTextCell);
            tr.Cells.Add(priceTextCell);
            rg.Rows.Add(tr);

            doc.Blocks.Add(t);
        }
예제 #3
0
        public void ResetLang()
        {
            List <TextBlock> tbList = AppLib.FindLogicalChildren <TextBlock>(dGrid).ToList();

            // заголовок (состоит из элементов Run)
            var hdRuns = tbList[0].Inlines.Where(t => (t is Run)).ToList();

            if (hdRuns.Count >= 0)
            {
                ((Run)hdRuns[0]).Text = AppLib.GetLangText(_dishItem.langNames);
            }
            if (hdRuns.Count >= 3)
            {
                ((Run)hdRuns[2]).Text = " " + AppLib.GetLangText(_dishItem.langUnitNames);
            }

            // tbList[1] - буковка i на кнопке отображения описания

            // описание блюда
            if ((_hasGarnishes == true) && (this._selectedGarnIndex != -1))
            {
                _descrText.Text = AppLib.GetLangText(_dishItem.Garnishes[this._selectedGarnIndex].langDishDescr);
            }
            else
            {
                _descrText.Text = AppLib.GetLangText(_dishItem.langDescriptions);
            }

            // кнопка Добавить с тенью
            TextBlock tbAdd = tbList.First(t => t.Name == "tbAdd");

            if (tbAdd != null)
            {
                tbAdd.Text = (string)AppLib.GetLangText((Dictionary <string, string>)AppLib.GetAppGlobalValue("btnSelectDishText"));
            }

            if (_hasGarnishes == true)
            {
                TextBlock tbInv = tbList.First(t => t.Name == "tbInvitation");
                if (tbInv != null)
                {
                    tbInv.Text = (string)AppLib.GetLangText((Dictionary <string, string>)AppLib.GetAppGlobalValue("btnSelectGarnishText"));
                }

                foreach (MainMenuGarnish garn in _grdGarnishes.Children)
                {
                    garn.ResetLangName();
                }
            }
        } //  method
예제 #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string retVal = null;

            if (parameter == null)
            {
                retVal = AppLib.GetLangText((Dictionary <string, string>)value);
                if (IsUpper == true)
                {
                    retVal = retVal.ToUpper(culture);
                }
                if (IsLower == true)
                {
                    retVal = retVal.ToLower(culture);
                }
            }
            else
            {
                string mode = (string)parameter;
                int    i1   = mode.IndexOf('.');
                if (i1 > -1)
                {
                    string key = mode.Substring(0, i1);
                    string val = mode.Substring(i1 + 1);
                    if (key == "appSet")
                    {
                        Dictionary <string, string> lDict = (Dictionary <string, string>)AppLib.GetAppGlobalValue(val);
                        retVal = AppLib.GetLangText(lDict);
                        if (IsUpper == true)
                        {
                            retVal = retVal.ToUpper(culture);
                        }
                        if (IsLower == true)
                        {
                            retVal = retVal.ToLower(culture);
                        }
                    }
                }
            }

            return(retVal);
        }
예제 #5
0
        private void dishDel()
        {
            DishItem dishItem = (DishItem)lstDishes.SelectedItem;

            if (dishItem == null)
            {
                return;
            }
            OrderItem order = AppLib.GetCurrentOrder();

            AppLib.WriteAppAction($"CartWin|Удаление блюда '{dishItem.langNames["ru"]}'...");

            string           title  = AppLib.GetLangTextFromAppProp("cartDelDishTitle");
            string           msg    = string.Format("{0} \"{1}\" ?", AppLib.GetLangTextFromAppProp("cartDelDishQuestion"), AppLib.GetLangText(dishItem.langNames));
            MessageBoxResult result = AppLib.ShowChoiceBox(title, msg);

            AppLib.WriteAppAction($"CartWin|Удаление блюда '{dishItem.langNames["ru"]}': {result.ToString()}");

            if (result == MessageBoxResult.Yes)
            {
                order.Dishes.Remove(dishItem);
                lstDishes.Items.Refresh();
                scrollDishes.ScrollToTop();

                updatePriceOrder();
            }
        }
예제 #6
0
        // удаление ингредиента
        private void ingrDel(object sender, Point point)
        {
            // получить контролы из нажатого элемента
            //    listbox ингредиентов
            ListBoxItem lbiIngr = (ListBoxItem)AppLib.FindVisualParentByType((FrameworkElement)sender, typeof(ListBoxItem));
            ListBox     lbIngr  = (ListBox)AppLib.FindVisualParentByType((FrameworkElement)lbiIngr, typeof(ListBox));
            DishAdding  tmpIngr = (DishAdding)lbIngr.ItemContainerGenerator.ItemFromContainer(lbiIngr);

            int iCnt = lbIngr.ItemContainerGenerator.IndexFromContainer(lbiIngr);

            if (lbIngr.SelectedIndex != iCnt)
            {
                lbIngr.SelectedIndex = iCnt;
            }

            //    listbox блюд
            AppLib.SelectListBoxItemByHisInnerControl((FrameworkElement)lbIngr, lstDishes); // делаем это принудетельно

            DishItem   dishItem = (DishItem)lstDishes.SelectedItem;
            DishAdding ingrItem = (DishAdding)lbIngr.SelectedItem;

            AppLib.WriteAppAction($"CartWin|Нажата кнопка удаления ингредиента '{ingrItem.langNames["ru"]}' для блюда '{dishItem.langNames["ru"]}'");

            string           title  = AppLib.GetLangTextFromAppProp("cartDelIngrTitle");
            string           msg    = string.Format("{0} \"{1}\" ?", AppLib.GetLangTextFromAppProp("cartDelIngrQuestion"), AppLib.GetLangText(ingrItem.langNames));
            MessageBoxResult result = AppLib.ShowChoiceBox(title, msg);

            AppLib.WriteAppAction($"CartWin|Удаление ингредиента {ingrItem.langNames["ru"]}: {result.ToString()}");
            if (result == MessageBoxResult.Yes)
            {
                dishItem.SelectedIngredients.Remove(ingrItem);
                lbIngr.Items.Refresh();

                updatePriceControls();
            }
            this.Activate();
        }
예제 #7
0
        private void setDishAddButton()
        {
            // высота строки кнопки добавления
            double dishPanelAddButtonRowHeight = (double)AppLib.GetAppGlobalValue("dishPanelAddButtonRowHeight");
            double cornerRadiusButton          = (double)AppLib.GetAppGlobalValue("cornerRadiusButton");

            // размеры тени под кнопками (от высоты самой кнопки, dishPanelAddButtonHeight)
            double           addButtonShadowDepth = 0.1d * dishPanelAddButtonRowHeight;
            double           addButtonBlurRadius  = 0.35d * dishPanelAddButtonRowHeight;
            DropShadowEffect _shadowEffect        = new DropShadowEffect()
            {
                Direction   = 270,
                Color       = Color.FromArgb(0xFF, 0xCF, 0x44, 0x6B),
                Opacity     = 1.0,
                ShadowDepth = addButtonShadowDepth,
                BlurRadius  = addButtonBlurRadius
            };

            // кнопка с тенью
            _btnAddDish = new Border()
            {
                Name = "btnAddDish",
                Tag  = _dishItem.RowGUID.ToString(),
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Center,
                CornerRadius        = new CornerRadius(cornerRadiusButton),
                Background          = (Brush)AppLib.GetAppGlobalValue("addButtonBackgroundTextColor"),
                Width        = dGrid.Width,
                Height       = Math.Floor((AppLib.IsAppVerticalLayout ? 0.5d : 0.7d) * dishPanelAddButtonRowHeight),
                ClipToBounds = false
            };
            // Effect = _shadowEffect
            _btnAddDish.PreviewMouseUp += BtnAddDish_PreviewMouseLeftButtonUp;

            _btnAddDishTextBlock = new TextBlock()
            {
                Name = "tbAdd",
                Text = (string)AppLib.GetLangText((Dictionary <string, string>)AppLib.GetAppGlobalValue("btnSelectDishText")),
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontSize            = _dishPanelAddButtoFontSize,
                Foreground          = Brushes.White
            };

            if (_hasGarnishes == false)   // не Воки
            {
                // грид с кнопками цены и строки "Добавить", две колонки: с ценой и текстом
                Grid grdPrice = new Grid();
                grdPrice.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(dGrid.Width / 3d, GridUnitType.Pixel)
                });
                grdPrice.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(dGrid.Width * 2d / 3d, GridUnitType.Pixel)
                });

                Border brdPrice = new Border()
                {
                    VerticalAlignment = VerticalAlignment.Top,
                    Width             = grdPrice.ColumnDefinitions[0].Width.Value,
                    Height            = _btnAddDish.Height,
                    CornerRadius      = new CornerRadius(cornerRadiusButton, 0, 0, cornerRadiusButton),
                    Background        = (Brush)AppLib.GetAppGlobalValue("addButtonBackgroundPriceColor"),
                };
                TextBlock tbPrice = new TextBlock()
                {
                    Text = string.Format((string)AppLib.GetAppResource("priceFormatString"), _dishItem.Price),
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    FontSize            = _dishPanelAddButtoFontSize,
                    Foreground          = Brushes.White
                };
                brdPrice.Child = tbPrice;
                Grid.SetColumn(brdPrice, 0); grdPrice.Children.Add(brdPrice);

                Grid.SetColumn(_btnAddDishTextBlock, 1); grdPrice.Children.Add(_btnAddDishTextBlock);
                _btnAddDish.Child = grdPrice;

                Grid.SetRow(_btnAddDish, 4);
            }

            else   // Воки
            {
                // кнопка-приглашение
                _btnInvitation = new Border()
                {
                    Name = "btnInvitation",
                    VerticalAlignment   = VerticalAlignment.Top,
                    Width               = Math.Floor(dGrid.Width),
                    Height              = _btnAddDish.Height,
                    CornerRadius        = new CornerRadius(cornerRadiusButton),
                    Background          = Brushes.White,
                    BorderBrush         = Brushes.Gray,
                    BorderThickness     = new Thickness(1),
                    SnapsToDevicePixels = true
                };
                TextBlock tbInvitation = new TextBlock()
                {
                    Name = "tbInvitation",
                    Text = (string)AppLib.GetLangText((Dictionary <string, string>)AppLib.GetAppGlobalValue("btnSelectGarnishText")),
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    FontSize            = _dishPanelAddButtoFontSize,
                    Foreground          = Brushes.Gray
                };
                _btnInvitation.Child = tbInvitation;

                // добавить в контейнер
                _btnInvitation.Child = tbInvitation; _btnInvitation.SetValue(Grid.RowProperty, 6);
                dGrid.Children.Add(_btnInvitation);

                _btnAddDish.Child = _btnAddDishTextBlock; _btnAddDish.SetValue(Grid.RowProperty, 6);
                //_btnAddDish.Visibility = Visibility.Hidden;
                _btnAddDish.Opacity = 0;
            }

            dGrid.Children.Add(_btnAddDish);
        }  // method
예제 #8
0
        }  // method

        private void setDishDescription()
        {
            // размер шрифтов
            double dishPanelDescriptionFontSize = Convert.ToDouble(AppLib.GetAppGlobalValue("dishPanelDescriptionFontSize"));
            double dishPanelTextFontSize        = Convert.ToDouble(AppLib.GetAppGlobalValue("dishPanelFontSize"));
            double dishPanelDescrButtonSize     = (double)AppLib.GetAppGlobalValue("dishPanelDescrButtonSize");
            // размеры прямоугольника и углы закругления для изображения и описания блюда
            double dishImageHeight       = (double)AppLib.GetAppGlobalValue("dishImageHeight");
            double dishImageWidth        = (double)AppLib.GetAppGlobalValue("dishImageWidth");
            double dishImageCornerRadius = (double)AppLib.GetAppGlobalValue("cornerRadiusDishPanel");

            Rect rect = new Rect(0, 0, dGrid.Width, dishImageHeight);

            // изображение
            _dishImageBrush = new ImageBrush()
            {
                ImageSource = _dishItem.Image
            };
            _pathImage = new Path()
            {
                Name = "pathDishImage",
                Data = new RectangleGeometry(rect, dishImageCornerRadius, dishImageCornerRadius),
                Fill = _dishImageBrush
            };
            _pathImage.PreviewMouseLeftButtonUp += CanvDescr_PreviewMouseLeftButtonUp;
            //pathImage.Effect = new DropShadowEffect();
            // добавить в контейнер
            Grid.SetRow(_pathImage, 2); dGrid.Children.Add(_pathImage);

            // кнопка отображения описания
            _btnDescr = new Border()
            {
                Name   = "btnDescr",
                Width  = dishPanelDescrButtonSize,
                Height = dishPanelDescrButtonSize,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Top,
                Tag          = 0,
                Background   = Brushes.White,
                CornerRadius = new CornerRadius(0.5 * dishPanelDescrButtonSize),
                Margin       = new Thickness(0, 0.3 * dishPanelDescrButtonSize, 0.3 * dishPanelDescrButtonSize, 0)
            };
            _btnDescr.PreviewMouseLeftButtonUp += CanvDescr_PreviewMouseLeftButtonUp;

            //   буковка i
            TextBlock btnDescrText = new TextBlock(new Run("i"))
            {
                FontSize            = dishPanelTextFontSize,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            _btnDescr.Child = btnDescrText;
            // добавить в контейнер
            Grid.SetRow(_btnDescr, 2); dGrid.Children.Add(_btnDescr);
            Grid.SetZIndex(_btnDescr, 2);

            // описание блюда
            LinearGradientBrush lgBrush = new LinearGradientBrush()
            {
                StartPoint = new Point(0.5, 0),
                EndPoint   = new Point(0.5, 1)
            };

            lgBrush.GradientStops.Add(new GradientStop(Colors.Black, 0));
            lgBrush.GradientStops.Add(new GradientStop(Colors.Black, 0.5));
            lgBrush.GradientStops.Add(new GradientStop((Color)AppLib.GetAppResource("appColorDarkPink"), 1));

            _descrTextBorder = new Border()
            {
                Name         = "brdDescrText",
                Width        = dGrid.Width,
                Height       = dishImageHeight,
                CornerRadius = new CornerRadius(dishImageCornerRadius),
                Background   = lgBrush,
                Opacity      = 0,
                Visibility   = Visibility.Hidden
            };
            _descrTextBorder.PreviewMouseLeftButtonUp += CanvDescr_PreviewMouseLeftButtonUp;
            // добавить в контейнер
            Grid.SetRow(_descrTextBorder, 2); dGrid.Children.Add(_descrTextBorder);

            _descrText = new TextBlock()
            {
                Name              = "tblDescrText",
                Width             = dGrid.Width,
                Opacity           = 0,
                Padding           = new Thickness(dishPanelDescriptionFontSize),
                VerticalAlignment = VerticalAlignment.Center,
                TextAlignment     = TextAlignment.Center,
                TextWrapping      = TextWrapping.Wrap,
                FontSize          = dishPanelDescriptionFontSize,
                Foreground        = Brushes.White,
                Text              = AppLib.GetLangText(_dishItem.langDescriptions),
                Visibility        = Visibility.Hidden
            };
            _descrText.Effect = new BlurEffect()
            {
                Radius = 20
            };
            _descrText.PreviewMouseLeftButtonUp += CanvDescr_PreviewMouseLeftButtonUp;

            // добавить в контейнер
            Grid.SetRow(_descrText, 2); dGrid.Children.Add(_descrText);
        }
예제 #9
0
        }  // method

        private void setDishPanelHeader()
        {
            // размер шрифтов
            double dishPanelHeaderFontSize    = Convert.ToDouble(AppLib.GetAppGlobalValue("dishPanelHeaderFontSize"));
            double dishPanelUnitCountFontSize = Convert.ToDouble(AppLib.GetAppGlobalValue("dishPanelUnitCountFontSize"));

            List <Inline> inlines = new List <Inline>();

            if (_dishItem.Marks != null)
            {
                foreach (DishAdding markItem in _dishItem.Marks)
                {
                    if (markItem.Image != null)
                    {
                        System.Windows.Controls.Image markImage = new System.Windows.Controls.Image();
                        //markImage.Effect = new DropShadowEffect() { Opacity = 0.7 };
                        markImage.Width = 1.5 * dishPanelHeaderFontSize;
                        //markImage.Height = 2*dishPanelHeaderFontSize;
                        markImage.Source  = markItem.Image;
                        markImage.Stretch = Stretch.Uniform;
                        InlineUIContainer iuc = new InlineUIContainer(markImage);
                        markImage.Margin = new Thickness(0, 0, 5, 5);
                        inlines.Add(iuc);
                    }
                }
            }
            inlines.Add(new Run()
            {
                Text       = AppLib.GetLangText(_dishItem.langNames),
                FontWeight = FontWeights.Bold,
                FontSize   = dishPanelHeaderFontSize
            });

            if (_dishItem.UnitCount != 0)
            {
                inlines.Add(new Run()
                {
                    Text      = "  " + _dishItem.UnitCount.ToString(),
                    FontStyle = FontStyles.Italic,
                    FontSize  = dishPanelUnitCountFontSize
                });
                inlines.Add(new Run()
                {
                    Text     = " " + AppLib.GetLangText(_dishItem.langUnitNames),
                    FontSize = dishPanelUnitCountFontSize
                });
            }

            double    dishPanelLeftMargin = (double)AppLib.GetAppGlobalValue("dishPanelLeftMargin");
            TextBlock tb = new TextBlock()
            {
                Foreground           = new SolidColorBrush(Colors.Black),
                TextWrapping         = TextWrapping.Wrap,
                VerticalAlignment    = VerticalAlignment.Center,
                TextAlignment        = TextAlignment.Center,
                LineStackingStrategy = LineStackingStrategy.BlockLineHeight, LineHeight = 1.2 * dishPanelHeaderFontSize
            };

            tb.Inlines.AddRange(inlines);

            Grid.SetRow(tb, 0); Grid.SetRowSpan(tb, 2);
            Grid.SetZIndex(tb, 5);
            dGrid.Children.Add(tb);
        }  // method
예제 #10
0
        private FlowDocument createDocument(int width)
        {
            // создать объекты верхнего и нижнего колонтитулов
            XmlDocument xmlHeader = new XmlDocument();

            xmlHeader.Load(AppDomain.CurrentDomain.BaseDirectory + string.Format(@"PrinterBill\Header-{0}.xml", _langId));
            XmlDocument xmlFooter = new XmlDocument();

            xmlFooter.Load(AppDomain.CurrentDomain.BaseDirectory + string.Format(@"PrinterBill\Footer-{0}.xml", _langId));
            TextModel textHeader = new TextModel();
            TextModel textFooter = new TextModel();

            textHeader = DeSerialize <TextModel>(xmlHeader.OuterXml);
            textFooter = DeSerialize <TextModel>(xmlFooter.OuterXml);
            int       leftMargin     = getLineMargin("BillLineLeftMargin");
            Thickness lineMargin     = getLineMargin();
            Thickness lineMarginIngr = lineMargin;

            lineMarginIngr.Top = getLineMargin("BillLineIngrTopMargin");
            Thickness lineMarginPrice = lineMargin;

            lineMarginPrice.Top = getLineMargin("BillLinePriceTopMargin");

            var doc = new FlowDocument();

            doc.PageWidth = width;
            // значения по умолчанию
            doc.FontFamily = new FontFamily("Panton-Bold");
            doc.FontWeight = FontWeights.Normal;
            doc.FontStyle  = FontStyles.Normal;
            doc.FontSize   = Convert.ToInt32(AppLib.GetAppGlobalValue("BillLineFontSize", 12));

            // вставить изображение в заголовок
            addImageToDoc(textHeader, doc);
            // метка, если заказ С СОБОЙ
            if (_order.takeAway == true)
            {
                string langText = AppLib.GetLangTextFromAppProp("takeOrderOut");
                langText = string.Concat(" **** ", langText.ToUpper(), " ****");
                addParagraph(doc, langText, 1.5 * doc.FontSize, FontWeights.Bold, FontStyles.Normal, new Thickness(leftMargin, 20, 0, 10), TextAlignment.Center);
            }
            // добавить форматированный заголовок
            addSectionToDoc(textHeader, doc);

            // добавить строки заказа
            string  currencyName = AppLib.GetLangTextFromAppProp("CurrencyName");
            string  sAppSet;
            decimal totalPrice = 0; string itemName, stringRow;

            foreach (DishItem item in _order.Dishes)
            {
                // блюдо
                itemName = AppLib.GetLangText(item.langNames);
                // c гарниром?
                if ((item.SelectedGarnishes != null) && (item.SelectedGarnishes.Count > 0))
                {
                    DishAdding garn     = item.SelectedGarnishes[0];
                    string     garnName = AppLib.GetLangText(garn.langNames);
                    // 2017-02-02 Формирование полного наименования блюда с гарниром
                    // если DishFullNameInGargnish = true, то полное имя берем из гарнира,
                    // иначе к имени блюда добавляем имя гарнира
                    sAppSet = AppLib.GetAppSetting("DishFullNameInGarnish");
                    if (sAppSet != null && sAppSet.ToBool())
                    {
                        itemName = garnName;
                    }
                    else
                    {
                        itemName += " " + AppLib.GetLangTextFromAppProp("withGarnish") + " " + garnName;
                    }
                }
                //string stringRow = itemName.Substring(0, itemName.Count() > 30 ? 30 : itemName.Count());
                addParagraph(doc, itemName, doc.FontSize, doc.FontWeight, doc.FontStyle, lineMargin);

                // добавить ингредиенты
                if (item.SelectedIngredients != null)
                {
                    stringRow = "  + "; bool isFirst = true;
                    foreach (DishAdding ingr in item.SelectedIngredients)
                    {
                        itemName   = AppLib.GetLangText(ingr.langNames);
                        stringRow += ((isFirst) ? "" : "; ") + itemName;
                        isFirst    = false;
                    }
                    addParagraph(doc, stringRow, 0.9 * doc.FontSize, doc.FontWeight, FontStyles.Italic, lineMarginIngr);
                }

                // стоимость блюда
                decimal price       = item.GetPrice();
                string  priceString = string.Format("{0} x {1:0.00} {3} = {2:0.00} {3}", item.Count, price, item.Count * price, currencyName);
                addParagraph(doc, priceString, doc.FontSize, doc.FontWeight, doc.FontStyle, lineMarginPrice, TextAlignment.Right);
                totalPrice += item.Count * price;
            }
            // итог
            addTotalLine(doc, doc.FontSize, totalPrice, currencyName, leftMargin);

            // добавить форматированный "подвал"
            addSectionToDoc(textFooter, doc);
            // вставить изображение в "подвал"
            addImageToDoc(textFooter, doc);

            // печать штрих-кода
            string           bcVal13      = _order.BarCodeValue + BarCodeLib.getUPCACheckDigit(_order.BarCodeValue);
            Image            imageBarCode = BarCodeLib.GetBarcodeImage(bcVal13, (int)(1.2 * doc.PageWidth), 50);
            BlockUIContainer bcContainer  = new BlockUIContainer()
            {
                Child  = imageBarCode,
                Margin = new Thickness(leftMargin, 10, 0, 0)
            };

            doc.Blocks.Add(bcContainer);
            // вывести значение баркода в чек
            //string bcDisplay = string.Format("{0} {1} {2} {3}", bcVal13.Substring(0,2), bcVal13.Substring(2, 6), bcVal13.Substring(8, 4), bcVal13.Substring(12,1));
            string bcDisplay = string.Format("{0}  {1}  {2}", bcVal13.Substring(0, 1), bcVal13.Substring(1, 6), bcVal13.Substring(7));

            addParagraph(doc, bcDisplay, 0.75 * doc.FontSize, doc.FontWeight, doc.FontStyle, new Thickness(leftMargin, 5, 0, 0), TextAlignment.Center);

            return(doc);
        }
예제 #11
0
        private void MainMenuGarnish_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (AppLib.IsDrag)
            {
                return;
            }

            _isSelected = !_isSelected;
            setSelectionMode();
            // передать уведомление в панель блюда
            if (SelectGarnish != null)
            {
                SelectGarnish(this, new SelectGarnishEventArgs(_isSelected, _garnIndex, AppLib.GetLangText(_garnItem.langDishDescr)));
            }
        }
예제 #12
0
 public void ResetLangName()
 {
     _tbGarnishName.Text = (string)AppLib.GetLangText((Dictionary <string, string>)_garnItem.langNames);
 }
예제 #13
0
        private void createGarnishButton()
        {
            base.Height = _height; base.Width = _width;

            // подложка кнопки
            Path _pathBase = getGarnPath(_width, _height);

            //if (_garnItem.Image == null)
            //{
            //    _pathBase.Fill = _notSelectBrush;
            //}
            //else
            //{
            _pathBase.Fill = new ImageBrush()
            {
                ImageSource = _garnItem.Image
            };
            _pathBase.Stretch = Stretch.UniformToFill;
            string sVal = (string)AppLib.GetAppGlobalValue("dishPanelGarnishBrightness");

            _pathBase.Opacity = (sVal == null) ? 1.0 : sVal.ToDouble();
            //}
            base.Children.Add(_pathBase);

            // выделение кнопки
            _pathSelected = getGarnPath(_width, _height);
            Color c  = ((SolidColorBrush)AppLib.GetAppGlobalValue("appSelectedItemColor")).Color;
            Color c1 = new Color(); c1.A = 0xAA; c1.R = c.R; c1.G = c.G; c1.B = c.B;

            _pathSelected.Fill       = new SolidColorBrush(c1);
            _pathSelected.Visibility = Visibility.Collapsed;
            base.Children.Add(_pathSelected);

            double dMarg   = 0.05 * _width;
            string grnText = (string)AppLib.GetLangText((Dictionary <string, string>)_garnItem.langNames);

            _tbGarnishName = new TextBlock()
            {
                Text              = grnText,
                Width             = _width - (2 * dMarg),
                TextWrapping      = TextWrapping.Wrap,
                VerticalAlignment = VerticalAlignment.Top,
                TextAlignment     = TextAlignment.Center,
                FontSize          = _fontSize,
                Margin            = new Thickness(dMarg),
                Foreground        = _notSelectTextBrush
            };
            base.Children.Add(_tbGarnishName);

            string grnPrice = string.Format((string)AppLib.GetAppResource("priceFormatString"), _garnItem.Price);

            _tbGarnishPrice = new TextBlock()
            {
                Text              = grnPrice,
                Width             = _width,
                VerticalAlignment = VerticalAlignment.Bottom,
                TextAlignment     = TextAlignment.Center,
                FontSize          = _fontSize,
                FontWeight        = FontWeights.Bold,
                Foreground        = Brushes.Black
            };
            base.Children.Add(_tbGarnishPrice);
        }