private void LoadColumnState() { try { var columnState = ColumnSettingsOperations.LoadColumnState(_tabIdentifier); if (columnState == null) { return; } int newIndex = 0; foreach (var col in columnState) { int oldIndex = 0; for (int i = 0; i < casesGridView.Columns.Count; i++) { if (casesGridView.Columns[i].Header.ToString().Equals(col.ColumnName)) { oldIndex = i; break; } } casesGridView.Columns[oldIndex].Width = col.Width; casesGridView.Columns.Move(oldIndex, newIndex++); } _columnsLoaded = true; } catch (Exception e) { LoggerController.Log(e, "Unable to read columns setting file or file has invalid formatting"); } }
private void CurrentOnExit(object sender, ExitEventArgs e) { Application.Current.Exit -= CurrentOnExit; foreach (var tab in WorkAreaVM.Tabs) { tab.Content.CasesCanvasVM.UpdateCasesPositions(); } CasesStatesOperations.SaveState(); ColumnSettingsOperations.SaveState(); }
private void CurrentOnExit(object sender, ExitEventArgs e) { Application.Current.Exit -= CurrentOnExit; ColumnSettingsOperations.UpdateColumnState(_tabIdentifier, casesGridView.Columns); }