private void buttonSaveSettings_Click(object sender, EventArgs e) { if (Save()) { mdi.SendAlert(this.ParentForm as IMyGenContent, "UpdateDefaultSettings"); this.OnAfterSave(); } }
private void SettingsSaveButton_OnClicked(object sender, EventArgs e) { if (Save()) { _mdi.SendAlert(ParentForm as IMyGenContent, "UpdateDefaultSettings"); OnAfterSave(); } }
void DefaultProperties_FormClosing(object sender, FormClosingEventArgs e) { if ((e.CloseReason == CloseReason.UserClosing) || (e.CloseReason == CloseReason.FormOwnerClosing)) { DialogResult r = DialogResult.None; // Something's Changed since the load... if (defaultSettingsControl.SettingsModified) { r = MessageBox.Show("Default settings have changed.\r\n Would you like to save before exiting?", "Default Settings Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); } else if (defaultSettingsControl.ConnectionInfoModified) { r = MessageBox.Show("The loaded connection profile has changed.\r\n Would you like to save before exiting?", "Connection Profile Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); } if (r != DialogResult.None) { if (r == DialogResult.Cancel) { e.Cancel = true; } else if (r == DialogResult.Yes) { if (defaultSettingsControl.Save()) { this.DialogResult = DialogResult.OK; mdi.SendAlert(this, "UpdateDefaultSettings"); } } else { defaultSettingsControl.Cancel(); this.DialogResult = DialogResult.Cancel; } } } }
private void DefaultProperties_OnClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.UserClosing && e.CloseReason != CloseReason.FormOwnerClosing) { return; } var dialogResult = DialogResult.None; if (_defaultSettingsControl.SettingsModified) { dialogResult = MessageBox.Show("Default settings have changed.\r\n Would you like to save before exiting?", "Default Settings Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); } else if (_defaultSettingsControl.ConnectionInfoModified) { dialogResult = MessageBox.Show("The loaded connection profile has changed.\r\n Would you like to save before exiting?", "Connection Profile Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); } if (dialogResult == DialogResult.None) { return; } if (dialogResult == DialogResult.Cancel) { e.Cancel = true; } else if (dialogResult == DialogResult.Yes) { if (!_defaultSettingsControl.Save()) { return; } DialogResult = DialogResult.OK; _mdi.SendAlert(this, "UpdateDefaultSettings"); } else { _defaultSettingsControl.Cancel(); DialogResult = DialogResult.Cancel; } }