Пример #1
0
        /// <summary>
        /// Create deep copy of current instance.
        /// </summary>
        /// <returns>Deep copy.</returns>
        public DisplaySettings Copy()
        {
            var result = new DisplaySettings();

            result.Copy(this);
            return(result);
        }
Пример #2
0
        private DisplayOptionsForm(DisplaySettings settings)
        {
            _settings = settings;
            InitializeComponent();

            cmbSiteDisplayName.DataSource = Enum.GetNames(typeof(SiteDisplayColumns));
            cmbSiteDisplayName.DataBindings.Clear();
            cmbSiteDisplayName.DataBindings.Add("SelectedItem", _settings, "SiteDisplayColumn");
        }
Пример #3
0
        /// <summary>
        /// Create deep from source into current instance.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <exception cref="ArgumentNullException"><paramref name="source"/>must be not null.</exception>
        public void Copy(DisplaySettings source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            SiteDisplayColumn = source.SiteDisplayColumn;
        }
Пример #4
0
        private void btnOptions_Click(object sender, EventArgs e)
        {
            SetEnableToButtons(false);
            var ds = new DisplaySettings
            {
                SiteDisplayColumn = SiteDisplayColumn,
            };

            if (DisplayOptionsForm.ShowDialog(ds) == DialogResult.OK)
            {
                SiteDisplayColumn = ds.SiteDisplayColumn;
            }
            SetEnableToButtons(true);
        }
Пример #5
0
        public static DialogResult ShowDialog(DisplaySettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            using (var form = new DisplayOptionsForm(settings.Copy()))
            {
                var dialogResult = form.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    settings.Copy(form._settings);
                }

                return(dialogResult);
            }
        }