示例#1
0
        private void InitSlaveInformationMenu()
        {
            // Initialize the Explorer context menu
            mnuItmInformation.MenuItems.Clear();

            mnuItmInformation.MenuItems.Add(String.Concat("Server:", MOG_ControllerSystem.GetServerComputerName()));
            mnuItmInformation.MenuItems.Add(String.Concat("ServerIp:", MOG_ControllerSystem.GetServerComputerIP()));
            mnuItmInformation.MenuItems.Add(String.Concat("NetworkID:", MOG_ControllerSystem.GetCommandManager().GetNetwork().GetID()));
            mnuItmInformation.MenuItems.Add(String.Concat("Commands:", Convert.ToString(MOG_ControllerSystem.GetCommandManager().GetCommandsList().Count)));
        }
示例#2
0
        public void Refresh()
        {
            try
            {
                if (mainForm.ConnectionsListView.Visible)
                {
                    mainForm.ConnectionsListView.Items.Clear();
                }

                if (mainForm.ConnectionManagerCommandsListView.Visible)
                {
                    mainForm.ConnectionManagerCommandsListView.Items.Clear();
                }

                // Make sure we add the server first
                ListViewItem serverItem = new ListViewItem();
                serverItem.Text = MOG_ControllerSystem.GetServerComputerName();
                serverItem.SubItems.Add(MOG_ControllerSystem.GetServerComputerIP());
                serverItem.SubItems.Add("1");
                serverItem.SubItems.Add("Server");
                serverItem.SubItems.Add("N/A");
                serverItem.SubItems.Add("1");
                serverItem.ForeColor  = Color.OrangeRed;
                serverItem.ImageIndex = (int)MOGImagesImages.SERVER;
                mainForm.ConnectionsListView.Items.Add(serverItem);

                mGroups.UpdateGroupItem(mainForm.ConnectionsListView, serverItem, "Type");

                MOG_ControllerSystem.RequestActiveConnections();
                MOG_ControllerSystem.RequestActiveCommands();
            }
            catch (Exception e)
            {
                MOG_Prompt.PromptMessage("Refresh Connection View", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
                return;
            }

            RefreshMerging();
            RefreshPosting();
            RefreshLateResolvers();
        }
示例#3
0
        public string RefreshConnectionToolText()
        {
            // get SQL server and MOG Repository drive mapping info
            string connectionString = MOG_ControllerSystem.GetDB().GetConnectionString();
            string sqlServerName    = "NONE";

            if (connectionString.ToLower().IndexOf("data source") != -1)
            {
                // parse out sql server name
                //sqlServerName = connectionString.Substring(connectionString.ToLower().IndexOf("data source=")+13,
                string[] substrings = connectionString.Split(";".ToCharArray());

                // look for correct part o' the connection string
                foreach (string substring in substrings)
                {
                    if (substring.ToLower().StartsWith("data source="))
                    {
                        sqlServerName = substring.Substring(substring.IndexOf("=") + 1).ToUpper();
                    }
                }
            }

            try
            {
                // get MOG repository drive and mapping info
                string mogDrive       = MOG_ControllerSystem.GetSystemRepositoryPath();
                char   mogDriveLetter = Path.GetPathRoot(mogDrive)[0];
                string mogDriveTarget = new NetworkDriveMapper().GetDriveMapping(mogDriveLetter);

                // Connected to X-SERVER @IP 192.168.5.5; SQL Server: JBIANCHI; MOG Repository M: mapped to \\GX\MOG
                //ConnectionString=Packet size=4096;integrated security=SSPI;data source=NEMESIS;persist security info=False;initial catalog=mog16;

                return(string.Concat(MOG_ControllerSystem.GetServerComputerName(), " SQL SERVER: ", sqlServerName));
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("RefreshConnectionToolText", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL);
            }

            return("Connected");
        }
示例#4
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.");
            }
        }