private void showDataPanelDlg() { var dataPanel = new DataPanel(); if (isSmallPlangoram) { dataPanel.NumItems = SMALL_ITEMS_COUNT; dataPanel.NumShelves = 1; dataPanel.NumSlots = 24; } else { dataPanel.NumItems = LARGE_ITEMS_COUNT; dataPanel.NumShelves = 12; dataPanel.NumSlots = 24; } dataPanel.Closed += (s, ee) => { dataPanel = new DataPanel(); setSelectedPlanogramSize(); InitializeGrid(planogram, Colors.LightGray, true); InitializeGrid(planogramTensorflow, Colors.LightGray); }; dataPanel.NumItems = simSettings.NumItems; dataPanel.NumShelves = simSettings.NumShelves; dataPanel.NumSlots = simSettings.NumSlots; dataPanel.dataGrid.Loaded += (ss, evv) => { bool exist = false; using (PlanogramContext ctx = new PlanogramContext()) { exist = ctx.Database.Exists(); } if (exist) { dataPanel.dataGrid.ItemsSource = dataFactory.Items; // Setting data source for the DataPanel's datagrid dataPanel.Items = dataFactory.Items; // Store the items to a new List for searching purposes dataPanel.dataGrid.AutoGenerateColumns = false; // Binding and settings of datagrid columns dataPanel.dataGrid.Columns.Add(new DataGridTextColumn() { Header = "ID", Binding = new Binding("ID"), Width = new DataGridLength(1, DataGridLengthUnitType.Star), IsReadOnly = true }); dataPanel.dataGrid.Columns.Add(new DataGridTextColumn() { Header = "SKU", Binding = new Binding("SKU"), Width = new DataGridLength(1, DataGridLengthUnitType.Star), IsReadOnly = true }); dataPanel.dataGrid.Columns.Add(new DataGridTextColumn() { Header = "Name", Binding = new Binding("Name"), Width = new DataGridLength(1, DataGridLengthUnitType.Star), IsReadOnly = true }); } }; dataPanel.ShowDialog(); }
private void showDataPanelDlg() { dataPanel.Closed += (s, ee) => { dataPanel = new DataPanel(); setSelectedPlanogramSize(); }; dataPanel.NumItems = simSettings.NumItems; dataPanel.NumShelves = simSettings.NumShelves; dataPanel.NumSlots = simSettings.NumSlots; dataPanel.dataGrid.Loaded += (ss, evv) => { bool exist = false; using (PlanogramContext ctx = new PlanogramContext()) { exist = ctx.Database.Exists(); } if (exist) { dataPanel.dataGrid.ItemsSource = dataFactory.Items; // Setting data source for the DataPanel's datagrid dataPanel.Items = dataFactory.Items; // Store the items to a new List for searching purposes dataPanel.dataGrid.AutoGenerateColumns = false; // Binding and settings of datagrid columns dataPanel.dataGrid.Columns.Add(new DataGridTextColumn() { Header = "ID", Binding = new Binding("ID"), Width = new DataGridLength(1, DataGridLengthUnitType.Star), IsReadOnly = true }); dataPanel.dataGrid.Columns.Add(new DataGridTextColumn() { Header = "SKU", Binding = new Binding("SKU"), Width = new DataGridLength(1, DataGridLengthUnitType.Star), IsReadOnly = true }); dataPanel.dataGrid.Columns.Add(new DataGridTextColumn() { Header = "Name", Binding = new Binding("Name"), Width = new DataGridLength(1, DataGridLengthUnitType.Star), IsReadOnly = true }); } }; dataPanel.ShowDialog(); }