/* ----------------------------------------------------------------- */
        ///
        /// OnUpdateControl
        ///
        /// <summary>
        /// Update(object) メソッドを通じてコントロールの内容が更新された
        /// 時に実行されます。
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        protected override void OnUpdateControl(KeyValueCancelEventArgs <Control, object> e)
        {
            var name = e.Key.Name.Replace(e.Key.GetType().Name, string.Empty);

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            switch (name)
            {
            case "AutoSaveTime":
                var control = e.Key as NumericUpDown;
                var value   = e.Value as TimeSpan?;
                if (control == null || !value.HasValue)
                {
                    break;
                }
                control.Value = (int)value.Value.TotalSeconds;
                e.Cancel      = true;
                break;

            case "PrintMargin":
                UpdatePrintMargin(e.Key, e.Value);
                break;

            default:
                break;
            }

            base.OnUpdateControl(e);
        }
Example #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// OnUpdateControl
        ///
        /// <summary>
        /// Update(object) メソッドを通じてコントロールの内容が更新された
        /// 時に実行されます。
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        protected virtual void OnUpdateControl(KeyValueCancelEventArgs <Control, object> e)
        {
            UpdateControl?.Invoke(this, e);
            if (e.Cancel)
            {
                return;
            }

            switch (e.Key.GetType().Name)
            {
            case nameof(Cube.Forms.ColorButton):
                UpdateColorButton(e.Key as Cube.Forms.ColorButton, e.Value as Color?);
                break;

            case nameof(Cube.Forms.FontButton):
                UpdateFontButton(e.Key as Cube.Forms.FontButton, e.Value as Font);
                break;

            case nameof(System.Windows.Forms.CheckBox):
                UpdateCheckBox(e.Key as System.Windows.Forms.CheckBox, e.Value as bool?);
                break;

            case nameof(System.Windows.Forms.ComboBox):
                UpdateComboBox(e.Key as System.Windows.Forms.ComboBox, e.Value as int?);
                break;

            case nameof(System.Windows.Forms.NumericUpDown):
                UpdateNumericUpDown(e.Key as System.Windows.Forms.NumericUpDown, e.Value as int?);
                break;

            case nameof(System.Windows.Forms.RadioButton):
                UpdateRadioButton(e.Key as System.Windows.Forms.RadioButton, e.Value as bool?);
                break;

            case nameof(System.Windows.Forms.TextBox):
                UpdateTextBox(e.Key as System.Windows.Forms.TextBox, e.Value as string);
                break;

            default:
                break;
            }
        }