Esempio n. 1
0
        /// <Summary>
        /// Launch the Nova GUI to play a turn for a give player.
        /// </Summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param>
        private void PlayerList_DoubleClick(object sender, EventArgs e)
        {
            // On occasion this fires but SelectedItems is empty. Ignore and let the user re-click. See issue #2974019.
            if (playerList.SelectedItems.Count == 0)
            {
                return;
            }

            // Find what was clicked
            string raceName = playerList.SelectedItems[0].SubItems[1].Text;

            try
            {
                // Launch the nova GUI
                CommandArguments args = new CommandArguments();
                args.Add(CommandArguments.Option.RaceName, raceName);
                args.Add(CommandArguments.Option.Turn, serverState.TurnYear);
                args.Add(CommandArguments.Option.IntelFileName, Path.Combine(serverState.GameFolder, raceName + Global.IntelExtension));

                Nova.WinForms.Gui.NovaGUI gui = new Nova.WinForms.Gui.NovaGUI(args.ToArray());
                gui.Show();
            }
            catch (Exception ex)
            {
                Report.Error("NovaConsole.cs : PlayerList_DoubleClick() - Failed to launch GUI. Details:" +
                             Environment.NewLine + ex.ToString());
            }
        }
Esempio n. 2
0
        /// <Summary>
        /// When the 'Continue Game' button is pressed, continue the last opened game.
        /// </Summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param>
        private void ContinueGameButton_Click(object sender, EventArgs e)
        {
            // start the GUI
            if (this.clientStateFile != null)
            {
                CommandArguments args = new CommandArguments();
                args.Add(CommandArguments.Option.GuiSwitch);
                args.Add(CommandArguments.Option.StateFileName, this.clientStateFile);

                try
                {
                    Nova.WinForms.Gui.NovaGUI gui = new Nova.WinForms.Gui.NovaGUI(args.ToArray());
                    gui.Show();
                }
                catch
                {
                    Report.Error("Failed to launch GUI.");
                }
            }

            // start the server
            if (this.serverStateFile != null)
            {
                try
                {
                    Nova.WinForms.Console.NovaConsole novaConsole = new Nova.WinForms.Console.NovaConsole();
                    novaConsole.Show();
                    return;
                }
                catch
                {
                    Report.FatalError("Unable to launch Console.");
                }
            }
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            string firstArgument = args.FirstOrDefault();

            string[] coreArgs = args.Skip(1).ToArray();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            switch (firstArgument)
            {
            case CommandArguments.Option.ConsoleSwitch:
                Application.Run(new WinForms.Console.NovaConsole());
                break;

            case CommandArguments.Option.ComponentEditorSwitch:
                WinForms.ComponentEditor.Program.Main();
                break;

            case CommandArguments.Option.RaceDesignerSwitch:
                WinForms.RaceDesigner.RaceDesignerForm.Main();
                break;

            case CommandArguments.Option.GuiSwitch:
                Nova.WinForms.Gui.NovaGUI gui = new Nova.WinForms.Gui.NovaGUI(args);
                Application.Run(gui);
                break;

            case CommandArguments.Option.NewGameSwitch:
                Application.Run(new WinForms.NewGameWizard());
                break;

            case CommandArguments.Option.AiSwitch:
                Ai.Program.Main(coreArgs);
                break;

            case CommandArguments.Option.LauncherSwitch:
            case null:
                Application.Run(new Nova.WinForms.Launcher.NovaLauncher());
                break;

            case CommandArguments.Option.HelpSwitch:
                ShowHelpDialog(null, false);
                break;

            default:
                ShowErrorDialog();
                break;
            }
        }