예제 #1
0
        private async void OnFlick(object sender, ManipulationCompletedEventArgs e)
        {
            Point  transformedVelocity = GestureHelper.GetTransformNoTranslation(transform).Transform(e.FinalVelocities.LinearVelocity);
            double horizontalVelocity  = transformedVelocity.X;
            double verticalVelocity    = transformedVelocity.Y;

            var direction = GestureHelper.GetDirection(horizontalVelocity, verticalVelocity);

            if (direction == System.Windows.Controls.Orientation.Horizontal)
            {
                _pageNumber = 0;
                _viewModel.ItemViewModels.Clear();

                if (horizontalVelocity < 0)
                {
                    LoadNextCategory();
                }
                else
                {
                    LoadPreviousCategory();
                }

                _catIdFromQS = _feedManager.GetCategories()[_currentIndex].Id;
                UserBehaviorManager.Instance.Log(UserAction.CatEnter, _catIdFromQS.ToString());
                await BindingContent();

                BindingNavBar();

                _lastItemId = string.Empty;
                _feedManager.SetLastId <string>(string.Empty);
            }
        }
예제 #2
0
        /// <summary>
        /// Create Helpers to manage the streams from the Kinect Sensor
        /// </summary>
        public void CreateHelpers()
        {
            LogHelper.logInput("Create Helpers", LogHelper.logType.INFO, "Manager");

            ////
            //   Kinect
            ////
            kinectMgr = QlikMove.Kinect.KinectHelper.Instance;

            ////
            //  Gesture Helper
            ////
            GestureMgr = GestureHelper.Instance;
            //add the callback method when an event is triggered
            GestureMgr.EventRecognised += new EventHandler <QlikMove.StandardHelper.EventArguments.QlikMoveEventArgs>(this.Event_EventRecognised);


            ////
            //  AudioStream
            ////
            VoiceMgr = VoiceHelper.Instance;


            ////
            //  Launch the ActionRecogniser with its method
            ////
            ActionMgr = ActionHelper.Instance;
        }
예제 #3
0
        protected virtual string GetItemToolTip(ICommand command, FrameworkElement source, string applicationName)
        {
            string CommandText = DocumentHelper.GetToolTipText(command, source);
            string GestureText = GestureHelper.GetGestureText(command, source);

            if (CommandText.Contains(LocalizedRoutedCommand.ApplicationNamePattern) && applicationName != null)
            {
                CommandText = CommandText.Replace(LocalizedRoutedCommand.ApplicationNamePattern, applicationName);
            }

            string ItemToolTip;

            if (CommandText != null)
            {
                if (GestureText != null)
                {
                    ItemToolTip = CommandText + " " + "(" + GestureText + ")";
                }
                else
                {
                    ItemToolTip = CommandText;
                }
            }
            else
            {
                ItemToolTip = null;
            }

            return(ItemToolTip);
        }
예제 #4
0
        private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            GesturesService = GesturesServiceEndpointFactory.Create();
            GesturesService.StatusChanged    += GesturesService_StatusChanged;
            GesturesService.WarningLog       += GesturesService_WarningLog;
            GesturesService.ConnectionClosed += GesturesService_ConnectionClosed;

            GesturesCombo.ItemsSource = GestureHelper.Gestures().OrderBy(g => g.Name);

            if (!await GesturesService.ConnectAsync())
            {
                MessageBox.Show("Errore durante la connessione al Gesture Service!");
            }
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the StartView class.
        /// </summary>
        public StartView()
        {
            DefaultStyleKey = typeof(StartView);

            GestureHelper gestureHelper = GestureHelper.Create(this, true);

            gestureHelper.GestureStart   += (sender, args) => GestureStart();
            gestureHelper.HorizontalDrag += (sender, args) => HorizontalDrag(args);
            gestureHelper.Flick          += (sender, args) => Flick(args);
            gestureHelper.GestureEnd     += (sender, args) => GestureEnd();

            SizeChanged += OnSizeChanged;

            Loaded   += OnLoaded;
            Unloaded += OnUnloaded;

            _isDesignTime = DesignerProperties.IsInDesignTool;
        }
