private bool InternalManage() { if (IsModified) { if (InternalClose(true) == false) { return(false); } } var loadoutWindow = new LoadoutWindow(true, currentLoadoutName, rootViewModel.SelectedAbilities) { Owner = Application.Current.MainWindow }; WindowManager.RestoreWindowState(loadoutWindow); loadoutWindow.ShowDialog(); WindowManager.StoreWindowState(loadoutWindow); if (loadoutWindow.CurrentLoadoutName != currentLoadoutName) { // Currently selected skill loadout has been renamed. currentLoadoutName = loadoutWindow.CurrentLoadoutName; GlobalData.Instance.Configuration.LastOpenedLoadout = currentLoadoutName; LoadoutChanged?.Invoke(this, new LoadoutNameEventArgs(currentLoadoutName)); } ConfigurationManager.Save(GlobalData.Instance.Configuration); return(true); }
private bool InternalOpen(string loadoutName, SkillLoadoutItemConfigurationV3 loadoutConfig) { if (IsModified) { if (InternalClose(false) == false) { return(false); } } if (loadoutName == null || loadoutConfig == null) { var loadoutWindow = new LoadoutWindow(false, currentLoadoutName, rootViewModel.SelectedAbilities) { Owner = Application.Current.MainWindow }; WindowManager.RestoreWindowState(loadoutWindow); bool?showResult = loadoutWindow.ShowDialog(); WindowManager.StoreWindowState(loadoutWindow); if (showResult != true) { return(false); } bool hasLoadoutChanged = CurrentLoadoutName != loadoutWindow.SelectedLoadout.Name; if (isModified || hasLoadoutChanged) { LoadLoadoutFromViewModel(loadoutWindow.SelectedLoadout); } if (hasLoadoutChanged) { CurrentLoadoutName = loadoutWindow.SelectedLoadout.Name; ConfigurationManager.Save(GlobalData.Instance.Configuration); } } else { LoadLoadoutFromConfig(loadoutConfig); CurrentLoadoutName = loadoutName; } // Postponing rest of the IsModified flag to false to the next scheduler frame is // because of a change in the way ability/skill checkboxes are processed, for performance reasons. rootViewModel.Dispatcher.BeginInvoke((Action) delegate { IsModified = false; }); return(true); }