/// <summary>
        /// Wraps an <see cref="IMacroBoard"/> with an button press effect adapter.
        /// </summary>
        /// <param name="macroBoard">The board that should be wrapped.</param>
        /// <param name="config">The configuration that should be used. Changes to the configuration later also takes effect.</param>
        /// <returns>Returns a new board that implements the button press effect.</returns>
        public static IMacroBoard WithButtonPressEffect(this IMacroBoard macroBoard, ButtonPressEffectConfig config = null)
        {
            if (macroBoard is null)
            {
                throw new ArgumentNullException(nameof(macroBoard));
            }

            return(new ButtonPressEffectAdapter(macroBoard, config));
        }
Exemple #2
0
 /// <summary>
 /// Creates a new instance of <see cref="ButtonPressEffectAdapter"/> with a given configuration.
 /// </summary>
 /// <param name="macroBoard">The board that is wrapped with the button press effect.</param>
 /// <param name="config">The configuration that should be used. If null the default configuration will be used.</param>
 public ButtonPressEffectAdapter(IMacroBoard macroBoard, ButtonPressEffectConfig config)
     : base(macroBoard)
 {
     KeyStateChanged += SoftwareButtonFeature_KeyStateChanged;
     Config           = config ?? new ButtonPressEffectConfig();
 }