/// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                KinectRegion kinectRegion = new KinectRegion();
                Grid grid = new Grid();
                KinectUserViewer userViewer = new KinectUserViewer()

                {
                    Height = 100,
                    Width = 121,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Top,

                };
                grid.Children.Add(kinectRegion);
                grid.Children.Add(userViewer);
                kinectRegion.Content = rootFrame;




                // Place the frame in the current Window
                Window.Current.Content = grid;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
        public PressableController(FrameworkElement element, PressableModel model, KinectRegion kinectRegion)
        {
            this.element = new WeakReference(element);
            this.kinectRegion = kinectRegion;
            this.inputModel = model;

            if (this.inputModel == null)
                return;

            this.eventSubscriptions = new CompositeDisposable 
            {
                this.inputModel.PressingStartedObservable()
                               .Subscribe(_ => VisualStateManager.GoToState(this.Control, "Focused", true)),

                this.inputModel.HoldingObservable()
                               .Subscribe(_ => Debug.WriteLine(string.Format("Holding: {0}, ", DateTime.Now))),

                this.inputModel.PressingUpdatedObservable()
                               .Subscribe(_ => Debug.WriteLine(string.Format("PressingUpdated: {0}, ", DateTime.Now))),

                this.inputModel.PressingCompletedObservable()
                               .Subscribe(_ => VisualStateManager.GoToState(this.Control, "Unfocused", true)),

                this.inputModel.TappedObservable()
                               .Subscribe(_ => Debug.WriteLine(string.Format("Tapped: {0}, ", DateTime.Now))),
            };
        }
        //コンストラクタ
        public DragDropDecoratorController(IInputModel _inputModel, KinectRegion _kinectRegion)
        {
            inputModel = _inputModel as ManipulatableModel;
            kinectRegion = _kinectRegion;
            dragDropDecorator = _inputModel.Element as DragDropDecorator;

            inputModel.ManipulationUpdated += inputModel_ManipulationUpdated;
        }
 void System.IDisposable.Dispose()
 {
     if ( !disposed ) {
         kinectRegion = null;
         inputModel = null;
         dragDropDecorator = null;
         inputModel.ManipulationUpdated -= inputModel_ManipulationUpdated;
         disposed = true;
     }
 }
Exemple #5
0
        public MicrophoneSetting()
        {
            InitializeComponent();
            //初始化手勢控制的Image
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion  = kinectRegion;
            btnKinect.Click  += new RoutedEventHandler(SelectMicrophone);
            btnHeadset.Click += new RoutedEventHandler(SelectMicrophone);
        }
        // Window1.xaml.btnNewAction.IsEnabled = true;

        public BasicHandOperationController(IInputModel inputModel, KinectRegion kinectRegion)
        {
            this.inputModel   = inputModel as ManipulatableModel;
            this.kinectRegion = kinectRegion;
            this.myThumb      = this.inputModel.Element as MyThumb;
            this.kinectRegion.GotTouchCapture += testGrab;

            this.inputModel.ManipulationStarted   += InputModel_ManipulationStarted;
            this.inputModel.ManipulationUpdated   += InputModel_ManipulationUpdated;
            this.inputModel.ManipulationCompleted += InputModel_ManipulationCompleted;
        }
        public ReservationSummary(int reservationId)
        {
            this.ReservationId = reservationId;
            InitializeComponent();
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
            LoadData();
        }
Exemple #8
0
        public MovieDetail(int movieId)
        {
            this.MovieId = movieId;
            InitializeComponent();
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
            LoadData();
        }
 void System.IDisposable.Dispose()
 {
     if (!_disposed)
     {
         _kinectRegion      = null;
         _inputModel        = null;
         _dragDropDecorator = null;
         _inputModel.ManipulationUpdated -= inputModel_ManipulationUpdated;
         _disposed = true;
     }
 }
Exemple #10
0
        public IKinectController CreateController(
            IInputModel inputModel,
            KinectRegion kinectRegion)
        {
            inputModel.GestureRecognizer.GestureSettings =
                KinectGestureSettings.ManipulationScale |
                KinectGestureSettings.ManipulationTranslateX |
                KinectGestureSettings.ManipulationTranslateY;

            inputModel.GestureRecognizer.ManipulationUpdated += OnManipulationUpdated;
            return(new ManipulatableController(inputModel));
        }
