Пример #1
0
        private void SetupRSSGrid()
        {
            SourceGrid.Cells.Views.Cell titleModel = new SourceGrid.Cells.Views.Cell
            {
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft
            };

            this.RSSGrid.Columns.Clear();
            this.RSSGrid.Rows.Clear();

            this.RSSGrid.RowsCount    = 1;
            this.RSSGrid.ColumnsCount = 1;
            this.RSSGrid.FixedRows    = 1;
            this.RSSGrid.FixedColumns = 0;
            this.RSSGrid.Selection.EnableMultiSelection = false;

            this.RSSGrid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            this.RSSGrid.AutoStretchColumnsToFitWidth = true;
            this.RSSGrid.Columns.StretchToFit();

            //////////////////////////////////////////////////////////////////////
            // header row

            ColumnHeader h = new SourceGrid.Cells.ColumnHeader("URL");

            h.AutomaticSortEnabled  = false;
            this.RSSGrid[0, 0]      = h;
            this.RSSGrid[0, 0].View = titleModel;
        }
Пример #2
0
        private void SetupReplacementsGrid()
        {
            SourceGrid.Cells.Views.Cell titleModel = new SourceGrid.Cells.Views.Cell
            {
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft
            };

            this.ReplacementsGrid.Columns.Clear();
            this.ReplacementsGrid.Rows.Clear();

            this.ReplacementsGrid.RowsCount    = 1;
            this.ReplacementsGrid.ColumnsCount = 3;
            this.ReplacementsGrid.FixedRows    = 1;
            this.ReplacementsGrid.FixedColumns = 0;
            this.ReplacementsGrid.Selection.EnableMultiSelection = false;

            this.ReplacementsGrid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch | SourceGrid.AutoSizeMode.EnableAutoSize;
            this.ReplacementsGrid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch | SourceGrid.AutoSizeMode.EnableAutoSize;
            this.ReplacementsGrid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;

            this.ReplacementsGrid.Columns[2].Width = 80;

            this.ReplacementsGrid.AutoStretchColumnsToFitWidth = true;
            this.ReplacementsGrid.Columns.StretchToFit();

            this.ReplacementsGrid.Columns[0].Width = this.ReplacementsGrid.Columns[0].Width - 8; // allow for scrollbar
            this.ReplacementsGrid.Columns[1].Width = this.ReplacementsGrid.Columns[1].Width - 8;

            //////////////////////////////////////////////////////////////////////
            // header row

            SourceGrid.Cells.ColumnHeader h;
            h = new SourceGrid.Cells.ColumnHeader("Search");
            h.AutomaticSortEnabled           = false;
            this.ReplacementsGrid[0, 0]      = h;
            this.ReplacementsGrid[0, 0].View = titleModel;

            h = new SourceGrid.Cells.ColumnHeader("Replace");
            h.AutomaticSortEnabled           = false;
            this.ReplacementsGrid[0, 1]      = h;
            this.ReplacementsGrid[0, 1].View = titleModel;

            h = new SourceGrid.Cells.ColumnHeader("Case Ins.");
            h.AutomaticSortEnabled           = false;
            this.ReplacementsGrid[0, 2]      = h;
            this.ReplacementsGrid[0, 2].View = titleModel;
        }
Пример #3
0
        private void SetupRSSGrid()
        {
            SourceGrid.Cells.Views.Cell titleModel = new SourceGrid.Cells.Views.Cell
                                                         {
                                                             BackColor = Color.SteelBlue,
                                                             ForeColor = Color.White,
                                                             TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft
                                                         };

            this.RSSGrid.Columns.Clear();
            this.RSSGrid.Rows.Clear();

            this.RSSGrid.RowsCount = 1;
            this.RSSGrid.ColumnsCount = 1;
            this.RSSGrid.FixedRows = 1;
            this.RSSGrid.FixedColumns = 0;
            this.RSSGrid.Selection.EnableMultiSelection = false;

            this.RSSGrid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            this.RSSGrid.AutoStretchColumnsToFitWidth = true;
            this.RSSGrid.Columns.StretchToFit();

            //////////////////////////////////////////////////////////////////////
            // header row

            ColumnHeader h = new SourceGrid.Cells.ColumnHeader("URL");
            h.AutomaticSortEnabled = false;
            this.RSSGrid[0, 0] = h;
            this.RSSGrid[0, 0].View = titleModel;
        }
Пример #4
0
        private void SetupReplacementsGrid()
        {
            SourceGrid.Cells.Views.Cell titleModel = new SourceGrid.Cells.Views.Cell
                                                         {
                                                             BackColor = Color.SteelBlue,
                                                             ForeColor = Color.White,
                                                             TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft
                                                         };

            this.ReplacementsGrid.Columns.Clear();
            this.ReplacementsGrid.Rows.Clear();

            this.ReplacementsGrid.RowsCount = 1;
            this.ReplacementsGrid.ColumnsCount = 3;
            this.ReplacementsGrid.FixedRows = 1;
            this.ReplacementsGrid.FixedColumns = 0;
            this.ReplacementsGrid.Selection.EnableMultiSelection = false;

            this.ReplacementsGrid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch | SourceGrid.AutoSizeMode.EnableAutoSize;
            this.ReplacementsGrid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch | SourceGrid.AutoSizeMode.EnableAutoSize;
            this.ReplacementsGrid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;

            this.ReplacementsGrid.Columns[2].Width = 80;

            this.ReplacementsGrid.AutoStretchColumnsToFitWidth = true;
            this.ReplacementsGrid.Columns.StretchToFit();

            this.ReplacementsGrid.Columns[0].Width = this.ReplacementsGrid.Columns[0].Width - 8; // allow for scrollbar
            this.ReplacementsGrid.Columns[1].Width = this.ReplacementsGrid.Columns[1].Width - 8;

            //////////////////////////////////////////////////////////////////////
            // header row

            SourceGrid.Cells.ColumnHeader h;
            h = new SourceGrid.Cells.ColumnHeader("Search");
            h.AutomaticSortEnabled = false;
            this.ReplacementsGrid[0, 0] = h;
            this.ReplacementsGrid[0, 0].View = titleModel;

            h = new SourceGrid.Cells.ColumnHeader("Replace");
            h.AutomaticSortEnabled = false;
            this.ReplacementsGrid[0, 1] = h;
            this.ReplacementsGrid[0, 1].View = titleModel;

            h = new SourceGrid.Cells.ColumnHeader("Case Ins.");
            h.AutomaticSortEnabled = false;
            this.ReplacementsGrid[0, 2] = h;
            this.ReplacementsGrid[0, 2].View = titleModel;
        }
