Пример #1
0
        public Form1()
        {
            /*while (true) {
             *                  Thread.Sleep(1);
             *          }*/

            if (File.Exists(Environment.CurrentDirectory + "/local.txt"))
            {
                isLocal = true;
            }

            StreamReader sr   = new StreamReader($"settings.txt");
            String       line = sr.ReadToEnd();

            servername = line;

            serverForU = new ServerForU();
            clientToMS = new ClientToMS(serverForU);
            clientToBS = new ClientToBS(clientToMS);

            clientToMS.SetReferences(clientToBS);
            serverForU.SetReferences(clientToMS);
            clientToBS.serverForU = serverForU;

            Timer t = new Timer(TimerCallback, null, 0, 10000);

            //serverForU.SetReferences(clientToMS);
            //clientToBS.serverForU = serverForU;
        }
Пример #2
0
        public ClientToMS(ServerForU serverForU)
        {
            this.serverForU = serverForU;
            config          = new NetPeerConfiguration("NSMobile");
            client          = new NetClient(config);
            thread          = new Thread(new ThreadStart(Handler));

            //client.RegisterReceivedCallback (new SendOrPostCallback (Handler));
            client.Start();
            thread.Start();
        }