Beispiel #1
0
        private void addAgentService(AgentService agentService)
        {
            try
            {
                agentService.init();
                agents.Add(agentService);
            }
            catch (IOException)
            {
                ChangeText("Błąd strumienia wejścia/wyjścia");
            }
            Thread service = new Thread(new ThreadStart(agentService.Run));

            service.Start();
        }
Beispiel #2
0
        public void removeAgentService(AgentService agentService)
        {
            ChangeText("!!!!!!!!!!!! AWARIA WĘZŁA " + agentService.getId().ToString() + " !!!!!!!!!!!!");
            if (agentService.getId() == 1)
            {
                w1_in.Invoke((MethodInvoker) delegate { w1_in.Enabled = false; });
                w1_out.Invoke((MethodInvoker) delegate { w1_out.Enabled = false; });
                w1_f1.Invoke((MethodInvoker) delegate { w1_f1.Enabled = false; });
                w1_f2.Invoke((MethodInvoker) delegate { w1_f2.Enabled = false; });
                w1_f1conv.Invoke((MethodInvoker) delegate { w1_f1conv.Enabled = false; });
                w1_f2conv.Invoke((MethodInvoker) delegate { w1_f2conv.Enabled = false; });
            }
            else if (agentService.getId() == 2)
            {
                w2_in.Invoke((MethodInvoker) delegate { w2_in.Enabled = false; });
                w2_out.Invoke((MethodInvoker) delegate { w2_out.Enabled = false; });
                w2_f1.Invoke((MethodInvoker) delegate { w2_f1.Enabled = false; });
                w2_f2.Invoke((MethodInvoker) delegate { w2_f2.Enabled = false; });
                w2_f1conv.Invoke((MethodInvoker) delegate { w2_f1conv.Enabled = false; });
                w2_f2conv.Invoke((MethodInvoker) delegate { w2_f2conv.Enabled = false; });
            }
            else if (agentService.getId() == 3)
            {
                w3_in.Invoke((MethodInvoker) delegate { w3_in.Enabled = false; });
                w3_out.Invoke((MethodInvoker) delegate { w3_out.Enabled = false; });
                w3_f1.Invoke((MethodInvoker) delegate { w3_f1.Enabled = false; });
                w3_f2.Invoke((MethodInvoker) delegate { w3_f2.Enabled = false; });
                w3_f1conv.Invoke((MethodInvoker) delegate { w3_f1conv.Enabled = false; });
                w3_f2conv.Invoke((MethodInvoker) delegate { w3_f2conv.Enabled = false; });
            }
            else if (agentService.getId() == 4)
            {
                w4_in.Invoke((MethodInvoker) delegate { w4_in.Enabled = false; });
                w4_out.Invoke((MethodInvoker) delegate { w4_out.Enabled = false; });
                w4_f1.Invoke((MethodInvoker) delegate { w4_f1.Enabled = false; });
                w4_f2.Invoke((MethodInvoker) delegate { w4_f2.Enabled = false; });
                w4_f1conv.Invoke((MethodInvoker) delegate { w4_f1conv.Enabled = false; });
                w4_f2conv.Invoke((MethodInvoker) delegate { w4_f2conv.Enabled = false; });
            }
            else if (agentService.getId() == 5)
            {
                w5_in.Invoke((MethodInvoker) delegate { w5_in.Enabled = false; });
                w5_out.Invoke((MethodInvoker) delegate { w5_out.Enabled = false; });
                w5_f1.Invoke((MethodInvoker) delegate { w5_f1.Enabled = false; });
                w5_f2.Invoke((MethodInvoker) delegate { w5_f2.Enabled = false; });
                w5_f1conv.Invoke((MethodInvoker) delegate { w5_f1conv.Enabled = false; });
                w5_f2conv.Invoke((MethodInvoker) delegate { w5_f2conv.Enabled = false; });
            }
            else if (agentService.getId() == 6)
            {
                w6_in.Invoke((MethodInvoker) delegate { w6_in.Enabled = false; });
                w6_out.Invoke((MethodInvoker) delegate { w6_out.Enabled = false; });
                w6_f1.Invoke((MethodInvoker) delegate { w6_f1.Enabled = false; });
                w6_f2.Invoke((MethodInvoker) delegate { w6_f2.Enabled = false; });
                w6_f1conv.Invoke((MethodInvoker) delegate { w6_f1conv.Enabled = false; });
                w6_f2conv.Invoke((MethodInvoker) delegate { w6_f2conv.Enabled = false; });
            }

            agentService.close();
            agents.Remove(agentService);
        }