Пример #1
0
        /// <summary>
        /// Show the form and the list of props passed in
        /// </summary>
        /// <param name="origPropertySet">
        /// The original PropertySet used to populate the initial state
        /// of the form.
        /// </param>
        /// <returns>
        /// DialogResult.OK indicates that the PropertySet was updated.
        /// </returns>
        public static DialogResult Show(ref PropertySet origPropertySet)
        {
            PropertySetDialog dialog = new PropertySetDialog();

            dialog.initialPropertySet = origPropertySet;

            DialogResult res = dialog.ShowDialog();

            // Don't update props unless DialogResult == OK. If
            // the dialog is canceled, props goes unchanged
            if (res == DialogResult.OK)
            {
                // Only reutrn OK if the PropertySet changed
                if (dialog.IsDirty)
                {
                    origPropertySet = dialog.CurrentPropertySet;
                    return(DialogResult.OK);
                }
                else
                {
                    return(DialogResult.Ignore);
                }
            }

            return(res);
        }
Пример #2
0
        private void btnPropSet_Click(object sender, EventArgs e)
        {
            PropertySet propSet = this.CurrentPropertySet;

            if (PropertySetDialog.Show(ref propSet) == DialogResult.OK)
            {
                this.CurrentPropertySet = propSet;
            }
        }
Пример #3
0
        /// <summary>
        /// Display PropertySetDialog to configure the PropertySet used
        /// to populate the details grid
        /// </summary>
        /// <param name="sender">The parameter is not used.</param>
        /// <param name="e">The parameter is not used.</param>
        private void MnuPropertySet_Click(object sender, EventArgs e)
        {
            try
            {
                // Display PropertiesDialog
                PropertySet propSet = this.CurrentDetailPropertySet;
                if (PropertySetDialog.Show(ref propSet) == DialogResult.OK)
                {
                    this.Cursor = System.Windows.Forms.Cursors.WaitCursor;

                    this.CurrentDetailPropertySet = propSet;

                    // If there is a handler for mnuRefresh, now would be a good time to
                    // call it.
                    this.mnuRefresh.PerformClick();
                }
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
            }
        }