/// <summary> /// Displays the words. /// </summary> /// <param name="result">The result.</param> private void DisplayWords(string result) { StringBuilder sb = new StringBuilder(); if (txtUserGUID.Text.Trim() == "Please say your User GUID" | txtUserGUID.Text.Trim() == "Wrong User GUID. Please Repeat") { sb.Append(string.Format("{0}", GenericFunctions.ConvertWordsToNumber(result))); txtUserGUID.Text = string.Empty; txtUserGUID.Text = sb.ToString(); } else if (result == "DELETE") { if (txtUserGUID.Text.Length > 0) { txtUserGUID.Text = txtUserGUID.Text.Substring(0, txtUserGUID.Text.Length - 1); } } else if (result == "CLEAR") { if (txtUserGUID.Text.Length > 0) { txtUserGUID.Text = " Please say your User GUID"; } } else if (result == "FINISH") { User_DB_Query db = new User_DB_Query(); bool correct_guid = db.validate_guid(txtUserGUID.Text.Trim()); if (correct_guid) { Loaded -= VoiceKeyBoard_Loaded; sensor.Stop(); sensor = null; //save media location path ApplicationState.SetValue("kblog_media", @"C:\KBlog_Media"); HomeScreen homeScreen = new HomeScreen(); homeScreen.Show(); //Window1 wnd = new Window1(); //wnd.Show(); //AudioRecord ar = new AudioRecord(); //ar.Show(); this.Close(); } else { txtUserGUID.Text = "Wrong User GUID. Please Repeat"; } } else { sb.Append(txtUserGUID.Text); sb.Append(GenericFunctions.ConvertWordsToNumber(result)); txtUserGUID.Text = sb.ToString(); } }
public HomeScreen() { InitializeComponent(); // initialize the sensor chooser and UI this.sensorChooser = new KinectSensorChooser(); this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged; this.sensorChooserUi.KinectSensorChooser = this.sensorChooser; this.sensorChooser.Start(); // Bind the sensor chooser's current sensor to the KinectRegion var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser }; BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding); // get name of user User_DB_Query query = new User_DB_Query(); userNameLbl.Content += query.get_user_name(ApplicationState.GetValue <string>("user_id")); // Clear out placeholder content this.wrapPanel.Children.Clear(); //Add in display content for (var index = 0; index < 5; ++index) { if (index == 0) { BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(@"Images\rgb_background.jpg", UriKind.Relative); bi.EndInit(); colorKinectBtn = new KinectTileButton { Background = new ImageBrush(bi), Tag = "TAG", Label = "Color Image", Height = 250, Width = 272 }; this.wrapPanel.Children.Add(colorKinectBtn); colorKinectBtn.Click += new RoutedEventHandler(colorKinectBtn_Click); } if (index == 1) { BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(@"Images\w_and_b.jpg", UriKind.Relative); bi.EndInit(); bwKinectBtn = new KinectTileButton { Background = new ImageBrush(bi), Tag = "TAG", Label = "B&W Image", Height = 250, Width = 272 }; this.wrapPanel.Children.Add(bwKinectBtn); bwKinectBtn.Click += new RoutedEventHandler(bwKinectBtn_Click); } if (index == 2) { BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(@"Images\infrared.png", UriKind.Relative); bi.EndInit(); infraredKinectBtn = new KinectTileButton { Background = new ImageBrush(bi), Label = "Infrared Image", Height = 250, Width = 272 }; this.wrapPanel.Children.Add(infraredKinectBtn); infraredKinectBtn.Click += new RoutedEventHandler(infraredKinectBtn_Click); } if (index == 3) { BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(@"Images\audio2.jpg", UriKind.Relative); bi.EndInit(); audioKinectBtn = new KinectTileButton { Background = new ImageBrush(bi), HorizontalAlignment = HorizontalAlignment.Right, Tag = "TAG", Label = "Record Audio", Height = 250, Width = 272 }; this.wrapPanel.Children.Add(audioKinectBtn); audioKinectBtn.Click += new RoutedEventHandler(audioKinectBtn_Click); } if (index == 4) { BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(@"Images\settings.png", UriKind.Relative); bi.EndInit(); settingsKinectBtn = new KinectTileButton { Background = new ImageBrush(bi), HorizontalAlignment = HorizontalAlignment.Right, Tag = "TAG", Label = "Record Audio", Height = 250, Width = 272 }; this.wrapPanel.Children.Add(settingsKinectBtn); settingsKinectBtn.Click += new RoutedEventHandler(settingsKinectBtn_Click); } } // Bind listner to scrollviwer scroll position change, and check scroll viewer position //this.UpdatePagingButtonState(); //scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); }