Exemple #1
0
        private static string getHostName(serverControl serv)
        {
            IPAddress   hostIPAddress = IPAddress.Parse(serv.objectAddress);
            IPHostEntry hostInfo      = Dns.GetHostEntry(hostIPAddress);

            return(hostInfo.HostName);
        }
Exemple #2
0
        private void перезагрузитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            serverControl serv = contextMenuStrip1.SourceControl as serverControl;

            beforeSending(serv, sender);
            // shutdown.exe", "-r -t 0
            //Process p = Process.Start(@"cmd.exe", @"/c shutdown /r /m " + hN + " & pause");
        }
Exemple #3
0
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {   // Параллельный поток для отдельного хоста (ускорение прохода по списку хостов).
            int[] speeds = { speed1, speed2, speed3 };
            System.ComponentModel.BackgroundWorker worker;
            worker = (System.ComponentModel.BackgroundWorker)sender;
            var             myArgs = e.Argument as MyWorkerArgs;
            serverControl   serv   = myArgs.srv;
            networkProtocol np     = myArgs.netP;

            workState    = working;
            np.workState = working;
            np.parallelPingServers(worker, e, speeds, serv);
        }
Exemple #4
0
        private void deleteHostFromList(serverControl srv)
        {
            string            message = "Вы уверены, что хотите удалить этот элемент?";
            string            caption = "Удалить " + srv.objectName;
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;

            result = MessageBox.Show(message, caption, buttons);
            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                srv.Dispose();
                servers.Remove(srv);
            }
            drawServers();
        }
Exemple #5
0
        private void addingServ(List <serverControl> servL, string n, string a)
        {
            // добавление уникального хоста в список для проверки
            serverControl tempS = new serverControl(n, a);

            if (!servL.Exists(x => x.objectAddress == a))
            {
                tempS.ContextMenuStrip = contextMenuStrip1;
                servL.Add(tempS);
            }
            else
            {   // сообщение о неуникальности
                tempS = servL.Find(x => x.objectAddress == a);
                MessageBox.Show("Уже существует хост с таким адресом. В программе имеет имя: " + tempS.objectName);
            }
        }
Exemple #6
0
        public void addCommandButton1(object sender, EventArgs e)
        {
            //
            ToolStripMenuItem cms = sender as ToolStripMenuItem;
            ContextCommands   cmd = new ContextCommands();
            //MessageBox.Show(cms.Name);
            serverControl serv = contextMenuStrip1.SourceControl as serverControl;

            cmd = commands.Find(x => x.commTS == cms);
            //cmd = sender as ContextCommands;

            MessageBox.Show(cmd.commName);
            if (cmd.Multi)
            {
                sendCommand(serv.objectAddress, cmd.commProgramm, cmd.commLines);
            }
            else
            {
                sendCommand(serv.objectAddress, cmd.commProgramm, cmd.commParams);
            }
        }
Exemple #7
0
        private void backgroundWorker2_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            networkProtocol.CurrentState state = (networkProtocol.CurrentState)e.UserState;
            toolStripProgressBar1.Value = e.ProgressPercentage;
            string isOn;

            if (state.isOnline)
            {
                isOn = "online";
            }
            else
            {
                isOn = "OFFLINE!!!";
            }
            toolStripStatusLabel2.Text = state.address + " is " + isOn + "...";
            toolStripStatusLabel1.Text = "Working. ";
            serverControl server = servers.Find(x => x.objectAddress == state.address);

            if (server.objectStatus != state.isOnline)
            {
                server.objectStatus = state.isOnline;
            }
        }
Exemple #8
0
 public MyWorkerArgs(serverControl server, networkProtocol np)
 {
     srv  = server;
     netP = np;
 }
Exemple #9
0
        private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            serverControl serv = contextMenuStrip1.SourceControl as serverControl;

            deleteHostFromList(serv);
        }
Exemple #10
0
 private void addingServ(List<serverControl> servL, string n, string a)
 {
     // добавление уникального хоста в список для проверки
     serverControl tempS = new serverControl(n, a);
     if (!servL.Exists(x => x.objectAddress == a))
     {
         tempS.ContextMenuStrip = contextMenuStrip1;
         servL.Add(tempS);
     }
     else
     {   // сообщение о неуникальности
         tempS = servL.Find(x => x.objectAddress == a);
         MessageBox.Show("Уже существует хост с таким адресом. В программе имеет имя: " + tempS.objectName);
     }
 }
Exemple #11
0
 private void beforeSending(serverControl serv, object sender)
 {
     sendCommand(serv.objectAddress, "shutdown.exe", "-r -t 0");
 }
Exemple #12
0
 private void beforeSending(serverControl serv, object sender)
 {
     sendCommand(serv.objectAddress, "shutdown.exe", "-r -t 0");
 }
Exemple #13
0
        private void переименоватьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            serverControl serv = contextMenuStrip1.SourceControl as serverControl;

            serv.editMode = true;
        }
Exemple #14
0
 private static string getHostName(serverControl serv)
 {
     IPAddress hostIPAddress = IPAddress.Parse(serv.objectAddress);
     IPHostEntry hostInfo = Dns.GetHostEntry(hostIPAddress);
     return hostInfo.HostName;
 }
Exemple #15
0
 // выключатель компонента.
 void switchOff(serverControl sC)
 {
     sC.objectStatus = false;
 }
Exemple #16
0
 public MyWorkerArgs(serverControl server, networkProtocol np)
 {
     srv = server;
     netP = np;
 }
Exemple #17
0
 // выключатель компонента.
 void switchOff(serverControl sC)
 {
     sC.objectStatus = false;
 }
Exemple #18
0
 private void deleteHostFromList(serverControl srv)
 {
     string message = "Вы уверены, что хотите удалить этот элемент?";
     string caption = "Удалить " + srv.objectName;
     MessageBoxButtons buttons = MessageBoxButtons.YesNo;
     DialogResult result;
     result = MessageBox.Show(message, caption, buttons);
     if (result == System.Windows.Forms.DialogResult.Yes)
     {
         srv.Dispose();
         servers.Remove(srv);
     }
     drawServers();
 }
Exemple #19
0
 public MyEvArgs(object argument, serverControl srv)
     : base(argument)
 {
     Serv = srv;
 }
Exemple #20
0
 public MyEvArgs(object argument, serverControl srv)
     : base(argument)
 {
     Serv = srv;
 }