Example #1
0
        public static bool SetOffline(MogMainForm mainForm, bool offline)
        {
            if (offline)
            {
                // TODO KIER How do we go offline now?

//				string targetPath = string.Concat(MOG_ControllerProject.GetGameData().GetGameDataPath(), "\\MOG\\Offline");
//				if (MOG_ControllerProject.GetProject().Offline(targetPath))
//				{
//					// Disconnect from the server
//					MOG_ControllerSystem.GoOffline();
//
//					if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile(targetPath, "", "")))
//					{
//						// Reload the project
//						MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName());
//
//						// Set our gui
//						guiStartup.ConnectionStatus(mainForm, false);
//					}
//				}
            }
            else
            {
                // Connect to the server
                MOG_ControllerSystem.GoOnline();

                if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile()))
                {
                    // Reload the project
                    MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName());

                    // Login user
                    MOG_ControllerProject.LoginUser(MOG_ControllerProject.GetUser().GetUserName());

                    // Set our gui
                    guiStartup.ConnectionStatus(mainForm, true);
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Set the connection status in the status bar
        /// </summary>
        /// <param name="connected"></param>
        public static void ConnectionStatus(MogMainForm mainForm, bool connected)
        {
            bool problemLoadingIcon = false;

            if (connected)
            {
                if (mainForm.StatusBarImageList.Images.Count > 0)
                {
                    Bitmap home = new Bitmap(mainForm.StatusBarImageList.Images[0]);
                    mainForm.MOGStatusBarConnectionStatusBarPanel.Icon = System.Drawing.Icon.FromHandle(home.GetHicon());
                }
                else
                {
                    problemLoadingIcon = true;
                }
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text = "Connected";

                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = mainForm.RefreshConnectionToolText();
                MOG_ControllerSystem.GoOnline();
            }
            else
            {
                if (mainForm.StatusBarImageList.Images.Count > 1)
                {
                    Bitmap home = new Bitmap(mainForm.StatusBarImageList.Images[1]);
                    mainForm.MOGStatusBarConnectionStatusBarPanel.Icon = System.Drawing.Icon.FromHandle(home.GetHicon());
                }
                else
                {
                    problemLoadingIcon = true;
                }
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text        = "Disconnected";
                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = string.Concat("Could not connect to ", MOG_ControllerSystem.GetServerComputerName(), " IP:", MOG_ControllerSystem.GetServerComputerIP());
                MOG_ControllerSystem.GoOffline();
            }

            if (problemLoadingIcon)
            {
                MOG_Prompt.PromptMessage("Project Error", "Programmer: Please rebuild MOG_Client to have all the appropriate *.resx "
                                         + "\r\nfiles correctly included in this project.");
            }
        }