コード例 #1
0
 private void SelectionChosen(object sender, HandInputEventArgs e)
 {
     sw.Stop();
     recTimes[i] = sw.Elapsed;
     //Selection.Visibility = System.Windows.Visibility.Collapsed;
     //Correct.Visibility = System.Windows.Visibility.Visible;
     //System.Threading.Thread.Sleep(3000);
     //Correct.Visibility = System.Windows.Visibility.Collapsed;
     i = i + 1;
     if (i == amount)
     {
         i = 0;
         Selection.Visibility = System.Windows.Visibility.Collapsed;
         ActivityCompleted();
     }
     else if (i < amount)
     {
         x = nodelist[i].pixel_x;
         y = nodelist[i].pixel_y;
         Selection.Margin = new Thickness(x, y, 1920 - x - 100, 1080 - y - 100);
         //Selection.Visibility = System.Windows.Visibility.Visible;
         sw = Stopwatch.StartNew();
         //Correct.Margin = new Thickness(x, y, 1920 - x - 100, 1080 - y - 100);
     }
 }
コード例 #2
0
 private void HomeButtonHoverClick(object sender, HandInputEventArgs e)
 {
     this.Story = null;
     var categorySelection = Utility.FindParent<CategorySelectionControl>(this);
     if (categorySelection != null)
     {
         categorySelection.SelectedCategory = null;
         ((MainWindow)Application.Current.MainWindow).SetVoiceInstruction(Settings.Default.SelectCategoryVui, Settings.Default.VuiDisplayDelay);
     }
 }
コード例 #3
0
 private void OnPreviewHandLeaveDown(object sender, HandInputEventArgs args)
 {
     // stop scrolling left
     this.DownScrollRegion.Background = Application.Current.Resources["InactiveScrollRegionBrush"] as Brush;
     this.scrollTimer.Stop();
     ContentScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
 }
 /// <summary>
 /// 兴盛按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void XingButton_HoverClick(object sender, HandInputEventArgs e)
 {
     this.CategoryContent1.AnimateIn(3, TimeSpan.FromSeconds(0.5));
 }
コード例 #5
0
 private void OnHandRaised(object sender, HandInputEventArgs args)
 {
     this.IsHandRaised = true;
     KinectController.RemoveHandRaisedHandler(this, this.OnHandRaised);
 }
 private void StoryButtonClick(object sender, HandInputEventArgs e)
 {
 }
 private void Next4ButtonClick(object sender, HandInputEventArgs e)
 {
     this.AnimateIn(5, TimeSpan.FromSeconds(0.5));
 }
コード例 #8
0
 private void PlayPauseButton_HoverClick(object sender, HandInputEventArgs e)
 {
     this.IsPlaying = !this.IsPlaying;
 }
コード例 #9
0
 private void ExitActivity(object sender, HandInputEventArgs e)
 {
     MainWindow.next = 1;
     this.Visibility = System.Windows.Visibility.Collapsed;
 }
コード例 #10
0
 private void ThumbDownClick(object sender, HandInputEventArgs e)
 {
     this.Story.Rating.Dislikes += 1;
 }
コード例 #11
0
 private void HomeButton_HoverClick(object sender, HandInputEventArgs e)
 {
     this.Category = null;
     ((MainWindow)Application.Current.MainWindow).SetVoiceInstruction(Settings.Default.SelectCategoryVui, Settings.Default.VuiDisplayDelay);
 }
コード例 #12
0
 private void BackButtonHoverClick(object sender, HandInputEventArgs e)
 {
     this.Story = null;
 }
コード例 #13
0
 private void StartButtonHoverClick(object sender, HandInputEventArgs e)
 {
     this.ShowCategorySelection();
 }
コード例 #14
0
 private void OnHandRaised(object sender, HandInputEventArgs args)
 {
     this.IsHandRaised = true;
     KinectController.RemoveHandRaisedHandler(this, this.OnHandRaised);
 }
コード例 #15
0
 private void BackHomeButtonClick(object sender, HandInputEventArgs e)
 {
     mediaElement.Stop();
     mediaElement.Source = null;
     this.ShowIntro();
 }
コード例 #16
0
 private void BackHomeButtonClick(object sender, HandInputEventArgs e)
 {
     this.ShowIntro();
     videoPlayer.IsPlaying = false;
     videoPlayer.Source    = null;
 }
コード例 #17
0
 private void OnPreviewHandLeave(object sender, HandInputEventArgs args)
 {
     if (Application.Current != null
         && Application.Current.MainWindow != null)
     {
         IInputElement result = Application.Current.MainWindow.InputHitTest(new Point(args.Hand.X, args.Hand.Y));
         var parent = Utility.FindParent<HoverDwellButton>(result);
         if (parent != this)
         {
             this.RemoveHand(args.Hand);
             args.Handled = true;
         }
     }
 }
