Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyStyleForm" /> class.
        /// </summary>
        /// <param name="initialStyle">The initial style.</param>
        /// <param name="defaultStyle">The default style to revert to when the override checkbox is unchecked.</param>
        public KeyStyleForm(KeyStyle initialStyle, KeyStyle defaultStyle)
        {
            if (defaultStyle == null) throw new ArgumentNullException(nameof(defaultStyle));
            if (defaultStyle.Loose == null) throw new ArgumentNullException(nameof(defaultStyle));
            if (defaultStyle.Pressed == null) throw new ArgumentNullException(nameof(defaultStyle));

            this.initialStyle = initialStyle ?? new KeyStyle
            {
                Loose = null,
                Pressed = null
            };
            this.defaultStyle = defaultStyle;
            this.currentStyle = (KeyStyle)this.initialStyle.Clone();
            this.InitializeComponent();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyStyleForm" /> class.
        /// </summary>
        /// <param name="initialStyle">The initial style.</param>
        /// <param name="defaultStyle">The default style to revert to when the override checkbox is unchecked.</param>
        public KeyStyleForm(KeyStyle initialStyle, KeyStyle defaultStyle)
        {
            if (defaultStyle == null)
            {
                throw new ArgumentNullException(nameof(defaultStyle));
            }
            if (defaultStyle.Loose == null)
            {
                throw new ArgumentNullException(nameof(defaultStyle));
            }
            if (defaultStyle.Pressed == null)
            {
                throw new ArgumentNullException(nameof(defaultStyle));
            }

            this.initialStyle = initialStyle ?? new KeyStyle
            {
                Loose   = null,
                Pressed = null
            };
            this.defaultStyle = defaultStyle;
            this.currentStyle = (KeyStyle)this.initialStyle.Clone();
            this.InitializeComponent();
        }