예제 #1
0
 public void LoginLaunchBrowser()
 {
     try
     {
         LoginDialog login = new LoginDialog();
         login.succ = delegate(byte[] a) {
             StreamReader streamReader = new StreamReader(new MemoryStream(a));
             JsonObject   json         = (JsonObject)SimpleJson.SimpleJson.DeserializeObject(streamReader.ReadToEnd());
             int          code         = int.Parse(json["code"].ToString());
             string       msg          = json["msg"].ToString();
             if (code == 200)
             {
                 JsonObject token = (JsonObject)json["data"];
                 SettingsManager.ScpboxAccessToken = token["accessToken"].ToString();
                 DialogsManager.HideAllDialogs();
             }
             else
             {
                 login.tip.Text = msg;
             }
         };
         login.fail = delegate(Exception e) { login.tip.Text = e.ToString(); };
         DialogsManager.ShowDialog(null, login);
     }
     catch (Exception error)
     {
         m_loginProcessData.Fail(this, error);
     }
 }