Ejemplo n.º 1
0
        private int CurrentRowIndex()
        {
            int rowIndex = -1;

            SourceGrid.RangeRegion selectedRegion = grdDetails.Selection.GetSelectionRegion();

            if ((selectedRegion != null) && (selectedRegion.GetRowsIndex().Length > 0))
            {
                rowIndex = selectedRegion.GetRowsIndex()[0];
            }

            return(rowIndex);
        }
        private void onSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedAnalysis = null;
                }
                else
                {
                    _selectedAnalysis = _analyses[indexes[0] - 1];
                    // analysis name/description
                    if (null != _selectedAnalysis)
                    {
                        BoxProperties  box  = SelectedBox;
                        PackProperties pack = _selectedAnalysis.Content as PackProperties;
                        UpdateStatus(string.Empty);
                    }
                }

                graphCtrlPack.Invalidate();
                graphCtrlSolution.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void OnSelChangeGrid(object sender, EventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedItem = null;
                }
                else
                {
                    int iSel = indexes[0] - 1;
                    if (g == gridPallets)
                    {
                        _selectedItem = _pallets[iSel];
                    }
                }
                graphCtrl.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }
Ejemplo n.º 4
0
 public void GridCopySelectedToClipboard()
 {
     // Analyze selected range (rows/cols)
     SourceGrid.RangeRegion selRegion = grid1.Selection.GetSelectionRegion();
     int[] selRows = selRegion.GetRowsIndex();
     int[] selCols = selRegion.GetColumnsIndex();
     Array.Sort(selRows);
     Array.Sort(selCols);
     GridCopyToClipboard(selRows, selCols);
 }
Ejemplo n.º 5
0
 private int GetCurrentSolutionIndex()
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return(-1);
     }
     // return index
     return(indexes[0] - 1);
 }
Ejemplo n.º 6
0
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // redraw
     Draw();
 }
Ejemplo n.º 7
0
 private CasePalletSolution GetCurrentSolution()
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return(null);
     }
     else
     {
         return(gridSolutions.Rows[indexes[0]].Tag as CasePalletSolution);
     }
 }
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // get selected solution
     _sol = _analysis.Solutions[indexes[0] - 1];
     // redraw
     graphCtrlCase.Invalidate();
     graphCtrlPallet.Invalidate();
 }
Ejemplo n.º 9
0
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // update select/unselect button text
     UpdateSelectButtonText();
     // redraw
     graphCtrlCaseSolution.Invalidate();
     graphCtrlPalletSolution.Invalidate();
 }
Ejemplo n.º 10
0
 void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // redraw
     graphCtrlBoxesLayout.Invalidate();
     graphCtrlPallet.Invalidate();
     // update "Add solution" button status
     UpdateButtonAddSolutionStatus();
 }
Ejemplo n.º 11
0
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // get selected solution
     _sol = _analysis.Solutions[indexes[0] - 1];
     // update select/unselect button text
     UpdateSelectButtonText();
     // redraw
     Draw();
 }
Ejemplo n.º 12
0
 void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     try
     {
         SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
         int[] indexes = region.GetRowsIndex();
         // no selection -> exit
         if (indexes.Length == 0)
         {
             return;
         }
         // redraw
         Draw();
         // update "Add solution" button status
         UpdateToolbarButtons();
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
Ejemplo n.º 13
0
        private void OnSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedAnalysis = null;
                }
                else
                {
                    _selectedAnalysis = _analyses[indexes[0] - 1];
                    // analysis name/description
                    if (null != _selectedAnalysis)
                    {
                        BoxProperties  box  = SelectedBox;
                        PackProperties pack = _selectedAnalysis.Content as PackProperties;
                        AnalysisName = string.Format("Analysis_{0}x{1}x{2}_{3}_on_{4}",
                                                     pack.Dim0, pack.Dim1, pack.Dim2, box.Name, _selectedAnalysis.Container.Name);
                        AnalysisDescription = string.Format("Packing {0}x{1}x{2} {3} on {4}",
                                                            pack.Dim0, pack.Dim1, pack.Dim2, box.Name, _selectedAnalysis.Container.Name);

                        UpdateStatus(string.Empty);
                    }
                    else
                    {
                        AnalysisName        = string.Empty;
                        AnalysisDescription = string.Empty;
                    }
                }

                graphCtrlPack.Invalidate();
                graphCtrlSolution.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }
Ejemplo n.º 14
0
        private void onSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedAnalysis = null;
                }
                else
                {
                    _selectedAnalysis = _analyses[indexes[0] - 1];
                    // analysis name/description
                    if (null != _selectedAnalysis)
                    {
                        AnalysisName        = string.Format("Analysis_{0}_in_{1}", _selectedAnalysis.Content.Name, _selectedAnalysis.Container.Name);
                        AnalysisDescription = string.Format(" Packing {0} in {1}", _selectedAnalysis.Content.Name, _selectedAnalysis.Container.Name);
                    }
                    else
                    {
                        AnalysisName        = string.Empty;
                        AnalysisDescription = string.Empty;
                    }
                }
                // update drawing
                graphCtrl.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }