예제 #1
0
 public static void RemoveTapHandler(DependencyObject obj, TouchEventHandler handler)
 {
     if (obj is UIElement ui)
     {
         ui.RemoveHandler(TapEvent, handler);
     }
 }
예제 #2
0
        internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args)
        {
            TouchEventHandler handler_ = (TouchEventHandler)handler;

            if (handler_ != null)
            {
                handler_(Extend.GetProxy(sender, false), new TouchEventArgs(args, false));
            }
        }
        protected virtual void DownButton_TouchDown(TouchEventArgs e)
        {
            TouchEventHandler handler = DownButtonTouchDown;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #4
0
        protected virtual void OnTouchMove(TouchEventArgs e)
        {
            // ISSUE: reference to a compiler-generated field
            TouchEventHandler touchMove = this.TouchMove;

            if (touchMove == null)
            {
                return;
            }
            touchMove((object)this, e);
        }
예제 #5
0
        /// <summary>
        /// [コンストラクタ]
        /// </summary>
        public DrawPanel()
        {
            // ウィンドウをタッチ入力に対応させる
            Win32ApiWrapper.RegisterTouchWindow(this.Handle, 0);

            // ちらつきを防止する
            this.DoubleBuffered = true;

            // 軌道を初期化する
            this.orbit = new List <TouchPoint>(this.Size.Height + this.Size.Width);

            TouchMove += new TouchEventHandler(drowWhenTouchMove);
        }
예제 #6
0
 public VirtualCanvas(TouchEventHandler touchEventHandler, WidgetClickedHandler widgetClickedHandler) {
     TrackOrientation(Orientation.Portrait);
     _spiRxBuffer = new byte[MaxSpiRxBufferSize];
     SendContext = new BasicTypeSerializerContext(MaxSpiTxBufferSize, SpiTxBufferHighWatermark, OnCanvasBufferNearlyFull);
     ReceiveContext = new BasicTypeDeSerializerContext();
     GoBusIrqEvent = new ManualResetEvent(false);
     RegisteredWidgets = new ArrayList();
     if (widgetClickedHandler != null) {
         WidgetClicked += widgetClickedHandler;
     }
     if (touchEventHandler != null) {
         Touch += touchEventHandler;
     }
 }
예제 #7
0
 public VirtualCanvas(TouchEventHandler touchEventHandler, WidgetClickedHandler widgetClickedHandler) {
     TrackOrientation(Orientation.Portrait);
     _spiRxBuffer = new byte[MaxSpiRxBufferSize];
     SendContext = new BasicTypeSerializerContext(MaxSpiTxBufferSize, SpiTxBufferHighWatermark, OnCanvasBufferNearlyFull);
     ReceiveContext = new BasicTypeDeSerializerContext();
     GoBusIrqEvent = new ManualResetEvent(false);
     RegisteredWidgets = new ArrayList();
     if (widgetClickedHandler != null) {
         WidgetClicked += widgetClickedHandler;
     }
     if (touchEventHandler != null) {
         Touch += touchEventHandler;
     }
 }
예제 #8
0
        public void Init()
        {
            onOneTouchBegan = new TouchEventHandler(InitOneBeganHandler);
            onOneTouchMoved = new TouchEventHandler(InitOneMovedHandler);
            onOneTouchEnded = new TouchEventHandler(InitOneEndedHandler);
            onTwoTouchBegan = new TouchEventHandler(InitTwoBeganHandler);
            onTwoTouchMoved = new TouchEventHandler(InitTwoMovedHandler);
            onTwoTouchEnded = new TouchEventHandler(InitTwoEndedHandler);

            touchStartPos = Vector3.zero;
            getOneTouch   = false;
            getTwoTouch   = false;
            instance      = this;
            isInited      = true;
        }
예제 #9
0
        public FlyOut(PointF position, bool removeOnRelease)
        {
            _position = position;
            MouseEventHandler onMouseDown = (sender, args) => Screen?.ClearFlyOut();
            TouchEventHandler onTouchDown = (sender, args) => Screen?.ClearFlyOut();

            if (removeOnRelease)
            {
                MouseUp += onMouseDown;
                TouchUp += onTouchDown;
            }
            else
            {
                MouseDown += onMouseDown;
                TouchDown += onTouchDown;
            }
        }
예제 #10
0
        private void CreateMenuItem(Bitmap bitmap, TouchEventHandler handler,
                                    int iconMarginLeft, string labelContent, int labelMarginLeft)
        {
            var image = new Image(bitmap);

            image.TouchDown += handler;
            canvasMenu.Children.Add(image, 0, iconMarginLeft);

            var label = new Text()
            {
                Font          = Resources.GetFont(Resources.FontResources.NinaB),
                Width         = 120,
                TextAlignment = TextAlignment.Center,
                TextWrap      = true,
                TextContent   = labelContent
            };

            label.TouchDown += handler;
            canvasMenu.Children.Add(label, 54, labelMarginLeft);
        }
예제 #11
0
 private void Awake()
 {
     onClick       = new TouchEventHandler(OnClick);
     onDoubleClick = new TouchEventHandler(OnDoubleClick);
 }
예제 #12
0
 public abstract void AddOnTouchEvent(TouchEventHandler handler);
예제 #13
0
 public abstract void AddOnTouchEvent(TouchEventHandler handler);
예제 #14
0
 public void Subscribe(TouchEventHandler touchListener)
 {
     TouchListener += touchListener;
 }
예제 #15
0
 public void Unsubscribe(TouchEventHandler touchListener)
 {
     TouchListener -= touchListener;
 }
예제 #16
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="rSocketNumber">The mainboard socket that has the display's R socket connected to it.</param>
        /// <param name="gSocketNumber">The mainboard socket that has the display's G socket connected to it.</param>
        /// <param name="bSocketNumber">The mainboard socket that has the display's B socket connected to it.</param>
        /// <param name="i2cSocketNumber">The mainboard socket that has the display's I socket connected to it.</param>
        public DisplayCP7(int rSocketNumber, int gSocketNumber, int bSocketNumber, int i2cSocketNumber)
            : base(WpfMode.PassThrough)
        {
            var config = new DisplayModule.TimingRequirements()
            {
                UsesCommonSyncPin                 = true, //not the proper property, but we needed it for OutputEnableIsFixed
                CommonSyncPinIsActiveHigh         = true, //not the proper property, but we needed it for OutputEnablePolarity
                HorizontalSyncPulseIsActiveHigh   = true,
                VerticalSyncPulseIsActiveHigh     = true,
                PixelDataIsValidOnClockRisingEdge = false,
                HorizontalSyncPulseWidth          = 1,
                HorizontalBackPorch               = 46,
                HorizontalFrontPorch              = 16,
                VerticalSyncPulseWidth            = 1,
                VerticalBackPorch                 = 23,
                VerticalFrontPorch                = 7,
                MaximumClockSpeed                 = 24000,
            };

            base.OnDisplayConnected("Display CP7", 800, 480, DisplayOrientation.Normal, config);

            var rSocket = Socket.GetSocket(rSocketNumber, true, this, null);
            var gSocket = Socket.GetSocket(gSocketNumber, true, this, null);
            var bSocket = Socket.GetSocket(bSocketNumber, true, this, null);

            rSocket.EnsureTypeIsSupported('R', this);
            gSocket.EnsureTypeIsSupported('G', this);
            bSocket.EnsureTypeIsSupported('B', this);

            this.backlightPin = GTI.DigitalOutputFactory.Create(gSocket, Socket.Pin.Nine, true, this);

            rSocket.ReservePin(Socket.Pin.Three, this);
            rSocket.ReservePin(Socket.Pin.Four, this);
            rSocket.ReservePin(Socket.Pin.Five, this);
            rSocket.ReservePin(Socket.Pin.Six, this);
            rSocket.ReservePin(Socket.Pin.Seven, this);
            rSocket.ReservePin(Socket.Pin.Eight, this);
            rSocket.ReservePin(Socket.Pin.Nine, this);

            gSocket.ReservePin(Socket.Pin.Three, this);
            gSocket.ReservePin(Socket.Pin.Four, this);
            gSocket.ReservePin(Socket.Pin.Five, this);
            gSocket.ReservePin(Socket.Pin.Six, this);
            gSocket.ReservePin(Socket.Pin.Seven, this);
            gSocket.ReservePin(Socket.Pin.Eight, this);

            bSocket.ReservePin(Socket.Pin.Three, this);
            bSocket.ReservePin(Socket.Pin.Four, this);
            bSocket.ReservePin(Socket.Pin.Five, this);
            bSocket.ReservePin(Socket.Pin.Six, this);
            bSocket.ReservePin(Socket.Pin.Seven, this);
            bSocket.ReservePin(Socket.Pin.Eight, this);
            bSocket.ReservePin(Socket.Pin.Nine, this);

            if (i2cSocketNumber == Socket.Unused)
            {
                return;
            }

            this.onScreenPressed   = this.OnScreenPressed;
            this.onScreenReleased  = this.OnScreenReleased;
            this.onHomePressed     = this.OnHomePressed;
            this.onMenuPressed     = this.OnMenuPressed;
            this.onBackPressed     = this.OnBackPressed;
            this.onGestureDetected = this.OnGestureDetected;

            Socket i2cSocket = Socket.GetSocket(i2cSocketNumber, true, this, null);

            this.releaseSent               = false;
            this.transactions              = new I2CDevice.I2CTransaction[2];
            this.resultBuffer              = new byte[1];
            this.addressBuffer             = new byte[1];
            this.i2cBus                    = GTI.I2CBusFactory.Create(i2cSocket, 0x38, 400, this);
            this.touchInterrupt            = GTI.InterruptInputFactory.Create(i2cSocket, GT.Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.PullUp, GTI.InterruptMode.RisingAndFallingEdge, this);
            this.touchInterrupt.Interrupt += (a, b) => this.OnTouchEvent();
        }
예제 #17
0
 public override void AddOnTouchEvent(TouchEventHandler handler)
 {
     touchEventHandlers.Add(handler);
 }
예제 #18
0
        /// <summary>
        /// Raises events for both the touch positions and touch gestures
        /// </summary>
        /// <param name="sender">The module that is sending the event</param>
        /// <param name="touchStatus">A class that contains all information about the screen</param>
        protected virtual void OnTouchEvent(DisplayCP7 sender, TouchStatus touchStatus)
        {
            int numberOfFingers = (ReadRegister(0x02) & 0xF);

            if (numberOfFingers == 0)
            {
                if (!bSentReleased)
                {
                    if (this.onScreenReleased == null)
                    {
                        this.onScreenReleased = new TouchEventHandlerTouchReleased(this.onScreenReleased);
                    }

                    if (Program.CheckAndInvoke(ScreenReleased, this.onScreenReleased, this))
                    {
                        this.ScreenReleased(this);
                    }

                    bSentReleased = true;
                }

                return;
            }

            bSentReleased = false;

            int gesture = (ReadRegister(0x01) & 0xFF);

            if (gesture != (int)Gesture_ID.No_Gesture)
            {
                if (this.onGestureDetected == null)
                {
                    this.onGestureDetected = new TouchGestureDetected(this.onGestureDetected);
                }

                if (Program.CheckAndInvoke(GestureDetected, this.onGestureDetected, this, (Gesture_ID)gesture))
                {
                    this.GestureDetected(this, (Gesture_ID)gesture);
                }

                return;
            }
            //Debug.Print("num fingers" + numberOfFingers);

            TouchStatus ts = new TouchStatus();

            ts.numTouches = numberOfFingers;

            for (int i = 0; i < 5; i++)
            {
                if (i < numberOfFingers)
                {
                    int x = ((ReadRegister((byte)(3 + i * 6)) & 0xF) << 8) + ReadRegister((byte)(4 + i * 6));
                    int y = ((ReadRegister((byte)(5 + i * 6)) & 0xF) << 8) + ReadRegister((byte)(6 + i * 6));

                    ts.touchPos[i] = new Finger(x, y, true);

                    //////////////////////////////////////////////////////////////////////
                    // HEY LISTEN
                    // DO THE BUTTON THINGS RIGHT HERE
                    /////////////////////////////////////////////////////////////////////
                    // Check to see if a user has used one of the "Android" buttons
                    if (x > 800)
                    {
                        if (y >= 0 && y <= 50)
                        {
                            // Home
                            if (this.onHomePressed == null)
                            {
                                this.onHomePressed = new TouchEventHandlerHomeButton(this.onHomePressed);
                            }

                            if (Program.CheckAndInvoke(HomePressed, this.onHomePressed, this))
                            {
                                this.HomePressed(this);
                            }
                        }
                        if (y >= 100 && y <= 150)
                        {
                            // Menu
                            if (this.onMenuPressed == null)
                            {
                                this.onMenuPressed = new TouchEventHandlerMenuButton(this.onMenuPressed);
                            }

                            if (Program.CheckAndInvoke(MenuPressed, this.onMenuPressed, this))
                            {
                                this.MenuPressed(this);
                            }
                        }
                        else if (y >= 200 && y <= 250)
                        {
                            // Back
                            if (this.onBackPressed == null)
                            {
                                this.onBackPressed = new TouchEventHandlerBackButton(this.onBackPressed);
                            }

                            if (Program.CheckAndInvoke(BackPressed, this.onBackPressed, this))
                            {
                                this.BackPressed(this);
                            }
                        }
                    }
                }
                else
                {
                    ts.touchPos[i] = new Finger(-1, -1, false);
                }

                //Debug.Print("X: " + x + " Y: " + y);
            }

            if (this.onTouch == null)
            {
                this.onTouch = new TouchEventHandler(this.OnTouchEvent);
            }

            if (Program.CheckAndInvoke(ScreenPressed, this.onTouch, sender, ts))
            {
                this.ScreenPressed(sender, ts);
            }
        }