コード例 #18
0
 private void BackHomeButtonClick(object sender, HandInputEventArgs e)
 {
     this.ShowIntro();
 }
コード例 #19
0
        /// <summary>
        /// 当骨骼点升级之后引发ActiveHand的X,Y发生变化.
        /// 并且判断当前使用者使用的的是左手还是右手
        /// </summary>
        /// <param name="skeleton"></param>
        private void SkeletonUpdated(Skeleton skeleton)
        {
            if (this.ActiveHand == null)
            {
                this.ActiveHand = new HandPosition();
            }

            int   leftX, leftY, rightX, rightY;
            Joint leftHandJoint       = skeleton.Joints[JointType.HandLeft];
            Joint rightHandJoint      = skeleton.Joints[JointType.HandRight];
            Joint hipCenterJoint      = skeleton.Joints[JointType.HipCenter];
            Joint shoulderCenterJoint = skeleton.Joints[JointType.ShoulderCenter];
            float leftZ  = leftHandJoint.Position.Z;
            float rightZ = rightHandJoint.Position.Z;

            ScaleXY(skeleton.Joints[JointType.ShoulderCenter], false, leftHandJoint, out leftX, out leftY);
            ScaleXY(skeleton.Joints[JointType.ShoulderCenter], true, rightHandJoint, out rightX, out rightY);
            if (leftHandJoint.TrackingState == JointTrackingState.Tracked && leftZ < rightZ && leftY < SystemParameters.PrimaryScreenHeight)
            {
                this.ActiveHand.IsLeft = true;
                this.ActiveHand.X      = leftX;
                this.ActiveHand.Y      = leftY;
                this.HitTestHand(this.ActiveHand);
            }
            else if (rightHandJoint.TrackingState == JointTrackingState.Tracked && rightY < SystemParameters.PrimaryScreenHeight)
            {
                this.ActiveHand.IsLeft = false;
                this.ActiveHand.X      = rightX;
                this.ActiveHand.Y      = rightY;
                this.HitTestHand(this.ActiveHand);
            }
            else
            {
                //如果在空气鼠标上有元素交互,那么应当在停止交互后再将空气鼠标设置为null
                if (this.activeHand != null && this.activeHand.CurrentElement != null)
                {
                    this.ActiveHand.X = -1;
                    this.ActiveHand.Y = -1;
                    HandInputEventArgs args = new HandInputEventArgs(HandLeaveEvent, this.ActiveHand.CurrentElement, this.ActiveHand);
                    this.activeHand.CurrentElement.RaiseEvent(args);
                    this.activeHand.CurrentElement = null;
                }

                this.ActiveHand = null;
            }

            if (this.ActiveHand == null)
            {
                return;
            }

            if (this.ActiveHand.CurrentElement != null)
            {
                if (ScaleY(skeleton.Joints[JointType.ElbowLeft]) > ScaleY(skeleton.Joints[JointType.HandLeft]) ||
                    ScaleY(skeleton.Joints[JointType.ElbowRight]) > ScaleY(skeleton.Joints[JointType.HandRight]))
                {
                    HandInputEventArgs args = new HandInputEventArgs(HandRaisedEvent, this.ActiveHand.CurrentElement, this.ActiveHand);
                    this.ActiveHand.CurrentElement.RaiseEvent(args);
                }
            }
        }
コード例 #20
0
 private void OnVuiPreviewHandEnter(object sender, HandInputEventArgs e)
 {
     if (string.IsNullOrEmpty(this.VUI.Text))
     {
         if (this.IntroScreen.Visibility == Visibility.Visible)
         {
             this.SetVoiceInstruction(Settings.Default.StartVui, 0);
         }
         else if (this.CategorySelection.SelectedCategory == null)
         {
             this.SetVoiceInstruction(Settings.Default.SelectCategoryVui, 0);
         }
         else if (this.CategorySelection.CategoryContent.SelectedItem == null)
         {
             this.SetVoiceInstruction(Settings.Default.SelectStoryVui, 0);
         }
         else
         {
             this.SetVoiceInstruction(Settings.Default.ReadStoryVui, 0);
         }
     }
 }
 private void BackAllButtonClick(object sender, HandInputEventArgs e)
 {
     this.AnimateOut(TimeSpan.FromSeconds(0.5));
 }
