Beispiel #1
0
 public Repitor_View(Point loc, Grid grid, Repitor _repitor)
 {
     gridDraw = grid;
     location = loc;
     repitor  = _repitor;
     repitor.RegisterHandlerReColor(Recolor);
 }
        public MainWindow()
        {
            most1   = new Most();
            most2   = new Most();
            repitor = new Repitor();
            Network_Bus Network_Bus1 = new Network_Bus();
            Network_Bus Network_Bus2 = new Network_Bus();
            Network_Bus Network_Bus3 = new Network_Bus();

            InitializeComponent();

            Network_Bus1.RegisterHandlersendToTerminal(Show_Message);
            Network_Bus2.RegisterHandlersendToTerminal(Show_Message);
            Network_Bus3.RegisterHandlersendToTerminal(Show_Message);

            most1.RegisterHandlersendToTerminal(Show_Message);
            most2.RegisterHandlersendToTerminal(Show_Message);
            repitor.RegisterHandlersendToTerminal(Show_Message);

            for (int i = 0; i < 2; i++)
            {
                Network_Bus1.Add(new PC_Client("192.168.1." + (i + 1).ToString()));
                Network_Bus1.pC_Clients[i].RegisterHandlersendToTerminal(Show_Message);
            }
            for (int i = 0; i < 2; i++)
            {
                Network_Bus2.Add(new PC_Client("192.168.1." + (i + 3).ToString()));
                Network_Bus2.pC_Clients[i].RegisterHandlersendToTerminal(Show_Message);
            }
            for (int i = 0; i < 2; i++)
            {
                Network_Bus3.Add(new PC_Client("192.168.1." + (i + 10).ToString()));
                Network_Bus3.pC_Clients[i].RegisterHandlersendToTerminal(Show_Message);
            }

            most1.AddNetwork_Bus(Network_Bus1, 0);
            most1.AddNetwork_Bus(Network_Bus2, 1);
            most2.AddNetwork_Bus(Network_Bus2, 0);
            most2.AddNetwork_Bus(Network_Bus3, 1);
            repitor.AddNetwork_Bus(Network_Bus1, 0);
            repitor.AddNetwork_Bus(Network_Bus3, 1);

            DrawBus();

            pC_Clients    = new PC_View[6];
            pC_Clients[0] = new PC_View(new Point(30, 140), grid, Network_Bus1.pC_Clients[0]);
            pC_Clients[1] = new PC_View(new Point(30, 90), grid, Network_Bus1.pC_Clients[1]);
            pC_Clients[2] = new PC_View(new Point(110, 140), grid, Network_Bus2.pC_Clients[0]);
            pC_Clients[3] = new PC_View(new Point(110, 90), grid, Network_Bus2.pC_Clients[1]);
            pC_Clients[4] = new PC_View(new Point(200, 140), grid, Network_Bus3.pC_Clients[0]);
            pC_Clients[5] = new PC_View(new Point(200, 90), grid, Network_Bus3.pC_Clients[1]);

            foreach (PC_View pc in pC_Clients)
            {
                pc.CreatePC();
                pc.RegisterHandlerChoose(ChoosePC);
            }
            ChoosePC(pC_Clients[0]);
            pC_Clients[0].myRect.Fill = new SolidColorBrush(Color.FromArgb(255, 100, 25, 205));

            most_View    = new Most_View[2];
            most_View[0] = new Most_View(new Point(90, 350 + 270), grid, most1);
            most_View[1] = new Most_View(new Point(175, 350 + 270), grid, most2);
            most_View[0].CreatePC();
            most_View[1].CreatePC();

            repitor_View = new Repitor_View(new Point(175, 60), grid, repitor);
            repitor_View.CreatePC();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Start();
        }