Example #1
0
        private void fillCells(Grid grid)
        {
            int rowCount = grid.RowDefinitions.Count;
            int colCount = grid.ColumnDefinitions.Count;
            int listIndex;

            DateTime dtProc = DateTime.Now;

            AppLib.WriteLogTraceMessage("screen updating - START");

            for (int i = 0; i < rowCount; i++)
            {
                for (int j = 0; j < colCount; j++)
                {
                    // индекс ячейки в одномерном массиве
                    listIndex = (i * colCount) + j;
                    // ячейка таблицы (объект типа OrderPanel1)
                    OrderPanel1 cc = (OrderPanel1)grid.Children[listIndex];
                    // обновить ячейки данными из набора _appOrders
                    if (listIndex < _appOrders.Count)
                    {
                        cc.OrderNumber = _appOrders[listIndex].Order.Number.ToString();
                        cc.OrderStatus = _appOrders[listIndex].Order.QueueStatusId + 1;
                        cc.OrderLang   = _appOrders[listIndex].Order.LanguageTypeId;
                        if (_isShowClientName)
                        {
                            cc.ClientName = (_appOrders[listIndex].Order.ClientName.IsNull()) ? null :_appOrders[listIndex].Order.ClientName.Trim();
                        }
                        if (_isShowCookingTime)
                        {
                            cc.OrderCreateDate   = _appOrders[listIndex].Order.CreateDate;
                            cc.CookingEstMinutes = _cookingEstMinutes;
                        }
                        if (cc.Visibility != Visibility.Visible)
                        {
                            cc.Visibility = Visibility.Visible;
                        }
                    }
                    // прочие ячейки таблицы
                    else
                    {
                        // если панель заказа в ячейке видима, то скрыть ее
                        if (cc.Visibility == Visibility.Visible)
                        {
                            cc.Visibility = Visibility.Hidden;
                        }
                    }
                }
            }
            AppLib.WriteLogTraceMessage("screen updating - FINISH, " + getFormattedTS(dtProc));
        }
Example #2
0
        private void createGridContainers(Grid grid)
        {
            Size mainGridSize = getMainGridSize();
            int  rowsCount = grid.RowDefinitions.Count, colsCount = grid.ColumnDefinitions.Count;

            string stateReadyImageFile = (string)WpfHelper.GetAppGlobalValue("StatusReadyImageFile");

            double cellWidth  = mainGridSize.Width / (double)colsCount,
                   cellHeight = mainGridSize.Height / (double)rowsCount;

            for (int i = 0; i < rowsCount; i++)
            {
                for (int j = 0; j < colsCount; j++)
                {
                    // постоянные свойства панели
                    OrderPanel1 cc = new OrderPanel1()
                    {
                        Visibility        = Visibility.Hidden,
                        BackBrushes       = _cellBrushes,
                        MarginKoefStr     = (string)WpfHelper.GetAppGlobalValue("MarginKoefStr"),
                        IsShowClientName  = _isShowClientName,
                        IsShowCookingTime = _isShowCookingTime,

                        TitleLangs            = (string)WpfHelper.GetAppGlobalValue("StatusTitle"),
                        CookingTimeTitleLangs = (string)WpfHelper.GetAppGlobalValue("PanelWaitText"),
                        Status1Langs          = (string)WpfHelper.GetAppGlobalValue("Status1Langs"),
                        Status2Langs          = (string)WpfHelper.GetAppGlobalValue("Status2Langs"),
                        Status3Langs          = (string)WpfHelper.GetAppGlobalValue("Status3Langs")
                    };
                    if (stateReadyImageFile != null)
                    {
                        cc.StateReadyImagePath = stateReadyImageFile;
                    }

                    //CellContainer cc = new CellContainer(cellWidth, cellHeight)
                    //{
                    //    PanelBrushes = _cellBrushes,
                    //    TitleLangs = (string[])AppLib.GetAppGlobalValue("StatusTitle"),
                    //    StatusLangs = (string[][])AppLib.GetAppGlobalValue("StatusLang"),
                    //    IsShowOrderEstimateTime = (bool)AppLib.GetAppGlobalValue("IsShowOrderEstimateTime"),
                    //    IsShowClientName = (bool)AppLib.GetAppGlobalValue("IsShowClientName"),
                    //    OrderNumberFontSize = (double)AppLib.GetAppGlobalValue("OrderNumberFontSize", 0),
                    //    StatusReadyImageFile = (string)AppLib.GetAppGlobalValue("StatusReadyImageFile")
                    //};

                    Grid.SetRow(cc, i); Grid.SetColumn(cc, j);
                    grid.Children.Add(cc);
                }
            }
        }  // method