private void SaveCurrentProfile() { if (popup != null) { popup.Dismiss(); } else { editText = ScienceAlertProfileManager.ActiveProfile.name; } // Confirm overwrite an existing non-active profile if (ScienceAlertProfileManager.HaveStoredProfile(editText) && ScienceAlertProfileManager.ActiveProfile.name != editText) { popup = PopupDialog.SpawnPopupDialog(new MultiOptionDialog("", "", Localizer.Format("#ScienceAlert_label20", editText), HighLogic.UISkin, //$"Profile '{}' already exists!" new DialogGUIButton(Localizer.Format("#ScienceAlert_button13"), SaveCurrentProfileOverwrite), //"Overwrite" new DialogGUIButton(Localizer.Format("#ScienceAlert_button10"), DismissPopup)), //"Cancel" false, HighLogic.UISkin); } else { SaveCurrentProfileOverwrite(); // save to go ahead and save since no existing profile with this key exists } }
private void SaveCurrentProfile() { if (popup != null) { popup.Dismiss(); } else { editText = ScienceAlertProfileManager.ActiveProfile.name; } // Confirm overwrite an existing non-active profile if (ScienceAlertProfileManager.HaveStoredProfile(editText) && ScienceAlertProfileManager.ActiveProfile.name != editText) { popup = PopupDialog.SpawnPopupDialog(new MultiOptionDialog("", "", $"Profile '{editText}' already exists!", HighLogic.UISkin, new DialogGUIButton("Overwrite", SaveCurrentProfileOverwrite), new DialogGUIButton("Cancel", DismissPopup)), false, HighLogic.UISkin); } else { SaveCurrentProfileOverwrite(); // save to go ahead and save since no existing profile with this key exists } }
private void RenameTargetProfileOverwrite() { if (!editProfile.modified && ScienceAlertProfileManager.HaveStoredProfile(editProfile.name)) { ScienceAlertProfileManager.RenameProfile(editProfile.name, editText); if (!ScienceAlertProfileManager.ActiveProfile.modified) { ScienceAlertProfileManager.ActiveProfile.name = editText; } } else { editProfile.name = editText; editProfile.modified = true; } DismissPopup(); }
private void RenameTargetProfile() { if (editProfile.modified || !ScienceAlertProfileManager.HaveStoredProfile(editProfile.name)) { RenameTargetProfileOverwrite(); } else { if (ScienceAlertProfileManager.HaveStoredProfile(editText)) { popup.Dismiss(); popup = PopupDialog.SpawnPopupDialog( new MultiOptionDialog(string.Empty, Localizer.Format("#ScienceAlert_Msg2", editText), Localizer.Format("#ScienceAlert_Msg2title2"), HighLogic.UISkin, //$"'{}' already exists. Overwrite?""RenameTargetProfile" new DialogGUIButton(Localizer.Format("#ScienceAlert_Msg2_button1"), RenameTargetProfileOverwrite), //"Yes" new DialogGUIButton(Localizer.Format("#ScienceAlert_Msg2_button2"), DismissPopup)), //"No" false, HighLogic.UISkin); return; } RenameTargetProfileOverwrite(); } SpawnSavePopup(); DismissPopup(); }
private void RenameTargetProfile() { if (editProfile.modified || !ScienceAlertProfileManager.HaveStoredProfile(editProfile.name)) { RenameTargetProfileOverwrite(); } else { if (ScienceAlertProfileManager.HaveStoredProfile(editText)) { popup.Dismiss(); popup = PopupDialog.SpawnPopupDialog( new MultiOptionDialog(string.Empty, $"'{editText}' already exists. Overwrite?", "RenameTargetProfile", HighLogic.UISkin, new DialogGUIButton("Yes", RenameTargetProfileOverwrite), new DialogGUIButton("No", DismissPopup)), false, HighLogic.UISkin); return; } RenameTargetProfileOverwrite(); } SpawnSavePopup(); DismissPopup(); }