private void TrainingItemButtonClick(object sender, RoutedEventArgs e) { var button = (Button)e.OriginalSource; TrainingDataItem trainingDataItem = button.DataContext as TrainingDataItem; if (trainingDataItem != null && trainingDataItem.NavigationPage != null) { trainingNavigationRegion.Content = Activator.CreateInstance(trainingDataItem.NavigationPage); } else { var selectionDisplay = new SelectionDisplay(button.Content as string); this.trainingRegionGrid.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. e.Handled = true; } }
/// <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); // 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 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) { UIInvoked(); var button = (Button)e.OriginalSource; DataBase dataBase = button.DataContext as DataBase; if (dataBase != null) { if (dataBase.Title == "Видео") { CreateData.Instance.GetAllVideos(); } else if (dataBase.Title == "Игры") { CreateData.Instance.GetGames(); } else if (dataBase.Title == "Расписание") { CreateData.Instance.GetAllTimetable(); } if (dataBase is DataPageBase) { DataPageBase dataPageBase = (DataPageBase)dataBase; if (dataPageBase.NavigationPage != null) { history.Add(dataPageBase.UniqueId); backButton.Visibility = Visibility.Visible; navigationRegion.Content = Activator.CreateInstance(dataPageBase.NavigationPage, dataPageBase.Parametrs); } } if (dataBase is DataGroupBase) { DataGroupBase dataGroupBase = (DataGroupBase)dataBase; if (dataGroupBase.NewGroup != null) { history.Add(dataGroupBase.NewGroup); backButton.Visibility = Visibility.Visible; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; var type = DataSource.GetGroup(dataGroupBase.NewGroup).TypeGroup; itemsControl.ItemTemplate = (DataTemplate)FindResource(type + "Template"); itemsControl.ItemsSource = DataSource.GetGroup(dataGroupBase.NewGroup); } } if (dataBase is DataExecuteBase) { DataExecuteBase dataExecuteBase = (DataExecuteBase)dataBase; if (dataExecuteBase.Parametrs != null) { Process.Start(dataExecuteBase.Parametrs[0]); ButtonAutomationPeer peer = new ButtonAutomationPeer(backButton); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } } } 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; } }