public MainWindow()
        {
            InitializeComponent();

            udpProtocol = new UDPProtocol(localPort);
            udpProtocol.UdpSocketReceiveStart(RunCommand);

            ID = Properties.Settings.Default.ID;
            while (ID == 0)
            {
                udpProtocol.UdpSocketSend(udpProtocol.serverIP, udpProtocol.serverPort, new byte[] { 1 });
                Thread.Sleep(5000);
            }

            sendIPPortThread = new Thread(() =>
            {
                while (true)
                {
                    if (ID == 0)
                    {
                        continue;
                    }
                    udpProtocol.UdpSocketSend(udpProtocol.serverIP, udpProtocol.serverPort, new byte[] { 3, (byte)ID });
                    Thread.Sleep(10000);
                }
            });

            viewScreenManager = new ViewScreenManager(ID, controlIP, controlPort, udpProtocol);
            chatWindowManager = new ChatWindowManager(ID, controlIP, controlPort, udpProtocol);

            sendIPPortThread.IsBackground = true;
            sendIPPortThread.Start();
        }
 public ChatWindowManager(int ID, String ControlIP, int ControlPort, UDPProtocol udpProtocol)
 {
     this.udpProtocol = udpProtocol;
     this.ID          = ID;
     chatWindow       = new ChatWindow(mess =>
     {
         SendMessage(mess);
     });
     SetControlIPPort(ControlIP, ControlPort);
 }
Example #3
0
        public ViewScreenManager(int ID, String controlIP, int controlPort, UDPProtocol udpProtocol)
        {
            this.windowsScaling = GetWindowsScaling();
            this.screenWidth    = Screen.PrimaryScreen.Bounds.Width;
            this.ScreenHeight   = Screen.PrimaryScreen.Bounds.Height;

            this.blockWidth  = (int)Math.Ceiling((double)screenWidth / imageWidth);
            this.blockHeight = (int)Math.Ceiling((double)ScreenHeight / ImageHeight);

            this.ID          = ID;
            this.udpProtocol = udpProtocol;
            this.controlIP   = controlIP;
            this.controlPort = controlPort;
        }