Exemple #11
0
        public Reservation(ReservationData reservationData)
        {
            this.ReservationData = reservationData;
            Seats = new List <string>();
            InitializeComponent();
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
            LoadData();
        }
        public SelectPeerVocabularyView()
        {
            InitializeComponent();
            btnPeerVocabularyPractice.Click += new RoutedEventHandler(Select);
            btnPeerVocabularyGame.Click     += new RoutedEventHandler(Select);

            //初始化手勢控制的Image
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
        }
Exemple #13
0
        public ColorLesson()
        {
            InitializeComponent();
            //show person's body & moving cursor
            KinectRegion.SetKinectRegion(this, KinectArea);

            App app = ((App)Application.Current);

            app.KinectRegion = KinectArea;
            app.KinectRegion.CursorSpriteSheetDefinition = new CursorSpriteSheetDefinition(new System.Uri("pack://application:,,,/Images/CursorSpriteSheetPurple.png"), 4, 20, 137, 137);
            Loaded += WindowLoaded;
        }
Exemple #14
0
        private void UnregisterRadBookItemHandlers(RadBookItem[] radBookItems)
        {
            if (radBookItems == null)
            {
                throw new ArgumentException("radBookItems");
            }

            foreach (RadBookItem item in radBookItems)
            {
                KinectRegion.RemoveHandPointerEnterHandler(item, OnHandPointerEnterPage);
                KinectRegion.RemoveHandPointerLeaveHandler(item, OnHandPointLeavePageRegion);
            }
        }
Exemple #15
0
        public MainMenu()
        {
            InitializeComponent();

            KinectRegion.SetKinectRegion(this, kinectRegion);


            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;

            videoTutorial.Source = new System.Uri(MainWindow.executingDirectory + "\\Videos\\Tutorial.mp4");
        }
        private void InitializeKinectButtonBase()
        {
            KinectRegion.AddHandPointerEnterHandler(this, this.OnHandPointerEnter);
            KinectRegion.AddHandPointerMoveHandler(this, this.OnHandPointerMove);

            KinectRegion.AddHandPointerGotCaptureHandler(this, this.OnHandPointerCaptured);
            KinectRegion.AddHandPointerLostCaptureHandler(this, this.OnHandPointerLostCapture);


            KinectRegion.AddHandPointerGripHandler(this, this.OnHandPointerGrip);
            KinectRegion.AddHandPointerGripReleaseHandler(this, this.OnHandPointerGripRelease);
            KinectRegion.AddQueryInteractionStatusHandler(this, this.OnQueryInteractionStatus);
        }
Exemple #17
0
        //a DragDropElement konstruktorával együtt jön létre
        public DragDropElementController(IInputModel inputModel, KinectRegion kinectRegion)
        {
            _inputModel      = inputModel as ManipulatableModel;
            _kinectRegion    = kinectRegion;
            _dragDropElement = _inputModel.Element as DragDropElement;


            //mozgatás kezdete
            _inputModel.ManipulationStarted += OnManipulationStarted;
            //mozgatás közben
            _inputModel.ManipulationUpdated += OnManipulationUpdated;
            //mozgatás végén
            _inputModel.ManipulationCompleted += OnManipulationCompleted;
        }
Exemple #18
0
 public IKinectController CreateController(
     IInputModel inputModel,
     KinectRegion kinectRegion)
 {
     inputModel.GestureRecognizer.ManipulationStarted += (s, e) =>
     {
         this.isGripping = true;
     };
     inputModel.GestureRecognizer.ManipulationCompleted += (s, e) =>
     {
         this.isGripping = false;
     };
     return(new ManipulatableController(inputModel));
 }
Exemple #19
0
        public LogoMenu()
        {
            InitializeComponent();
            Ran = new Random(this.GetHashCode());

            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;

            // Use the default sensor
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
        }
Exemple #20
0
        public PlayGame()
        {
            InitializeComponent();


            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;

            // Use the default sensor
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
        }
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         _kinectRegion                  = null;
         _inputModel                    = null;
         _interactiveElement            = null;
         kinectCoreWindow.PointerMoved -= kinectCoreWindow_PointerMoved;
         _handPointerEnter              = null;
         _handPointerLeave              = null;
         kinectCoreWindow               = null;
         _disposedValue                 = true;
     }
 }
