private void OptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            // serialize the child controls values and save if OK button pressed
            string values = string.Empty;

            if (this.DialogResult == DialogResult.OK)
            {
                values = ParseOptionsControls();
            }
            OptionsClosingEvent args = new OptionsClosingEvent(this.DialogResult, values);
            EventHandler <OptionsClosingEvent> handler = DialogClosing;

            if (handler != null)
            {
                // raises the event.
                handler(this, args);
            }
        }
 private void OptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     // serialize the child controls values and save if OK button pressed
     string values = string.Empty;
     if (this.DialogResult == DialogResult.OK)
     {
         values = ParseOptionsControls();
     }
     OptionsClosingEvent args = new OptionsClosingEvent(this.DialogResult, values);
     EventHandler<OptionsClosingEvent> handler = DialogClosing;
     if (handler != null)
     {
         // raises the event. 
         handler(this, args);
     }
 }