コード例 #1
0
ファイル: Program.cs プロジェクト: ucuc/StaMa
        public static void Main()
        {
            Program myApplication = new Program();

            myApplication.CreateUI();

            myApplication.InitStateMachine();

            try
            {
                GPIOButtonInputProvider inputProvider = new GPIOButtonInputProvider(null);
            }
            catch (Exception ex)
            {
                Debug.Print(String.Concat("Buttons not available.", ex.Message));
            }

            try
            {
                TouchSimulatedButtonInputProvider touchInputProvider = new TouchSimulatedButtonInputProvider(null);
                touchInputProvider.ButtonUp += myApplication.MainWindow_ButtonUp;
            }
            catch (Exception ex)
            {
                Debug.Print(String.Concat("Touch not available.", ex.Message));
            }

            myApplication.Run(myApplication.mainWindow);
        }
コード例 #2
0
ファイル: GPIOButtonInputProvider.cs プロジェクト: ucuc/StaMa
            /// <summary>
            /// Constructs a ButtonPad object 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

                /// Do not set an InterruptPort with GPIO_NONE.
                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);
                }
            }