Esempio n. 1
0
        /// <summary>
        /// Prevents a default instance of the <see cref="Touchpad" /> class from being created.
        /// </summary>
        private Touchpad()
            : base(TargetDisplay.Widget, Constants.TouchpadHeight, Constants.TouchpadWidth)
        {
            _log = LogManager.GetLogger(this);
            _log.Info("Setting disabled image");
            _log.Debug("Setting gesture callback");
            _gestureCallback = HandleTouchpadGesture;
            var result = NativeMethods.RzSBGestureSetCallback(_gestureCallback);

            if (HRESULT.RZSB_FAILED(result))
            {
                throw new NativeCallException("RzSBGestureSetCallback", result);
            }

            _log.Debug("Creating blank bitmap");
            _blankBitmap = GenericMethods.GetBlankBitmap(DisplayWidth, DisplayHeight);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicKey" /> class.
        /// </summary>
        /// <param name="keyType">The type of dynamic key being initialized.</param>
        /// <param name="image">Image to set for this key's depressed state.</param>
        /// <param name="pressedImage">Image to set for this key's pressed state.</param>
        /// <param name="callback">The function to call when this key is released.</param>
        internal DynamicKey(
            DynamicKeyType keyType,
            string image        = null,
            string pressedImage = null,
            EventHandler <DynamicKeyEventArgs> callback = null)
            : base(TargetDisplayMapping[keyType], Constants.DynamicKeyHeight, Constants.DynamicKeyWidth)
        {
            _log = LogManager.GetLogger(this);

            if (string.IsNullOrEmpty(pressedImage))
            {
                _log.Debug("pressedImage is null, setting to value of image");
                pressedImage = image;
            }

            _log.Debug("Setting default states");
            State         = DynamicKeyState.None;
            PreviousState = DynamicKeyState.None;
            KeyType       = keyType;

            _log.Debug("Creating blank bitmap");
            _blankBitmap = GenericMethods.GetBlankBitmap(DisplayWidth, DisplayHeight);

            _log.Debug("Setting images");
            if (image != null)
            {
                Draw(image, pressedImage);
            }

            if (callback != null)
            {
                _log.Debug("Setting callback");
                Released += callback;
            }

            _enabled = true;
        }