-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
75 lines (66 loc) · 2.66 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//------------------------------------------------------------------------------
// <copyright file="MainWindow.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Samples.Kinect.ControlsBasics
{
using System;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Kinect;
using Microsoft.Kinect.Wpf.Controls;
using Microsoft.Samples.Kinect.ControlsBasics.DataModel;
/// <summary>
/// Interaction logic for MainWindow
/// </summary>
public partial class MainWindow
{
/// <summary>
/// Initializes a new instance of the <see cref="MainWindow"/> class.
/// </summary>
public MainWindow()
{
this.InitializeComponent();
KinectRegion.SetKinectRegion(this, kinectRegion);
App app = ((App)Application.Current);
app.KinectRegion = kinectRegion;
// Use the default sensor
this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
//// Add in display content
var sampleDataSource = SampleDataSource.GetGroup("Group-1");
this.itemsControl.ItemsSource = sampleDataSource;
}
/// <summary>
/// Handle a button click from the wrap panel.
/// </summary>
/// <param name="sender">Event sender</param>
/// <param name="e">Event arguments</param>
private void ButtonClick(object sender, RoutedEventArgs e)
{
var button = (Button)e.OriginalSource;
SampleDataItem sampleDataItem = button.DataContext as SampleDataItem;
if (sampleDataItem != null && sampleDataItem.NavigationPage != null)
{
backButton.Visibility = System.Windows.Visibility.Visible;
navigationRegion.Content = Activator.CreateInstance(sampleDataItem.NavigationPage);
}
else
{
var selectionDisplay = new SelectionDisplay(button.Content as string);
this.kinectRegionGrid.Children.Add(selectionDisplay);
e.Handled = true;
}
}
/// <summary>
/// Handle the back button click.
/// </summary>
/// <param name="sender">Event sender</param>
/// <param name="e">Event arguments</param>
private void GoBack(object sender, RoutedEventArgs e)
{
backButton.Visibility = System.Windows.Visibility.Hidden;
navigationRegion.Content = this.kinectRegionGrid;
}
}
}