Example #1
0
        /// <summary>
        /// Event handler for when a game menu item is selected.
        /// </summary>
        void OnLaunch(object sender, PlayerIndexEventArgs e)
        {
            // Launch Game via Steam URL
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = (((ShortcutMenuEntry)sender).ShortcutPath);
            process.StartInfo.UseShellExecute = true;
            process.StartInfo.RedirectStandardOutput = false;

            try
            {
                process.Start();
            }
            catch (Exception exception)
            {
                MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(exception.Message + "\n(" + process.StartInfo.FileName + ")");
                confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
                ScreenManager.AddScreen(confirmExitMessageBox, e.PlayerIndex);
            }
        }
Example #2
0
 /// <summary>
 /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler.
 /// </summary>
 protected void OnCancel(object sender, PlayerIndexEventArgs e)
 {
     OnCancel(e.PlayerIndex);
 }
Example #3
0
 /// <summary>
 /// When the user closes the main menu, hide the window.
 /// </summary>
 private void OnMinimizeToTray(object sender, PlayerIndexEventArgs e)
 {
     ((Game1)ScreenManager.Game).SendToBack();
 }
Example #4
0
 /// <summary>
 /// Event handler for when the user selects ok on the "are you sure
 /// you want to exit" message box.
 /// </summary>
 void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.Game.Exit();
 }