示例#1
0
        private void MoveTo(NavPageInfo page)
        {
            if (page == null)
            {
                return;
            }

            var index = UIPages.IndexOf(page);

            if (index < 0 || index > UIPages.Count - 1 || index == pageIndex)
            {
                return;
            }

            this.LastPage = this.CurrentPage;

            if (page.UserControl == HomeControl)
            {
                //listener.RecognitionEngine.LoadGrammar(MainWindowGrammar);
            }

            if (index < pageIndex)
            {
                selectAndFlyOut = index;
                FlyOffRight.Begin();
            }
            else if (index > pageIndex)
            {
                selectAndFlyIn = index;
                FlyOffLeft.Begin();
            }
            this.CurrentPage = page;
        }
示例#2
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (!Directory.Exists(GesturePakFolder))
            {
                Directory.CreateDirectory(GesturePakFolder);
            }

            OriginalHeight = this.ActualHeight;
            OriginalWidth  = this.ActualWidth;

            // Kinect Engine initialization
            KinectViewer              = new ColorAndBodyViewer();
            KinectViewer.BodyTracked += KinectViewer_BodyTracked;

            KinectViewer.ShowLiveVideo     = true;
            KinectViewer.DrawBodies        = true;
            KinectViewer.JointThickness    = 12;
            KinectViewer.TrackedJointBrush = new SolidColorBrush(Colors.DarkGreen);
            KinectViewer.TrackedBonePen    = new Pen(Brushes.Green, 12);
            KinectViewer.FramePrefix       = "frame";
            KinectViewer.VideoFolder       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\frames";

            // Create the gesture recorder
            Recorder = new GestureRecorder();

            // Show the first page
            if (UIPages != null && UIPages.Count > 0 && UIPages[0].UserControl != null)
            {
                NotifyPropertyChanged("SelectedPage");
                OnTransitionComplete(null, HomeControl);
                this.CurrentPage = HomePage;
            }
        }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();
            this.Style    = (Style)Resources["GradientStyle"];
            this.Loaded  += MainWindow_Loaded;
            this.Closing += MainWindow_Closing;

            HomeControl         = new UCHome();
            PreRecordingControl = new UCPreRecording();
            RecordingControl    = new UCRecorder();
            EditControl         = new UCEdit();
            TestControl         = new UCTest();

            HomePage      = new NavPageInfo(HomeControl, false, "Home");
            PreRecordPage = new NavPageInfo(PreRecordingControl, false, "Before You Record ...");
            RecordPage    = new NavPageInfo(RecordingControl, false, "Record Gesture");
            EditPage      = new NavPageInfo(EditControl, false, "Edit Gesture");
            TestPage      = new NavPageInfo(TestControl, false, "Test Gesture");

            UIPages.Add(HomePage);
            UIPages.Add(PreRecordPage);
            UIPages.Add(RecordPage);
            UIPages.Add(EditPage);
            UIPages.Add(TestPage);

            // name the controls
            for (int i = 0; i < UIPages.Count; i++)
            {
                UIPages[i].UserControl.Name             = "UC" + i.ToString();
                UIPages[i].UserControl.PropertyChanged += UserControl_PropertyChanged;
                UIPages[i].UserControl.DataComplete    += UserControl_DataComplete;
            }

            AnimateLeftToRight = ((Storyboard)this.Resources["AnimateLeftToRight"]);
            AnimateRightToLeft = ((Storyboard)this.Resources["AnimateRightToLeft"]);

            FlyOffLeft             = ((Storyboard)this.Resources["FlyOffLeft"]);
            FlyOffRight            = ((Storyboard)this.Resources["FlyOffRight"]);
            FlyOffLeft.Completed  += FlyOffLeft_Completed;
            FlyOffRight.Completed += FlyOffRight_Completed;

            pageIndex = 0;
            FlyIn();
        }