コード例 #1
0
        /// <summary>
        /// Populates the Connection Options with the current values in the form controls
        /// </summary>
        /// <param name="options"></param>
        private void Populate(ConnectionAdditionalOptions options)
        {
            options.AllowSaveForAllTypes = this.cbAllowSave.Checked;
            options.BlanketIgnoreExtraElements = this.cbBlanketIgnoreExtraElements.Checked;

            options.ExplicitSaveAllowedTypes.AddRange(this.lbSaveAllowedTypes.Items.Cast<string>());
        }
コード例 #2
0
        /// <summary>
        /// Checks to see if the data changed from save, and if so, prompts the user.
        /// </summary>
        /// <returns>True if the form should close, False if the form should stay open.</returns>
        private bool DoCancel()
        {
            var working = new ConnectionAdditionalOptions();
            this.Populate(working);

            if (!working.Equals(this.mProps.AdditionalOptions))
            {
                var result = MessageBox.Show("Changes have been made.  Do you want to save first?", "Cancel", MessageBoxButtons.YesNoCancel);
                if (result == System.Windows.Forms.DialogResult.No)
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                    return true;
                }
                else if (result == System.Windows.Forms.DialogResult.Cancel)
                {
                    return false;
                }
                else if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    return this.DoSave();
                }

                return false;
            }

            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            return true;
        }
コード例 #3
0
        /// <summary>
        /// validates and saves the data to the connection
        /// </summary>
        /// <returns>true if the data successfully saved, false if the form should stay open</returns>
        private bool DoSave()
        {
            var options = new ConnectionAdditionalOptions();
            this.Populate(options);
            this.SelectedOptions = options;

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            return true;
        }