示例#1
0
 public JToken FetchRalletsNotification(bool onStartup = false)
 {
     Debug.WriteLine("Rallets FetchRalletsNotification");
     // 第一次启动的时候, 清空代理设置,但是不会修改到配置
     if (onStartup)
     {
         SystemProxy.Disable();
     }
     //var enabled = controller.GetFreshConfiguration().enabled;
     try
     {
         JObject notification = Request.one().Post("rallets_notification", encrypt: true);
         if (notification.ok())
         {
             controller.AssignAndReloadConfigsIfDiff(notification["configs"]);
             MenuViewController.one().UpdateView(notification);
         }
         else
         {
             if (onStartup || loggedIn)
             {
                 Logout();
                 MenuViewController.one().loginForm.showWarningTitle((String)notification.SelectToken("message"));
             }
         }
         ParseSystemNotification(notification["systemNotification"]);
         return(notification);
     }
     catch (RalletsException ex)
     {
         Debug.WriteLine(ex.ToString());
     }
     return(null);
 }