コード例 #1
0
 private void buttonRemove_Click(object sender, RoutedEventArgs e)
 {
     if (listAction.SelectedIndex < 0)
     {
         return;
     }
     ActionCollection.RemoveAction(listAction.SelectedIndex);
     ActionCollection.SaveData();
 }
コード例 #2
0
 private void pageRoot_Loaded(object sender, RoutedEventArgs e)
 {
     AlarmCollection.loadData();
     ActionCollection.LoadData();
 }
コード例 #3
0
        private void Page_Loaded_1(object sender, RoutedEventArgs e)
        {
            if (ActionCollection.ActionList.Count == 0)
            {
                ActionCollection.LoadData();
            }

            patterns = new List <Kinect.Joint []> ();
            if (ActionCollection.ActionList.Count > 0)
            {
                Random rand = new Random();
                for (int i = 0; i < 3; i++)
                {
                    patterns.Add(ActionCollection.ActionList [rand.Next(0,
                                                                        ActionCollection.ActionList.Count)]);
                }
            }
            SetNextPattern();

            client = new KinectProviderServiceClient(new BasicHttpBinding(),
                                                     new EndpointAddress(new Uri("http://localhost:49172/KinectProviderService.svc", UriKind.RelativeOrAbsolute)));
            var timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromTicks(333333);
            timer.Tick    += async(object s, object ee) =>
            {
                Kinect data;
                try
                {
                    data = await client.GetDataAsync(new Kinect());
                }
                catch { return; }

                if (data == null)
                {
                    textNotice.Text = "Kinect data is lost."; return;
                }
                if (!data.IsConnected)
                {
                    textNotice.Text = "Kinect is not connected."; return;
                }
                if (data.Skeleton == null || data.Skeleton.Length == 0)
                {
                    textNotice.Text = "Skeleton is not found."; return;
                }
                textNotice.Text = "";

                SetPosition(boneHead, data.Skeleton [( int )Kinect.JointType.Head]);
                SetPosition(boneShoulderCenter, data.Skeleton [( int )Kinect.JointType.ShoulderCenter]);
                SetPosition(boneShoulderLeft, data.Skeleton [( int )Kinect.JointType.ShoulderLeft]);
                SetPosition(boneShoulderRight, data.Skeleton [( int )Kinect.JointType.ShoulderRight]);
                SetPosition(boneSpine, data.Skeleton [( int )Kinect.JointType.Spine]);
                SetPosition(boneHipCenter, data.Skeleton [( int )Kinect.JointType.HipCenter]);
                SetPosition(boneHipLeft, data.Skeleton [( int )Kinect.JointType.HipLeft]);
                SetPosition(boneHipRight, data.Skeleton [( int )Kinect.JointType.HipRight]);
                SetPosition(boneKneeLeft, data.Skeleton [( int )Kinect.JointType.KneeLeft]);
                SetPosition(boneKneeRight, data.Skeleton [( int )Kinect.JointType.KneeRight]);
                SetPosition(boneAnkleLeft, data.Skeleton [( int )Kinect.JointType.AnkleLeft]);
                SetPosition(boneAnkleRight, data.Skeleton [( int )Kinect.JointType.AnkleRight]);
                SetPosition(boneFootLeft, data.Skeleton [( int )Kinect.JointType.FootLeft]);
                SetPosition(boneFootRight, data.Skeleton [( int )Kinect.JointType.FootRight]);
                SetPosition(boneElbowLeft, data.Skeleton [( int )Kinect.JointType.ElbowLeft]);
                SetPosition(boneElbowRight, data.Skeleton [( int )Kinect.JointType.ElbowRight]);
                SetPosition(boneWristLeft, data.Skeleton [( int )Kinect.JointType.WristLeft]);
                SetPosition(boneWristRight, data.Skeleton [( int )Kinect.JointType.WristRight]);
                SetPosition(boneHandLeft, data.Skeleton [( int )Kinect.JointType.HandLeft]);
                SetPosition(boneHandRight, data.Skeleton [( int )Kinect.JointType.HandRight]);

                MatchTest();
            };
            timer.Start();
        }
コード例 #4
0
 private void addButton_Click(object sender, RoutedEventArgs e)
 {
     ActionCollection.AddAction(currentAction);
     ActionCollection.SaveData(() => { Frame.GoBack(); });
 }