Exemple #22
0
 private void updateChosenList()
 {
     scrollChosenList.Children.Clear();
     for (int i = 0; i < chosenList.Count; i++)
     {
         KinectTileButton btn = presentAudioFile(chosenList[i].ToString());
         btn.Name        = "audio" + i.ToString();
         btn.Click      += removeSong;
         btn.MouseEnter += songHover;
         KinectRegion.AddHandPointerEnterHandler(btn, this.songHover);
         scrollChosenList.Children.Add(btn);
         //this.updateInfo(btn.Name);
     }
 }
        public MainWindow()
        {
            this.Index           = 0;
            this.PreviousPicture = this.LoadPicture(this.Index - 1);
            this.Picture         = this.LoadPicture(this.Index);
            this.NextPicture     = this.LoadPicture(this.Index + 1);
            this.backgroundPic   = this.LoadBackgroundPicture(this.backIndex);



            //For displaying a folders images after some seconds
            t        = new System.Windows.Threading.DispatcherTimer();
            t2       = new System.Windows.Threading.DispatcherTimer();
            t3       = new System.Windows.Threading.DispatcherTimer();
            t4       = new System.Windows.Threading.DispatcherTimer();
            t5       = new System.Windows.Threading.DispatcherTimer();
            t6       = new System.Windows.Threading.DispatcherTimer();
            t.Tick  += new EventHandler(t_Tick);
            t2.Tick += new EventHandler(t2_tick);
            t3.Tick += new EventHandler(t3_tick);
            t4.Tick += new EventHandler(t4_tick);
            t5.Tick += new EventHandler(t5_tick);
            t6.Tick += new EventHandler(t6_tick);

            InitializeComponent();
            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;

            // Use the default sensor
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();

            // get the coordinate mapper
            this.coordinateMapper = this.kinectRegion.KinectSensor.CoordinateMapper;

            // get the depth (display) extents
            FrameDescription frameDescription = this.kinectRegion.KinectSensor.DepthFrameSource.FrameDescription;

            // open the reader for the body frames
            this.bodyFrameReader = this.kinectRegion.KinectSensor.BodyFrameSource.OpenReader();

            // open the sensor
            this.kinectRegion.KinectSensor.Open();

            scrollViewer1.Visibility = System.Windows.Visibility.Hidden;
            scrollViewer2.Visibility = System.Windows.Visibility.Hidden;
        }
Exemple #24
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                // Create a CursorLayer that listens to KinectPointerPoints/GestureRecognizers
                // and works with the affected controls.
                KinectRegion         = new KinectRegion();
                KinectRegion.Content = rootFrame;

                // Place the frame in the current Window, with a Kinect cursor layer + user viewer control
                Window.Current.Content = KinectRegion;
            }
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Exemple #25
0
        public DragDropElement()
        {
            lastGripState = GripState.Released;

            kinectRegionBinder = new KinectRegionBinder(this);
            kinectRegionBinder.OnKinectRegionChanged += OnKinectRegionChanged;

            KinectRegion.AddHandPointerEnterHandler(this, OnHandPointerEnter);
            KinectRegion.AddHandPointerMoveHandler(this, OnHandPointerMove);
            KinectRegion.AddHandPointerGotCaptureHandler(this, OnHandPointerCaptured);
            KinectRegion.AddHandPointerLostCaptureHandler(this, OnHandPointerLostCapture);
            KinectRegion.AddHandPointerGripHandler(this, OnHandPointerGrip);
            KinectRegion.AddHandPointerGripReleaseHandler(this, OnHandPointerGripRelease);
            KinectRegion.AddQueryInteractionStatusHandler(this, OnQueryInteractionStatus);
        }
Exemple #26
0
        public MainWindow()
        {
            InitializeComponent();
            InitializeTables();
            InitializeButtons_Body();

            App app = ((App)App.Current);

            KinectRegion.SetKinectRegion(this, kinectRegion);
            app.KinectRegion = kinectRegion;

            kinectRegion.Loaded += kinectRegion_Loaded;
            this.Loaded         += MainWindow_Loaded;
            this.Closing        += MainWindow_Closing;
        }
        public MainWindow()
        {
            InitializeComponent();

            //hovering start
            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;

            // Use the default sensor
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
            //hovering end
        }