예제 #6
0
 private void Init(IAttributeSet attrs)
 {
     scrollVelocity = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip,
                                                     DEFAULT_SCROLL_VELOCITY_DP, Context.Resources.DisplayMetrics);
     touchScrollable = true;
     if (null != attrs)
     {
         TypedArray ta = Context.ObtainStyledAttributes(attrs, Resource.Styleable.DragLayout);
         overScroll     = ta.GetInt(Resource.Styleable.DragLayout_overScroll, OVER_SCROLL_ALL);
         scrollVelocity = ta.GetDimensionPixelSize(
             Resource.Styleable.DragLayout_scrollVelocity, scrollVelocity);
         maxScrollTime   = ta.GetInt(Resource.Styleable.DragLayout_maxScrollTime, 0);
         touchScrollable = ta.GetBoolean(Resource.Styleable.DragLayout_touchScrollable, touchScrollable);
         ta.Recycle();
     }
     gestureHelper   = GestureHelper.CreateDefault(Context);
     layerScroller   = new Scroller(Context);
     velocityTracker = VelocityTracker.Obtain();
     ViewTreeObserver.AddOnGlobalLayoutListener(new DragLayoutListener(this));
 }
예제 #7
0
        private void OnFlick(object sender, ManipulationCompletedEventArgs e)
        {
            if (_itemContainer.AllItemViewModels.Count == 1)
            {
                return;
            }

            Point  transformedVelocity = GestureHelper.GetTransformNoTranslation(transform).Transform(e.FinalVelocities.LinearVelocity);
            double horizontalVelocity  = transformedVelocity.X;
            double verticalVelocity    = transformedVelocity.Y;

            var direction = GestureHelper.GetDirection(horizontalVelocity, verticalVelocity);

            if (direction == System.Windows.Controls.Orientation.Horizontal)
            {
                if (horizontalVelocity < 0)
                {
                    LoadNextItem();
                }
                else
                {
                    LoadPreviousItem();
                }

                var item = _itemContainer.AllItemViewModels[_currentIndex];
                UserBehaviorManager.Instance.Log(UserAction.ItemEnter, item.FeedId.ToString());
            }

            //if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
            //{
            //    if (e.HorizontalVelocity < 0)
            //        LoadNextItem();
            //    else
            //        LoadPreviousItem();

            //    var item = _itemContainer.AllItemViewModels[_currentIndex];
            //    UserBehaviorManager.Instance.Log(UserAction.ItemClick, item.FeedId.ToString());
            //}
        }
예제 #8
0
    protected void NotifyUp(InputCompletedArgs args)
    {
        EventArgs e = EventArgs.Empty;

        _dragLock = DragLock.Unset;
        _dragging = false;

        if (args.IsInertial)
        {
            double angle = GestureHelper.AngleFromVector(args.FinalLinearVelocity.X, args.FinalLinearVelocity.Y);
            if (angle <= 45 || angle >= 315)
            {
                angle = 0;
            }
            else if (angle >= 135 && angle <= 225)
            {
                angle = 180;
            }

            FlickEventArgs flickEventArgs = new FlickEventArgs
            {
                Angle = angle
            };
            ReleaseMouseCaptureAtGestureOrigin();
            RaiseFlick(flickEventArgs);
        }
        else if (args.TotalTranslation.X != 0 || args.TotalTranslation.Y != 0)
        {
            DragEventArgs dragEventArgs = new DragEventArgs
            {
                CumulativeDistance = args.TotalTranslation
            };
            dragEventArgs.MarkAsFinalTouchManipulation();
            e = dragEventArgs;
        }

        RaiseGestureEnd(e);
    }
예제 #9
0
    protected void NotifyMove(InputDeltaArgs args)
    {
        if (Math.Abs(args.CumulativeTranslation.X) > DeadZoneInPixels.Width || Math.Abs(args.CumulativeTranslation.Y) > DeadZoneInPixels.Height)
        {
            if (!_dragging)
            {
                ReleaseMouseCaptureAtGestureOrigin();
            }

            _dragging = true;

            if (_dragLock == DragLock.Unset)
            {
                double angle = GestureHelper.AngleFromVector(args.CumulativeTranslation.X, args.CumulativeTranslation.Y) % 180;
                _dragLock = angle <= 45 || angle >= 135 ? DragLock.Horizontal : DragLock.Vertical;
            }
        }

        if (_dragging)
        {
            RaiseDragEvents(args);
        }
    }
예제 #10
0
 public static GestureHelper Create(UIElement target)
 {
     return(GestureHelper.Create(target, true));
 }
예제 #11
0
        /// <summary>
        /// Gets the gesture text of a command for a source element.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="source">The source element.</param>
        /// <returns>The gesture text.</returns>
        protected virtual string GetItemGestureText(ICommand command, FrameworkElement source)
        {
            string GestureText = GestureHelper.GetGestureText(command, source);

            return(GestureText);
        }