Пример #1
0
        private InputManager()
        {
            _stagingArea = new Stack();
            InputDeviceEvents = new DeviceEvents[(int)InputDeviceType.Last];

            for (int i = 0; i < (int)InputDeviceType.Last; i++)
            {
                InputDeviceEvents[i] = new DeviceEvents();
            }

            _continueProcessingStagingAreaCallback = new DispatcherOperationCallback(ProcessStagingArea);
            _buttonDevice = new ButtonDevice(this);
            _touchDevice = new TouchDevice(this);
            _genericDevice = new GenericDevice(this);
        }
Пример #2
0
        private InputManager()
        {
            _stagingArea      = new Stack();
            InputDeviceEvents = new DeviceEvents[(int)InputDeviceType.Last];

            for (int i = 0; i < (int)InputDeviceType.Last; i++)
            {
                InputDeviceEvents[i] = new DeviceEvents();
            }

            _continueProcessingStagingAreaCallback = new DispatcherOperationCallback(ProcessStagingArea);
            _buttonDevice  = new ButtonDevice(this);
            _touchDevice   = new TouchDevice(this);
            _genericDevice = new GenericDevice(this);
        }
Пример #3
0
            /// <summary>
            /// Constructs a ButtonPad that handles the emulated hardware's 
            /// button interrupts.
            /// </summary>
            /// <param name="sink"></param>
            /// <param name="button"></param>
            /// <param name="pin"></param>
            public ButtonPad(GPIOButtonInputProvider sink, Button button, 
                Cpu.Pin pin)
            {
                this.sink = sink;
                this.button = button;
#if !MF_FRAMEWORK_VERSION_V3_0
                this.buttonDevice = InputManager.CurrentInputManager.ButtonDevice;
#endif

                if (pin != Cpu.Pin.GPIO_NONE)
                {
                    // When this GPIO pin is true, call the Interrupt method.
                    port = new InterruptPort(pin, true,
                        Port.ResistorMode.PullUp,
                        Port.InterruptMode.InterruptEdgeBoth);
                    port.OnInterrupt += new NativeEventHandler(this.Interrupt);
                }
            }
            /// <summary>
            /// Constructs the ButtonPad object and sets the ButtonPad class to 
            /// handle the emulated hardware's button interrupts.
            /// </summary>
            /// <param name="sink"></param>
            /// <param name="button"></param>
            /// <param name="pin"></param>
            public ButtonPad(GPIOButtonInputProvider sink, Button button,
                Cpu.Pin pin)
            {
                this.sink = sink;
                this.button = button;
                this.buttonDevice = InputManager.CurrentInputManager.ButtonDevice;

                // When this GPIO pin is true, call the Interrupt method.
                port = new InterruptPort(pin, true, Port.ResistorMode.PullUp,
                    Port.InterruptMode.InterruptEdgeBoth);
                port.OnInterrupt += new NativeEventHandler(this.Interrupt);
            }
 /// <summary>
 ///     Constructs an instance of the ButtonEventArgs class.
 /// </summary>
 /// <param name="buttonDevice">
 ///     The button device associated with this event.
 /// </param>
 /// <param name="timestamp">
 ///     The time when the input occured. (machine time)
 /// </param>
 /// <param name="button">
 ///     The button referenced by the event.
 /// </param>
 public ButtonEventArgs(ButtonDevice buttonDevice, PresentationSource inputSource, DateTime timestamp, Button button)
     : base(buttonDevice, timestamp)
 {
     InputSource = inputSource;
     Button      = button;
 }
 /// <summary>
 ///     Constructs an instance of the FocusChangedEventArgs class.
 /// </summary>
 /// <param name="button">
 ///     The logical button device associated with this event.
 /// </param>
 /// <param name="timestamp">
 ///     The time when the input occured.
 /// </param>
 /// <param name="oldFocus">
 ///     The element that previously had focus.
 /// </param>
 /// <param name="newFocus">
 ///     The element that now has focus.
 /// </param>
 public FocusChangedEventArgs(ButtonDevice buttonDevice, DateTime timestamp, UIElement oldFocus, UIElement newFocus)
     : base(buttonDevice, timestamp)
 {
     OldFocus = oldFocus;
     NewFocus = newFocus;
 }
Пример #7
0
 /// <summary>
 ///     Constructs an instance of the ButtonEventArgs class.
 /// </summary>
 /// <param name="buttonDevice">
 ///     The button device associated with this event.
 /// </param>
 /// <param name="timestamp">
 ///     The time when the input occured. (machine time)
 /// </param>
 /// <param name="button">
 ///     The button referenced by the event.
 /// </param>
 public ButtonEventArgs(ButtonDevice buttonDevice, PresentationSource inputSource, DateTime timestamp, Button button)
     : base(buttonDevice, timestamp)
 {
     InputSource = inputSource;
     Button = button;
 }
 /// <summary>
 ///     Constructs an instance of the FocusChangedEventArgs class.
 /// </summary>
 /// <param name="button">
 ///     The logical button device associated with this event.
 /// </param>
 /// <param name="timestamp">
 ///     The time when the input occured.
 /// </param>
 /// <param name="oldFocus">
 ///     The element that previously had focus.
 /// </param>
 /// <param name="newFocus">
 ///     The element that now has focus.
 /// </param>
 public FocusChangedEventArgs(ButtonDevice buttonDevice, DateTime timestamp, UIElement oldFocus, UIElement newFocus)
     : base(buttonDevice, timestamp)
 {
     OldFocus = oldFocus;
     NewFocus = newFocus;
 }