示例#1
0
 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;
         }
     }
 }
示例#2
0
        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();
            }
        }