Example #1
0
 public GestureSampleVm()
 {
     Gestures       = new ObservableCollection <string>();
     DumpGesture    = new RelayGesture(OnGesture);
     ClearGestures  = new Command(_ => Gestures.Clear());
     ToggleChildren = new Command(_ =>
     {
         ExcludeChildren = !ExcludeChildren;
         if (ExcludeChildren)
         {
             FrameText = "This frame accepts gestures\nThe enclosed Label does not";
             LabelText = "I do nothing";
         }
         else
         {
             FrameText = "This frame accepts gestures\nThe enclodes label does as well.";
             LabelText = "I accept gestures";
         }
     });
 }
        public GestureSampleVM()
        {
            Gestures=new ObservableCollection<string>();
            DumpGesture=new RelayGesture(OnGesture);
            ClearGestures=new Command(_=>Gestures.Clear());
            ToggleChildren=new Command(_ =>
                {
                    ExcludeChildren = !ExcludeChildren;
                    if (ExcludeChildren)
                    {
                        FrameText = "This frame accepts gestures\nThe enclosed Label does not";
                        LabelText = "I do nothing";
                    }
                    else
                    {
                        FrameText = "This frame accepts gestures\nThe enclodes label does as well.";
                        LabelText = "I accept gestures";                        
                    }
                });

        }
Example #3
0
 public BaseHomeViewModel()
 {
     MaidGesture  = new RelayGesture(OnMaidGesture);
     ShowMaidHint = IsShowActions = false;
 }
Example #4
0
        public MainPageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            Title = "T-Shirt Designer";

            Left = new RelayGesture((g, x) =>
            {
                Console.WriteLine("Left ....");
                IsBlackVisible  = !IsBlackVisible;
                IsOrangeVisible = !IsOrangeVisible;
            }
                                    );

            Right = new RelayGesture((g, x) =>
            {
                Console.WriteLine("Right ....");
                IsBlackVisible  = !IsBlackVisible;
                IsOrangeVisible = !IsOrangeVisible;
            }
                                     );


            DoubleTap = new RelayGesture((g, x) => {
                Console.WriteLine("End of MOVEMENT .....");
                IsSunVisible  = false;
                IsTreeVisible = false;
                IsDragStarted = false;
            });
            LongPress = new RelayGesture((g, x) =>
            {
                Console.WriteLine("Long Press ....... {0}", x);
                IsDragStarted = true;

                if (x.ToString() == "SUN")
                {
                    IsSunVisible = true; IsTreeVisible = false;
                }
                if (x.ToString() == "TREE")
                {
                    IsTreeVisible = true; IsSunVisible = false;
                }
            });

            Movement = new RelayGesture((g, x) => {
                if (!isDragStarted)
                {
                    return;
                }
                Console.WriteLine("Movement .... ");
                switch (g.GestureType)
                {
                case XLabs.Forms.Controls.GestureType.Move:
                    var newP = g.Origin2;
                    var p    = g.Origin;

                    //Type t = g.GetType();
                    //PropertyInfo[] props = t.GetProperties();
                    //double verticalDistance = (double)props.First((prop) => prop.Name == "VerticalDistance").GetValue(g);
                    //double horizontalDistance = (double)props.First((prop) => prop.Name == "HorizontalDistance").GetValue(g);


                    var xDelta = /* g.UbkHorizontalDistance(); */ p.X - newP.X;
                    var yDelta = /* g.UbkVerticalDistance(); */ p.Y - newP.Y;
                    Console.WriteLine("  old POINT -> {0}   new POINT -> {1}", p.ToString(), newP.ToString());

                    MarginTopLeft = new Thickness(MarginTopLeft.Left + (xDelta / 8), MarginTopLeft.Top + (yDelta / 8), 0, 0);

                    Console.WriteLine(MarginTopLeft.Top.ToString());

                    break;
                }
            });

            MarginTopLeft = new Thickness(300, 100, 0, 0);

            IsBlackVisible  = true;
            IsOrangeVisible = false;
            IsDragStarted   = false;

            IsSunVisible  = false;
            isTreeVisible = false;
        }