Exemple #28
0
        public MainWindow()
        {
            InitializeComponent();
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
            LoadData();


            //var form = new AddSnak(20);
            //form.Show();
            //this.Hide();
        }
        public HelpWindow(KinectSensor kinectSensor)
        {
            InitializeComponent();

            this.kinectSensor = kinectSensor;

            KinectRegion.SetKinectRegion(this, kinectRegionHelp);

            App app = ((App)Application.Current);

            app.KinectRegionHelp = kinectRegionHelp;

            // Use the default sensor
            this.kinectRegionHelp.KinectSensor = this.kinectSensor;
        }
Exemple #30
0
        public SelectSentenceView()
        {
            InitializeComponent();

            btnSentencePractice.Click += new RoutedEventHandler(Select);
            btnSentenceGame.Click     += new RoutedEventHandler(Select);
            btnStoryMarking.Click     += new RoutedEventHandler(Select);
            btnStoryMarkingGame.Click += new RoutedEventHandler(Select);

            //初始化手勢控制的Image
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
        }
Exemple #31
0
        //destruktor
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                _kinectRegion    = null;
                _inputModel      = null;
                _dragDropElement = null;

                _inputModel.ManipulationStarted   -= OnManipulationStarted;
                _inputModel.ManipulationUpdated   -= OnManipulationUpdated;
                _inputModel.ManipulationCompleted -= OnManipulationCompleted;

                _disposedValue = true;
            }
        }
Exemple #32
0
        public DragDropElementController(IInputModel inputModel, KinectRegion kinectRegion)
        {
            this._inputModel   = inputModel as ManipulatableModel;
            this._kinectRegion = kinectRegion;
            var manipulatableModel = this._inputModel;

            if (manipulatableModel != null)
            {
                _dragDropElement = manipulatableModel.Element as DragDropElement;

                manipulatableModel.ManipulationStarted   += InputModel_ManipulationStarted;
                manipulatableModel.ManipulationUpdated   += InputModel_ManipulationUpdated;
                manipulatableModel.ManipulationCompleted += InputModel_ManipulationCompleted;
            }
        }
Exemple #33
0
        private void GameWindowContentRendered(object sender, EventArgs e)
        {
            // Set the hot spot regions
            KinectRegion.AddHandPointerEnterHandler(RECT1, SetHandEntersHotspot1);
            KinectRegion.AddHandPointerLeaveHandler(RECT1, SetHandLeavesHotspot1);

            KinectRegion.AddHandPointerEnterHandler(RECT2, SetHandEntersHotspot2);
            KinectRegion.AddHandPointerLeaveHandler(RECT2, SetHandLeavesHotspot2);

            KinectRegion.AddHandPointerEnterHandler(RECT3, SetHandEntersHotspot3);
            KinectRegion.AddHandPointerLeaveHandler(RECT3, SetHandLeavesHotspot3);

            KinectRegion.AddHandPointerEnterHandler(RECT4, SetHandEntersHotspot4);
            KinectRegion.AddHandPointerLeaveHandler(RECT4, SetHandLeavesHotspot4);
        }
