Example #1
0
        private void UniformGrid_Click(object sender, RoutedEventArgs e)
        {
            var             button          = (Button)e.OriginalSource;
            DataBase        dataBase        = button.DataContext as DataBase;
            DataExecuteBase dataExecuteBase = (DataExecuteBase)dataBase;

            if (dataExecuteBase.Parametrs != null)
            {
                MainWindow.Instance.ControlsBasicsWindow.Topmost = false;

                Process game = new Process();
                game.StartInfo.FileName  = dataExecuteBase.Parametrs[0];
                game.EnableRaisingEvents = true;
                game.Exited += (InnerSender, InnerE) => { MainWindow.Instance.UI(() => { MainWindow.Instance.ControlsBasicsWindow.Topmost = true; }); };
                game.Start();

                ButtonAutomationPeer peer       = new ButtonAutomationPeer(MainWindow.Instance.backButton);
                IInvokeProvider      invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                invokeProv.Invoke();
            }
        }
Example #2
0
        /// <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;
            }
        }