コード例 #22
0
 private void StoryButtonClick(object sender, HandInputEventArgs e)
 {
     var currentItem = ((FrameworkElement)sender).DataContext as ContentItem;
     if (null != currentItem)
     {
         this.SelectedItem = currentItem;
     }
 }
 private void HomeButton_HoverClick(object sender, HandInputEventArgs e)
 {
 }
コード例 #24
0
 private void SubcategoryClick(object sender, HandInputEventArgs e)
 {
     var btn = sender as HoverDwellButton;
     if (null != btn)
     {
         var subcategory = btn.DataContext as string;
         if (null != subcategory)
         {
             this.Subcategory = subcategory;
             this.ContentScrollViewer.ScrollToLeftEnd();
         }
     }
 }
コード例 #25
0
 /// <summary>
 /// 第二个二级界面的按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void JuButtonHoverClick(object sender, HandInputEventArgs e)
 {
     this.ShowCategorySelection2();
 }
コード例 #26
0
 private void HomeButton_HoverClick(object sender, HandInputEventArgs e)
 {
     this.Category = null;
     ((MainWindow)Application.Current.MainWindow).SetVoiceInstruction(Settings.Default.SelectCategoryVui, Settings.Default.VuiDisplayDelay);
 }
コード例 #27
0
 private void OnPreviewHandEnterDown(object sender, HandInputEventArgs args)
 {
     // start scrolling left
     this.DownScrollRegion.Background = Application.Current.Resources["ActiveScrollRegionBrush"] as Brush;
     this.scrollingOffset = this.ContentScrollViewer.VerticalOffset;
     this.scrollingUp = false;
     this.scrollTimer.Start();
     ContentScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
 }
コード例 #28
0
        public void InvokeHoverClick(HandPosition hand)
        {
            if (hand != null)
            {
                hand.IsInteracting = false;

                HandHoverTimer timer = this.trackedHandHovers.FirstOrDefault(h => h.Hand.Equals(hand));
                if (timer != null)
                {
                    timer.Stop();
                    this.trackedHandHovers.Remove(timer);
                }
            }

            this.IsSelected = true;

            if (this.soundPlayerOnClick != null)
            {
                this.soundPlayerOnClick.Play();
            }

            var t = new DispatcherTimer();
            t.Interval = TimeSpan.FromSeconds(0.6);

            t.Tick += (o, s) =>
                          {
                              t.Stop();
                              var clickArgs = new HandInputEventArgs(HoverClickEvent, this, hand);
                              this.RaiseEvent(clickArgs);
                              this.IsSelected = false;
                          };
            t.Start();
        }
コード例 #29
0
 private void BackButtonHoverClick(object sender, HandInputEventArgs e)
 {
     this.Story = null;
 }
コード例 #30
0
        private void OnPreviewHandEnter(object sender, HandInputEventArgs args)
        {
            if (this.trackedHandHovers.FirstOrDefault(t => t.Hand.Equals(args.Hand)) == null)
            {
                this.IsHoveredOver = true;
                if (this.SoundOnEnter.Length > 0)
                {
                    if (this.soundPlayerOnEnter == null)
                    {
                        Assembly a = Assembly.GetExecutingAssembly();

                        Stream s = a.GetManifestResourceStream("Microsoft.Samples.Kinect.BasicInteractions.Resources.Sounds." + this.SoundOnEnter);

                        this.soundPlayerOnEnter = new SoundPlayer(s);
                    }

                    this.soundPlayerOnEnter.Play();
                }

                args.Hand.IsInteracting = true;
                if (this.Magnetic)
                {
                    // set the X and Y of the hand so it is centered over the button
                    var element = this.Content as FrameworkElement;

                    if (element != null)
                    {
                        var pt = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
                        Point lockedPoint = element.PointToScreen(pt);
                        args.Hand.X = (int)lockedPoint.X;
                        args.Hand.Y = (int)lockedPoint.Y;
                    }

                    args.Hand.Magnetized = true;
                }

                var timer = new HandHoverTimer(DispatcherPriority.Normal, this.Dispatcher);
                timer.Hand = args.Hand;

                timer.Interval = TimeSpan.FromMilliseconds(Settings.Default.SelectionTime);
                timer.Tick += (o, s) => { this.InvokeHoverClick(args.Hand); };
                this.trackedHandHovers.Add(timer);
                timer.Start();
            }

            args.Handled = true;
        }
コード例 #31
0
 private void ThumbDownClick(object sender, HandInputEventArgs e)
 {
     this.Story.Rating.Dislikes += 1;
 }
コード例 #32
0
 private void PlayPauseButton_HoverClick(object sender, HandInputEventArgs e)
 {
     this.IsPlaying = !this.IsPlaying;
 }