Exemple #34
0
        public GameMode(KinectSensorChooser kinectSensorChooser, int playerID, int window = -1)
        {
            InitializeComponent();

            //	Set window startup location to center
            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            //	Set the class members
            this.playerID            = playerID;
            this.kinectSensorChooser = kinectSensorChooser;

            // window -1 for game, 0 for high score
            windowType = window;

            // Bind Kinect Sensor to Kinect Region
            var kinectRegionandSensorBinding = new Binding("Kinect")
            {
                Source = kinectSensorChooser
            };

            BindingOperations.SetBinding(kinectKinectRegion, KinectRegion.KinectSensorProperty, kinectRegionandSensorBinding);

            #region KinectRegion
            //	Setup Kinect region press target and event handlers
            KinectRegion.SetIsPressTarget(btnSurvival, true);
            KinectRegion.SetIsPressTarget(btnTimeAttack, true);

            //	btnSurvival
            KinectRegion.AddHandPointerEnterHandler(btnSurvival, HandPointerEnterEvent);
            KinectRegion.AddHandPointerLeaveHandler(btnSurvival, HandPointerLeaveEvent);

            KinectRegion.AddHandPointerPressHandler(btnSurvival, HandPointerPressEvent);
            KinectRegion.AddHandPointerPressReleaseHandler(btnSurvival, HandPointerPressReleaseEvent);

            KinectRegion.AddHandPointerGotCaptureHandler(btnSurvival, HandPointerCaptureEvent);
            KinectRegion.AddHandPointerLostCaptureHandler(btnSurvival, HandPointerLostCaptureEvent);

            //	btnTimeAttack
            KinectRegion.AddHandPointerEnterHandler(btnTimeAttack, HandPointerEnterEvent);
            KinectRegion.AddHandPointerLeaveHandler(btnTimeAttack, HandPointerLeaveEvent);

            KinectRegion.AddHandPointerPressHandler(btnTimeAttack, HandPointerPressEvent);
            KinectRegion.AddHandPointerPressReleaseHandler(btnTimeAttack, HandPointerPressReleaseEvent);

            KinectRegion.AddHandPointerGotCaptureHandler(btnTimeAttack, HandPointerCaptureEvent);
            KinectRegion.AddHandPointerLostCaptureHandler(btnTimeAttack, HandPointerLostCaptureEvent);
            #endregion
        }
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                var kinectRegion = new KinectRegion
                {
                    Content = rootFrame
                };

                Window.Current.Content = kinectRegion;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;
            
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                //Associate the frame with a SuspensionManager key                                
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                var kinectRegion = new KinectRegion
                {
                    Content = rootFrame
                };

                // Place the frame in the current Window
                Window.Current.Content = kinectRegion;
            }
            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(DraggablePage), e.Arguments);
            }
            
            Window.Current.Activate();
        }
        public DragAndDropController(Draggable element, ManipulatableModel model, KinectRegion kinectRegion)
        {
            this.element = new WeakReference(element);
            this.kinectRegion = kinectRegion;
            this.inputModel = model;

            if (this.inputModel == null)
                return;

            this.eventSubscriptions = new CompositeDisposable 
            {
                this.inputModel.ManipulationStartedObservable()
                               .Subscribe(_ => VisualStateManager.GoToState(this.Control, "Entered", true)),

                this.inputModel.ManipulationInertiaStartingObservable()
                               .Subscribe(_ => Debug.WriteLine(string.Format("ManipulationInertiaStarting: {0}, ", DateTime.Now))),

                this.inputModel.ManipulationUpdatedObservable()
                               .Subscribe(_ => OnManipulationUpdated(_)),

                this.inputModel.ManipulationCompletedObservable()
                               .Subscribe(_ => VisualStateManager.GoToState(this.Control, "Left", true)),
            };
        }
Exemple #38
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {

#if DEBUG
            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                //Associate the frame with a SuspensionManager key                                
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }




                KinectRegion kinectRegion = new KinectRegion();
                Grid grid = new Grid();
                KinectUserViewer userViewer = new KinectUserViewer()

                {
                    Height = 100,
                    Width = 121,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Top,

                };
                grid.Children.Add(kinectRegion);
                grid.Children.Add(userViewer);
                kinectRegion.Content = rootFrame;






                // Place the frame in the current Window
                Window.Current.Content = grid;
            }
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(mainpage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
 public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion)
 {
     return new PressableController(this, new PressableModel(inputModel.GestureRecognizer.GestureSettings, this), kinectRegion);
 }
 public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion)
 {
     return new DragDropDecoratorController( inputModel, kinectRegion );
 }
Exemple #41
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            #if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
            #endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Create a CursorLayer that listens to KinectPointerPoints/GestureRecognizers
                // and works with the affected controls.
                KinectRegion = new Microsoft.Kinect.Xaml.Controls.KinectRegion();
                KinectRegion.Content = rootFrame;

                // Place the frame in the current Window, with a Kinect cursor layer + user viewer control
                Window.Current.Content = KinectRegion;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
 public IKinectController CreateController(IInputModel inputModel, KinectRegion kinectRegion)
 {
     // Only one controller is instantiated for one Control
     var model = new ManipulatableModel(inputModel.GestureRecognizer.GestureSettings, this);
     return new DragAndDropController(this, model, kinectRegion);
 }