Пример #5
0
        private void FillGrid()
        {
            try
            {
                // remove all existing rows
                gridSolutions.Rows.Clear();
                // *** IViews
                // captionHeader
                SourceGrid.Cells.Views.RowHeader        captionHeader   = new SourceGrid.Cells.Views.RowHeader();
                DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader()
                {
                    BackColor = Color.SteelBlue,
                    Border    = DevAge.Drawing.RectangleBorder.NoBorder
                };
                captionHeader.Background    = veHeaderCaption;
                captionHeader.ForeColor     = Color.Black;
                captionHeader.Font          = new Font("Arial", GridFontSize, FontStyle.Bold);
                captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
                // viewRowHeader
                SourceGrid.Cells.Views.ColumnHeader        viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
                DevAge.Drawing.VisualElements.ColumnHeader backHeader       = new DevAge.Drawing.VisualElements.ColumnHeader()
                {
                    BackColor = Color.LightGray,
                    Border    = DevAge.Drawing.RectangleBorder.NoBorder
                };
                viewColumnHeader.Background            = backHeader;
                viewColumnHeader.ForeColor             = Color.Black;
                viewColumnHeader.Font                  = new Font("Arial", GridFontSize, FontStyle.Regular);
                viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;
                // viewNormal
                CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
                // ***
                // set first row
                gridSolutions.BorderStyle  = BorderStyle.FixedSingle;
                gridSolutions.ColumnsCount = 7;
                gridSolutions.FixedRows    = 1;
                gridSolutions.Rows.Insert(0);
                // header
                int iCol = 0;
                // A1xA2xA3
                var columnHeader = new ColumnHeader("A1 x A2 x A3")
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;
                // dimensions
                columnHeader = new ColumnHeader(string.Format(Properties.Resources.ID_DIMENSIONS, UnitsManager.LengthUnitString))
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;
                // weight
                columnHeader = new ColumnHeader(string.Format(Properties.Resources.ID_WEIGHT_WU, UnitsManager.MassUnitString))
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;
                // #packs
                columnHeader = new ColumnHeader("#")
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;
                // weight
                columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString))
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;
                // efficiency
                columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EFFICIENCYPERCENTAGE)
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;
                // maximum space
                columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_MAXIMUMSPACE, UnitsManager.LengthUnitString))
                {
                    AutomaticSortEnabled = false,
                    View = viewColumnHeader
                };
                gridSolutions[0, iCol++] = columnHeader;

                int iRow = 0;
                foreach (AnalysisLayered analysis in _analyses)
                {
                    if (analysis is AnalysisCasePallet analysisCasePallet && analysis.Content is PackProperties pack)
                    {
                        int layerCount = analysisCasePallet.SolutionLay.Layers.Count;
                        if (layerCount < 1)
                        {
                            continue;
                        }
                        int    packPerLayerCount = analysisCasePallet.SolutionLay.Layers[0].BoxCount;
                        int    itemCount         = analysisCasePallet.Solution.ItemCount;
                        double palletWeight      = analysisCasePallet.Solution.Weight;
                        double volumeEfficiency  = analysisCasePallet.Solution.VolumeEfficiency;
                        double maximumSpace      = analysisCasePallet.SolutionLay.LayerCount > 0
                            ? analysisCasePallet.SolutionLay.LayerMaximumSpace(0)
                            : 0;


                        gridSolutions.Rows.Insert(++iRow);
                        iCol = 0;
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{pack.Arrangement.Length} x {pack.Arrangement.Width} x {pack.Arrangement.Height}");
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{pack.OuterDimensions.X:0.#} x {pack.OuterDimensions.Y:0.#} x {pack.OuterDimensions.Z:0.#}");
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{pack.Weight:0.###}");
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{itemCount} = {packPerLayerCount} x {layerCount}");
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{palletWeight:0.###}");
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{volumeEfficiency:0.#}");
                        gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell($"{maximumSpace:0.#}");
                    }
                }

                gridSolutions.AutoStretchColumnsToFitWidth = true;
                gridSolutions.AutoSizeCells();
                gridSolutions.Columns.StretchToFit();

                // select first solution
                if (gridSolutions.RowsCount > 1)
                {
                    gridSolutions.Selection.SelectRow(1, true);
                }
                else
                {
                    // grid empty -> clear drawing
                    _selectedAnalysis = null;
                    graphCtrlPack.Invalidate();
                    graphCtrlSolution.Invalidate();
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }