Ejemplo n.º 1
0
 public void KillManager(WccManager manager)
 {
     string[] result = PmonQuery("##SINGLE_MGR:KILL " + manager.PmonNumber + " \n");
     if (result != null)
     {
         Debugger.Write(ProjectAlias + ". Принудительный останов менеджера " + manager.ManagerName + " (" + manager.Number + "): " + result[0]);
     }
 }
Ejemplo n.º 2
0
 public void StopManager(WccManager manager)
 {
     string[] result = PmonQuery("##SINGLE_MGR:STOP " + manager.PmonNumber + " \n");
     if (result != null)
     {
         Debugger.Write(ProjectAlias + ". Останов менеджера " + manager.ManagerName + " (" + manager.Number + "): " + result[0]);
     }
 }
Ejemplo n.º 3
0
 public void RemoveManager(WccManager manager)
 {
     string[] result = PmonQuery("##SINGLE_MGR:DEL " + manager.PmonNumber + " \n");
     if (result != null)
     {
         Debugger.Write(ProjectAlias + ". Удаление менеджера " + manager.ManagerName + ": " + result[0]);
     }
     RefreshProjectState();
 }
Ejemplo n.º 4
0
 public void Replace(WccManager manager)
 {
     /*if (this.Id != manager.Id)
      * {
      *  this.ManagerProcess = manager.ManagerProcess;
      * } */
     this.ProjectAlias = manager.ProjectAlias;
     this.MachineName  = manager.MachineName;
     this.Id           = manager.Id;
     this.Memory       = manager.Memory;
     this.ManagerName  = manager.ManagerName;
     this.Description  = manager.Description;
     this.Options      = manager.Options;
     this.State        = manager.State;
     this.Number       = manager.Number;
     this.PmonNumber   = manager.PmonNumber;
 }
Ejemplo n.º 5
0
 private void OnManagerStateChanged(WccManager manager)
 {
     if (dataGridView.InvokeRequired)
     {
         ManagerEventHandler d = new ManagerEventHandler(OnManagerStateChanged);
         dataGridView.Invoke(d, new object[] { manager });
     }
     else
     {
         if (dataGridView.Rows.Count > 0)
         {
             DataGridViewRow row = dataGridView.Rows[manager.PmonNumber];
             //row.Cells[0].Value = manager.Id;
             row.Cells["Память"].Value = manager.Memory.ToString();
             //row.Cells[2].Value = manager.ManagerName;
             //row.Cells[3].Value = manager.Options;
         }
         dataGridView.Update();
     }
 }
Ejemplo n.º 6
0
 private void ManagerControlPanelStateChange(WccManager manager)
 {
     if (this.SelectedProject.IsStarted && manager.PmonNumber != 0)
     {
         if (manager.State > 0)
         {
             this.btnStartManager.Enabled = false;
             this.btnStopManager.Enabled  = true;
             this.btnKillManager.Enabled  = true;
         }
         else
         {
             this.btnStartManager.Enabled = true;
             this.btnStopManager.Enabled  = false;
             this.btnKillManager.Enabled  = false;
         }
     }
     else
     {
         this.btnStartManager.Enabled = false;
         this.btnStopManager.Enabled  = false;
         this.btnKillManager.Enabled  = false;
     }
 }
Ejemplo n.º 7
0
        private void dataGridView_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            WccManager manager = (WccManager)dataSource[e.RowIndex];

            ManagerControlPanelStateChange(manager);
        }
Ejemplo n.º 8
0
        private int GetProjectInfo()
        {
            string[] resultSTATI = PmonQuery("##MGRLIST:STATI\n");
            Thread.Sleep(100);
            string[] resultLIST = PmonQuery("##MGRLIST:LIST\n");

            if (resultSTATI == null || resultLIST == null)
            {
                return(-1);
            }

            int STATIcount = Convert.ToInt32(!string.IsNullOrEmpty(resultSTATI[0]) ? resultSTATI[0].Replace("LIST:", "") : "0");
            int LISTcount  = Convert.ToInt32(!string.IsNullOrEmpty(resultLIST[0]) ? resultLIST[0].Replace("LIST:", "") : "0");

            if (LISTcount != STATIcount || resultSTATI.Length < STATIcount || resultLIST.Length < LISTcount)
            {
                return(0);
            }

            int lastActNum           = 0;
            int startedManagersCount = 0;

            for (int i = 1; i <= LISTcount; i++)
            {
                string[] tempSTATI = resultSTATI[i].Split(';');
                string[] tempLIST  = resultLIST[i].Split(';');

                WccManager manager = new WccManager();
                manager.MachineName  = this.MachineName;
                manager.ProjectAlias = this.ProjectAlias;
                manager.ManagerName  = tempLIST[0];
                manager.Id           = Convert.ToInt32(tempSTATI[1]);
                manager.Options      = tempLIST[5];
                manager.State        = Convert.ToInt32(tempSTATI[0]);
                manager.Number       = Convert.ToInt32(tempSTATI[4]);
                manager.Mode         = (WccManager.ManagerMode)Convert.ToInt32(tempSTATI[2]);
                //Процесс с идентификатором -1 не выполняется.
                if (manager.Id > 0 && manager.State > 0)
                {
                    startedManagersCount++;
                }
                manager.PmonNumber = i - 1;
                lastActNum         = i;

                if (!this.Managers.ContainsKey(manager.PmonNumber))
                {
                    this.Managers.Add(manager.PmonNumber, manager);
                }
                else
                {
                    this.Managers[manager.PmonNumber].Replace(manager);
                }
            }

            if (startedManagersCount > 1)
            {
                this.IsStarted = true;
            }
            else
            {
                this.IsStarted = false;
            }

            if (this.Managers.Count > lastActNum)
            {
                for (int i = lastActNum; i <= this.Managers.Count; i++)
                {
                    this.Managers.Remove(lastActNum);
                }
            }

            if (this.ConnectionState == WccConnectionState.Connected)
            {
                string[] result = PmonQuery("##PROJECT: \n");
                if (result != null)
                {
                    this.ProjectName = result[0];
                }
            }

            return(1);
        }
Ejemplo n.º 9
0
 public void InsertManager(WccManager manager)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 10
0
 public void AppendManager(WccManager manager)
 {
     throw new NotImplementedException();
 }