/// <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(); }
/// <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 } Grid kinectControlGrid = new Grid(); kinectRegion = new KinectRegion(); kinectUserViewer = new KinectUserViewer() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom, Width = 128, Height = 106, BorderThickness=new Thickness(3.0), BorderBrush = new SolidColorBrush(Colors.Orange), Margin = new Thickness(7.0), }; kinectControlGrid.Children.Add(kinectRegion); kinectControlGrid.Children.Add(kinectUserViewer); kinectRegion.Content = rootFrame; // Place the frame in the current Window Window.Current.Content = kinectControlGrid; //Window.Current.Content = rootFrame; } 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(Menu), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { this.kinectRegion.KinectSensor = KinectSensor.GetDefault(); FrameDescription fd = this.kinectRegion.KinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra); colorBitmap = new WriteableBitmap(fd.Width, fd.Height, 96.0, 96.0, PixelFormats.Bgr32, null); bodies = new Body[this.kinectRegion.KinectSensor.BodyFrameSource.BodyCount]; msfr = this.kinectRegion.KinectSensor.OpenMultiSourceFrameReader(FrameSourceTypes.Body | FrameSourceTypes.Color | FrameSourceTypes.Depth); msfr.MultiSourceFrameArrived += msfr_MultiSourceFrameArrived; InitializeButtons(); kviewer = new KinectUserViewer() { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Height = 125, Width = 125, }; canvas.Children.Add(kviewer); //is it possible to add more than one child in a canvas? YES this.kinectRegion.KinectSensor.Open(); image.Source = colorBitmap; }
/// <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(); KinectUserViewer kinectUserViewer = new KinectUserViewer() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, Height = 100, Width = 121 }; Grid grid = new Grid(); grid.Children.Add(kinectRegion); grid.Children.Add(kinectUserViewer); 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(GroupedItemsPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée /// seront utilisés par exemple au moment du lancement de l'application pour l'ouverture d'un fichier spécifique. /// </summary> /// <param name="e">Détails concernant la requête et le processus de lancement.</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; // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu, // assurez-vous juste que la fenêtre est active if (rootFrame == null) { // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page rootFrame = new Frame(); // Définir la page par défaut rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: chargez l'état de l'application précédemment suspendue } // Placez le frame dans la fenêtre active Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // Quand la pile de navigation n'est pas restaurée, accédez à la première page, // puis configurez la nouvelle page en transmettant les informations requises en tant que // paramètre rootFrame.Navigate(typeof(MainPage), e.Arguments); } //Ajout de l'intégration kinect----------- #region kinectImplementation // KinectSensor.GetDefault().Open(); //Ajout de la région kinect kinectRegion = new KinectRegion(); //Création de la région kinect cliquable à la main kinectRegion.Content = rootFrame; //La région kinect contient toute les pages principales de l'application => On peut utiliser kinect sur toute les pages par défaut //Ajout d'une grille pour le viewer et la région kinect Grid mainGrid = new Grid(); mainGrid.Children.Add(kinectRegion); Window.Current.Content = mainGrid; //La région kinect est la partie principale de la fenêtre //Ajout du kinectViewer pour pouvoir se voir KinectUserViewer kinectViewer = new KinectUserViewer() { Width = 150, Height = 130, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Right }; mainGrid.Children.Add(kinectViewer); //Ajout du kinectCore pour plus de fonctionnalité kinectCore = KinectCoreWindow.GetForCurrentThread(); #endregion // Vérifiez que la fenêtre actuelle est 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) { #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(); }