コード例 #1
0
        /// <summary>
        /// the button that loads the high scores screen. plays a sound when the screen loads.. hides the main window, and shows the high score window dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdHighScores_Click(object sender, RoutedEventArgs e)
        {
            SoundPlayer answerRight = new SoundPlayer("highScores.wav");

            answerRight.Play();
            Grid             mainWindowGrid = (Grid)((Button)sender).Parent;
            MainWindow       mw             = (MainWindow)mainWindowGrid.Parent;
            HighScoresWindow hsWindow       = new HighScoresWindow();

            hsWindow.DataContext = ((MainWindowViewModel)mw.DataContext).HighScoreWindowVM;
            mw.Hide();
            hsWindow.ShowDialog();
            mw.Show();
        }
コード例 #2
0
        /// <summary>
        /// The button that allows the user to add or update the current user playing the program. plays a sound when the user enters the window. hides the main window and
        /// shows the data entry window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdUserInfo_Click(object sender, RoutedEventArgs e)
        {
            SoundPlayer answerRight = new SoundPlayer("addOrUpdate.wav");

            answerRight.Play();
            Grid                mainWindowGrid = (Grid)((Button)sender).Parent;
            MainWindow          mw             = (MainWindow)mainWindowGrid.Parent;
            EnterUserDataWindow dataWindow     = new EnterUserDataWindow();

            dataWindow.DataContext = ((MainWindowViewModel)mw.DataContext).EnterUserDataVM;
            mw.Hide();
            dataWindow.ShowDialog();
            mw.Show();
            mw.BringIntoView();
        }
コード例 #3
0
        /// <summary>
        /// the button that loads the game selection menu. plays a sound when the user gets to choose which game they want to play
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPlayGame_Click(object sender, RoutedEventArgs e)
        {
            SoundPlayer simpleSound = new SoundPlayer("Breathing.wav");

            simpleSound.Play();
            Grid                 mainWindowGrid = (Grid)((Button)sender).Parent;
            MainWindow           mw             = (MainWindow)mainWindowGrid.Parent;
            SelectGameTypeWindow sgt            = new SelectGameTypeWindow();

            sgt.DataContext = ((MainWindowViewModel)mw.DataContext).SelectGameTypeVM;
            mw.Hide();
            sgt.ShowDialog();

            mw.Show();
            mw.BringIntoView();
        }