示例#1
0
        private async Task PopToast()
        {
            // Generate the toast notification content and pop the toast
            var loginRes = await RouterAPI.Login();

            if (!loginRes)
            {
                return;
            }
            var clients = await RouterAPI.GetClients();

            banList = await RouterAPI.FireWall.GetBanList();

            if (clients == null)
            {
                return;
            }
            if (clients.NotInBlackDevices.Count == 0)
            {
                return;
            }
            clients.Update();
            blackDevs = clients.NotInBlackDevices.Where(o => banList.Contains(o.mac) == false).ToList();
            if (blackDevs.Count == 0)
            {
                return;
            }
            ToastContent content = GenerateToastContent();

            ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(content.GetXml()));
        }
示例#2
0
 /// <summary>
 /// 定时更新数据
 /// </summary>
 private void InitUpdateTheard()
 {
     if (updateTimer == null)
     {
         updateSpan  = TimeSpan.FromSeconds(2);
         updateTimer = ThreadPoolTimer.CreatePeriodicTimer(async(source) => {
             if (wanInfo == null)
             {
                 wanInfo = await RouterAPI.GetWANinfo();
             }
             netRate    = await RouterAPI.GetNetRate();
             cpuMemInfo = await RouterAPI.GetCpuMemInfo();
             clients    = await RouterAPI.GetClients();
             devRate    = await RouterAPI.GetDeviceRate();
             banList    = await RouterAPI.FireWall.GetBanList();
             if (wlanInfo == null)
             {
                 wlanInfo = await RouterAPI.GetWLANInfo();
             }
             await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => {
                 UpdateUI();
             });
         }, updateSpan);
     }
 }
示例#3
0
 /// <summary>
 /// 定时更新数据
 /// </summary>
 private void InitUpdateTheard()
 {
     if (updateTimer == null)
     {
         updateSpan  = TimeSpan.FromSeconds(2);
         updateTimer = ThreadPoolTimer.CreatePeriodicTimer(async(source) => {
             if (App.DemoAccount)
             {
                 await Dispatcher.RunAsync(CoreDispatcherPriority.High, async() => {
                     data = await MainPageData.GetDemoData();
                     UpdateUI();
                 });
                 updateTimer.Cancel();
             }
             else
             {
                 if (data == null)
                 {
                     data = new MainPageData();
                 }
                 if (data.wanInfo == null)
                 {
                     data.wanInfo = await RouterAPI.GetWANinfo();
                 }
                 data.netRate    = await RouterAPI.GetNetRate();
                 data.cpuMemInfo = await RouterAPI.GetCpuMemInfo();
                 data.clients    = await RouterAPI.GetClients();
                 data.devRate    = await RouterAPI.GetDeviceRate();
                 data.banList    = await RouterAPI.FireWall.GetBanList();
                 if (data.wlanInfo == null)
                 {
                     data.wlanInfo = await RouterAPI.GetWLANInfo();
                 }
                 await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => {
                     UpdateUI();
                 });
             }
         }, updateSpan);
     }
 }