-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
107 lines (87 loc) · 3.89 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//------------------------------------------------------------------------------
// <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;
using DotNetWikiBot;
/// <summary>
/// Interaction logic for MainWindow
/// </summary>
public partial class MainWindow
{
SampleDataSource sampleDataSource;
/// <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
Site wikiSite = new Site("http://en.wikipedia.org", "hackatbrown", "password");
PageList pageList = new PageList(wikiSite);
pageList.FillFromGoogleSearchResults("Morgan Freeman", 1);
this.setData(pageList[0]);
}
private void setData(DotNetWikiBot.Page page) {
SampleDataSource sampleDataSourceRoot = new SampleDataSource();
sampleDataSourceRoot.setDataSource(page);
var sampleDataSource = SampleDataSource.GetGroup(page.pageId);
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;
DataItem DataItem = button.DataContext as DataItem;
this.setData(DataItem.Page);
/*
if (DataItem != null && DataItem.NavigationPage != null)
{
backButton.Visibility = System.Windows.Visibility.Visible;
navigationRegion.Content = Activator.CreateInstance(DataItem.NavigationPage);
}
else
{
var selectionDisplay = new SelectionDisplay(button.Content as string);
this.kinectRegionGrid.Children.Add(selectionDisplay);
// Selection dialog covers the entire interact-able area, so the current press interaction
// should be completed. Otherwise hover capture will allow the button to be clicked again within
// the same interaction (even whilst no longer visible).
selectionDisplay.Focus();
// Since the selection dialog covers the entire interact-able area, we should also complete
// the current interaction of all other pointers. This prevents other users interacting with elements
// that are no longer visible.
this.kinectRegion.InputPointerManager.CompleteGestures();
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;
}
}
}