public static SelectedGridRowsSummaryWindow GetInstance() { if (_instance == null) { _instance = new SelectedGridRowsSummaryWindow(); } return(_instance); }
private void OnDataGridSelectionChanged(object sender, SelectionChangedEventArgs e) { if (dataGridAttributes.SelectedItems.Count >= 1) { try { DataColumn col = ((DataRowView)e.AddedItems[0]).Row.Table.Columns["MWShapeID"]; if (col == null) { return; //Global.Settings. } if (col != null) { List <int> selectedIDs = new List <int>(); foreach (DataRowView row in ((DataGrid)sender).SelectedItems) { selectedIDs.Add(row.Row.Field <int>(col)); } if (_gridWaslClicked) { MapWindowManager.SelectedAttributeRows = selectedIDs; _gridWaslClicked = false; } if (dataGridAttributes.SelectedItems.Count == 1) { SelectedGridRowsSummaryWindow.Instance()?.Close(); } else { var summaryWindow = SelectedGridRowsSummaryWindow.GetInstance(); summaryWindow.Owner = this; if (summaryWindow.Visibility == Visibility.Visible) { summaryWindow.BringIntoView(); } else { summaryWindow.Show(); summaryWindow.GetSelectedShapes(); } } } } catch (IndexOutOfRangeException) { //ignore } catch (Exception ex) { Logger.Log(ex); } } }
private void OnDataGridAttributes_SelectionChanged(object sender, SelectionChangedEventArgs e) { var itemCounts = dataGridAttributes.SelectedItems.Count; //if (itemCounts > 1 && ShowSummaryOfSelectedItems) if (itemCounts > 1) { var summaryWindow = SelectedGridRowsSummaryWindow.GetInstance(); summaryWindow.Owner = this; if (summaryWindow.Visibility == Visibility.Visible) { summaryWindow.BringIntoView(); } else { summaryWindow.Show(); } } else { } }
private void OnWindowClosed(object sender, EventArgs e) { //_sf = null; //this.SavePlacement(); _instance = null; }