Beispiel #1
0
        public async Task Start()
        {
            BConsole.WriteLine("NetworkMonitor v1.0");
            await Manager.Init();

            new Thread(delegate()
            {
                int minutes     = 10;
                int interval    = 1000;
                int IntervalMax = minutes * 1000 * 60;
                int timer       = IntervalMax;
                while (!StopCalled)
                {
                    if (timer % interval != 0 || timer > IntervalMax)
                    {
                        break;
                    }
                    if (timer < IntervalMax)
                    {
                        Thread.Sleep(interval);
                        timer += interval;
                    }
                    else
                    {
                        timer       = 0;
                        var devices = NetworkScanner.GetDevices(Config.GetDisplay());
                        Manager.AddDevices(devices);
                    }
                }
            }).Start();

            await Listener.Start();
        }