Beispiel #1
0
        /// <summary>
        /// Handles the FormClosing event of the FormMain control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.FormClosingEventArgs"/> instance containing the event data.</param>
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            dockPanel.SaveAsXml(configFile);

            if (Properties.Settings.Default.AskConfirmationOnClose)
            {
                DialogResult ret = MessageBox.Show(this, "Do you want to exit?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (ret == DialogResult.Yes)
                {
                    UseCaseConfig.Save();
                    return;
                }
                else
                {
                    // bug fix: if user says no the windows does not close
                    e.Cancel = true;
                }
            }
            else
            {
                // close without confirmation
                UseCaseConfig.Save();
                return;
            }
        }
Beispiel #2
0
 /// <summary>
 /// Handles the Click event of the rbtnConfigSave control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void rbtnConfigSave_Click(object sender, EventArgs e)
 {
     UseCaseConfig.Save(showDialog: true);
 }
Beispiel #3
0
 /// <summary>
 /// Handles the Click event of the btnConfigLoad control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void btnConfigLoad_Click(object sender, EventArgs e)
 {
     UseCaseConfig.Load(showDialog: true);
 }