Beispiel #1
0
        public void Activated(object state)
        {
            DemoAppState curState = (DemoAppState)state;

            if (this.Kinect == null)
            {
                this.Kinect = (KinectModel)curState.Kinect;
            }
            this.ApplicationMode = curState.ApplicationMode;
            if (this.Kinect != null)
            {
                this.Kinect.SkeletonUpdated += Kinect_SkeletonUpdated;
            }
        }
Beispiel #2
0
        private void MoveToHomeScreen()
        {
            // Selected index must be valid
            // TODO: either default the selected index when the user returns to the home screen, or prompt them to select an option if SelectedIndex is invalid
            if (SelectedIndex < 0 || SelectedIndex > this.applicationModes.Count)
            {
                return;
            }

            switch (this.applicationModes[SelectedIndex])
            {
            case ("Settings"):
            {
                Stream         fileStream;
                OpenFileDialog openFileDialog = new OpenFileDialog {
                };
                openFileDialog.ShowDialog();
                try
                {
                    fileStream = File.OpenRead(openFileDialog.FileName);
                    var curState = new AppState(new ReplayKinectModel(fileStream), null, 0);
                    Messenger.Default.Send(new NavigateMessage(SettingsViewModel.ViewName, curState));
                }
                catch { }
                break;
            }

            case ("Replay"):
            {
                Stream         fileStream;
                OpenFileDialog openFileDialog = new OpenFileDialog {
                };
                openFileDialog.ShowDialog();
                try
                {
                    fileStream = File.OpenRead(openFileDialog.FileName);
                    var curState = new DemoAppState(this.applicationModes[SelectedIndex], new ReplayKinectModel(fileStream));
                    Messenger.Default.Send(new NavigateMessage(DemoViewModel.ViewName, curState));
                }
                catch { }
                break;
            }

            case ("Record"):
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog {
                };
                saveFileDialog.ShowDialog();
                Stream fileStream;
                try
                {
                    fileStream = File.OpenWrite(saveFileDialog.FileName);
                    var curState = new DemoAppState(this.applicationModes[SelectedIndex], new FreePlayKinectModel(fileStream));
                    Messenger.Default.Send(new NavigateMessage(DemoViewModel.ViewName, curState));
                }
                catch { }
                break;
            }

            case ("Free Use"):
            {
                var curState = new DemoAppState(this.applicationModes[SelectedIndex], new FreePlayKinectModel(null));
                Messenger.Default.Send(new NavigateMessage(DemoViewModel.ViewName, curState));
                break;
            }

            case ("Audio App"):
            {
                Messenger.Default.Send(new NavigateMessage(HomeViewModel.ViewName, this.AppState));
                break;
            }

            case ("Start Application"):
            {
                Messenger.Default.Send(new NavigateMessage(MicRecordViewModel.ViewName, this.AppState));
                break;
            }

            case ("Fancy Graph"):
            {
                Messenger.Default.Send(new NavigateMessage(FancyGraphViewModel.ViewName, 0));
                break;
            }
            }
        }