public RefreshViewModel(SSIDListViewModel ssidListViewModel)
        {
            var timer = new SimplePeriodicTimer();

            timer.Callback = () => ssidListViewModel.Refresh();
            this.Timer     = timer;

            this.PropertyChanged += this_PropertyChanged;

            this.RefreshInterval      = 5000;
            this.IsAutoRefreshEnabled = true;
        }
예제 #2
0
        public static void Main()
        {
            Samraksh.eMote.RadarInterface radarInt = new Samraksh.eMote.RadarInterface();
            radarInt.TurnOff();
            Debug.Print(DebuggingSupport.SetupBorder); //===================
            Debug.EnableGCMessages(false);             // We don't want to see garbage collector messages in the Output window

            Debug.Print(VersionInfo.VersionBuild(Assembly.GetExecutingAssembly()));
            Thread.Sleep(3000);

            _lcd.Write("Base");

            try
            {
                var macBase = SystemGlobal.GetMAC();

                Debug.Print(DebuggingSupport.MacInfo(macBase));
                Debug.Print(DebuggingSupport.SetupBorder);                      //===================
                macBase.OnNeighborChange += Routing.Routing_OnNeighborChange;
                //macBase.OnReceiveAll += macBase_OnReceiveAll;

                // Set up serial & pass it on to the components that need it
                var serialComm = new SerialComm("COM1", AppMsgHandler.SerialCallback_base_node);
                serialComm.Open();

                // Periodically send Base Watchdog message to PC
                //		This is similar to Heartbeat in Net Manager but does not indicate network liveness.
                //		Instead, it is used
                //		- by the PC Visualizer Data Collector to determine if the Base node is connected to the PC and is running
                //		- by Visualizer to determine if Data Collector is running and connected to the Base node
                var baseWatchdogTimer = new SimplePeriodicTimer(callBackValue =>
                {
                    var msg = BaseGlobal.PCMessages.Compose.BaseWatchdog(_baseLiveMsgNum);
                    _baseLiveMsgNum++;
                    serialComm.Write(msg);
                }, null, 0, BaseGlobal.BaseWatchdogIntervalMs);
                baseWatchdogTimer.Start();

                if (macBase is OMAC)
                {
                    const int waitForMac = 30;
#if !DBG_LOGIC
                    Debug.Print("\tWaiting " + waitForMac + " sec");
#endif
                    Thread.Sleep(waitForMac * 1000);
                }

                // Initialize System Global
                SystemGlobal.Initialize(SystemGlobal.NodeTypes.Base);

                // Initialize routing
                var routing = new Routing(macBase, null);

                // Allow additional sleep to "time-shift" routing and heartbeats (NetManager)
                Thread.Sleep(60 * 1000);

                // Initialize application message handler
                AppMsgHandler.Initialize(macBase, _lcd, serialComm);

                // Initialize network manager
                NetManager.Initialize(macBase, serialComm);

                // Initialize neighborhood manager
                NeighborInfoManager.Initialize(macBase, serialComm);
            }
            catch
            {
                //Lcd.Write("Err");
                //Thread.Sleep(Timeout.Infinite);
            }

            // Sleep forever
            Thread.Sleep(Timeout.Infinite);
        }