Inheritance: System.Windows.Forms.Form
コード例 #1
0
 /// <summary>
 /// Displays the Install / Program configuration form
 /// </summary>
 /// <returns>Returns whether the config was saved, false otherwise</returns>
 public static bool ShowInstallForm()
 {
     using (InstallForm IS = new InstallForm())
     {
         return(IS.ShowDialog() == DialogResult.OK);
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: JohannesHei/ControlCenter
        /// <summary>
        /// Constructor. Initializes and Displays the Applications main GUI
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            // Set instance
            Instance = this;

            // Check for needed settings upgrade
            if (!Config.SettingsUpdated)
            {
                Config.Upgrade();
                Config.SettingsUpdated = true;
                Config.Save();
            }

            // If this is the first run, Get client and server install paths
            if (String.IsNullOrWhiteSpace(Config.ServerPath) || !File.Exists(Path.Combine(Config.ServerPath, "bf2_w32ded.exe")))
            {
                InstallForm IS = new InstallForm();
                if (IS.ShowDialog() != DialogResult.OK)
                {
                    this.Load += new EventHandler(CloseOnStart);
                    return;
                }
            }

            // Make sure documents folder exists
            if (!Directory.Exists(Paths.DocumentsFolder))
                Directory.CreateDirectory(Paths.DocumentsFolder);

            // Backups folder
            if(!Directory.Exists(Path.Combine(Paths.DocumentsFolder, "Backups")))
                Directory.CreateDirectory(Path.Combine(Paths.DocumentsFolder, "Backups"));

            // Create ErrorLog file
            ErrorLog = new LogWritter(Path.Combine(Root, "Logs", "Error.log"), 3000);

            // Load installed Mods. If there is an error, a messagebox will be displayed,
            // and the form closed automatically
            if (!LoadModList())
                return;

            // Set BF2Statistics Install Status
            SetInstallStatus();

            // Get snapshot counts
            CountSnapshots();

            // Check if the server is already running
            CheckServerProcess();

            // Try to access the hosts file
            DoHOSTSCheck();

            // Load Cross Session Settings
            ParamBox.Text = Config.ClientParams;
            GlobalServerSettings.Checked = Config.UseGlobalSettings;
            ShowConsole.Checked = Config.ShowServerConsole;
            MinimizeConsole.Checked = Config.MinimizeServerConsole;
            IgnoreAsserts.Checked = Config.ServerIgnoreAsserts;
            FileMoniter.Checked = Config.ServerFileMoniter;
            GpcmAddress.Text = (!String.IsNullOrWhiteSpace(Config.LastLoginServerAddress)) ? Config.LastLoginServerAddress : "localhost";
            Bf2webAddress.Text = (!String.IsNullOrWhiteSpace(Config.LastStatsServerAddress)) ? Config.LastStatsServerAddress : "localhost";
            labelTotalWebRequests.Text = Config.TotalASPRequests.ToString();

            // If we dont have a client path, disable the Launch Client button
            LaunchClientBtn.Enabled = (!String.IsNullOrWhiteSpace(Config.ClientPath) && File.Exists(Path.Combine(Config.ClientPath, "bf2.exe")));

            // Register for ASP events
            ASPServer.Started += new EventHandler(ASPServer_OnStart);
            ASPServer.Stopped += new EventHandler(ASPServer_OnShutdown);
            ASPServer.RequestRecieved += new AspRequest(ASPServer_ClientConnected);
            Snapshot.SnapshotProccessed += new SnapshotProccessed(Snapshot_SnapshotProccessed);
            ASP.Requests.SnapshotPost.SnapshotReceived += new SnapshotRecieved(SnapshotPost_SnapshotReceived);

            // Register for Login server events
            LoginServer.OnStart += new StartupEventHandler(LoginServer_OnStart);
            LoginServer.OnShutdown += new ShutdownEventHandler(LoginServer_OnShutdown);
            LoginServer.OnUpdate += new EventHandler(LoginServer_OnUpdate);

            // Add administrator title to program title bar
            if (IsAdministrator)
                this.Text += " (Administrator)";

            // Set server tooltips
            Tipsy.SetToolTip(LoginStatusPic, "Login server is currently offline.");
            Tipsy.SetToolTip(AspStatusPic, "Asp server is currently offline");
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: JohannesHei/ControlCenter
 /// <summary>
 /// Setup Button Click Event. Relaunches the setup client/server paths screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SetupBtn_Click(object sender, EventArgs e)
 {
     InstallForm IS = new InstallForm();
     IS.ShowDialog();
 }
コード例 #4
0
        /// <summary>
        /// Setup Button Click Event. Relaunches the setup client/server paths screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SetupBtn_Click(object sender, EventArgs e)
        {
            InstallForm IS = new InstallForm();
            IS.ShowDialog();

            // Re-Init server if we need to
            if (Config.ServerPath != BF2Server.RootPath)
                BF2Server.Load(Config.ServerPath);
        }
コード例 #5
0
 /// <summary>
 /// Displays the Install / Program configuration form
 /// </summary>
 /// <returns>Returns whether the config was saved, false otherwise</returns>
 public static bool ShowInstallForm()
 {
     using (InstallForm IS = new InstallForm())
     {
         return (IS.ShowDialog() == DialogResult.OK);
     }
 }