private void SetButtons(bool settingsHaveChanged) { if (!settingsHaveChanged) { RevertFormatButton.Enabled = false; SaveFormatButton.Enabled = false; WriteButton.Enabled = true; WriteButton.Focus(); } else // settings have changed { if (AllInputsAreErrorFree()) { RevertFormatButton.Enabled = true; SaveFormatButton.Enabled = true; WriteButton.Enabled = false; SaveFormatButton.Focus(); } else { RevertFormatButton.Enabled = true; SaveFormatButton.Enabled = false; WriteButton.Enabled = false; } } }
private void SaveFormatButton_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Save settings?", "Save", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { SaveSettings(); _settingsHaveChanged = false; WriteButton.Enabled = true; WriteButton.Focus(); } }