Esempio n. 1
0
        void Click_TimeOut(object sender, TouchActionEventArgs args, string Mensaje)
        {
            T.Stop(); T_DC.Stop();
            TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact);

            tArgs.Tile = TileView_Seleccionado;

            EventHandler <TileEventArgs> handler = Tile_Click;

            if (handler != null)
            {
                handler(this, tArgs);
            }
            EventStatus = EnumEstadoEvento.Nulo;
        }
Esempio n. 2
0
        void OnTouchEffectAction(object sender, TouchActionEventArgs args)
        {
            EventHandler <TileEventArgs> handler;

            switch (args.Type)
            {
            case TouchActionType.Pressed:
                T.Stop();
                TileView_Seleccionado = (TilesView)this.GetTilesViewByXY(args.Location.X, args.Location.Y);
                if (TileView_Seleccionado != null)
                {
                    T = new Timer(TimeSpan.FromSeconds(3), () => ClickLento_TimeOut(sender, args, "TOut "));
                    T.Start();

                    /* Esta parte genera el eveno MoveFrom */
                    TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact);
                    tArgs.Tile = TileView_Seleccionado;


                    if (EventStatus != EnumEstadoEvento.Click)
                    {
                        handler = Tile_MoveFrom;
                        if (handler != null)
                        {
                            EventStatus = EnumEstadoEvento.MoveFrom;
                            handler(this, tArgs);
                        }
                    }
                    else
                    {
                        EventStatus = EnumEstadoEvento.DobleClick;
                    }
                }

                break;

            case TouchActionType.Moved:
                if (TileView_Seleccionado != null)
                {
                    TilesView cuadro_Actual = this.GetTilesViewByXY(args.Location.X, args.Location.Y);

                    if ((cuadro_Actual.Col != -1) || (cuadro_Actual.Row != -1))
                    {
                        if ((!TileView_Seleccionado.MismaUbicacion(cuadro_Actual)) && ((EventStatus == EnumEstadoEvento.MoveTo) || (EventStatus == EnumEstadoEvento.MoveFrom)))
                        {
                            T.Stop();
                            TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact);
                            tArgs.Tile       = TileView_Seleccionado;
                            tArgs.MovioA_Col = cuadro_Actual.Col;
                            tArgs.MovioA_Row = cuadro_Actual.Row;

                            TileView_Seleccionado = cuadro_Actual;
                            EventStatus           = EnumEstadoEvento.MoveTo;

                            handler = Tile_MoveTo;
                            if (handler != null)
                            {
                                handler(this, tArgs);
                            }
                        }
                    }
                }

                break;

            case TouchActionType.Released:
                if (TileView_Seleccionado != null)
                {
                    T.Stop(); T_DC.Stop();

                    if (EventStatus == EnumEstadoEvento.MoveFrom)
                    {
                        T_DC = new Timer(TimeSpan.FromSeconds(1), () => Click_TimeOut(sender, args, "TOut "));
                        T_DC.Start();
                        EventStatus = EnumEstadoEvento.Click;
                    }

                    if (EventStatus == EnumEstadoEvento.DobleClick)
                    {
                        handler = Tile_DobleClick;
                        if (handler != null)
                        {
                            TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact);
                            tArgs.Tile = TileView_Seleccionado;

                            EventStatus = EnumEstadoEvento.Nulo;
                            handler(this, tArgs);
                        }
                    }

                    if (EventStatus == EnumEstadoEvento.MoveTo)
                    {
                        TileView_Seleccionado = null;
                        EventStatus           = EnumEstadoEvento.Nulo;
                    }
                }

                break;
            }
        }