private void OnLoginFB(object sender, EventArgs e) { var spinner = UIUtils.ShowSpinner(this); DependencyService.Get <IFacebookHelper>().Start((resp) => { if (resp.Code == ResponseCode.OK) { var obj = JObject.Parse(resp.Result); var email = obj["email"].ToString(); var password = Ext.MD5.GetMd5String(obj["id"].ToString()); var fbId = obj["id"].ToString(); DataGate.CustomerLoginJson(email, password, fbId, (loginResp) => { if (loginResp.Code == ResponseCode.OK) { var jobj = JObject.Parse(loginResp.Result); OnLoginOk(jobj); } else { UIUtils.ShowMessage("Login failed. Try later", this); } UIUtils.HideSpinner(this, spinner); }); } else { UIUtils.ShowMessage("Login failed. Try later", this); UIUtils.HideSpinner(this, spinner); } }); }
private void OnSignupFB(object sender, EventArgs e) { var spinner = UIUtils.ShowSpinner(this); DependencyService.Get <IFacebookHelper>().Start((resp) => { if (resp.Code == ResponseCode.OK) { var obj = JObject.Parse(resp.Result); var sendData = new Dictionary <string, object>() { { "Email", obj["email"].ToString() }, { "FbId", obj["id"].ToString() }, { "FirstName", obj["first_name"].ToString() }, { "LastName", obj["last_name"].ToString() }, { "Password", Ext.MD5.GetMd5String(obj["id"].ToString()) }, { "Phone", "" } }; DataGate.CustomerSignupJson(sendData, (singupResp) => { if (singupResp.Code == ResponseCode.OK) { var jobj = JObject.Parse(singupResp.Result); if (jobj["Id"] == null || string.IsNullOrEmpty((string)jobj["Id"])) { Device.BeginInvokeOnMainThread(() => { DoLogin(obj["email"].ToString(), obj["id"].ToString()); }); } else { OnLoginOk(jobj); } } else { } UIUtils.HideSpinner(this, spinner); }); } else { UIUtils.ShowMessage("Login failed. Try later", this); UIUtils.HideSpinner(this, spinner); } }); }
private void DoLogin(string email, string password) { var spinner = UIUtils.ShowSpinner(this); DataGate.CustomerLoginJson(email, Ext.MD5.GetMd5String(password), null, (data) => { if (data.Code == ResponseCode.OK) { OnLoginOk(JObject.Parse(data.Result)); } else { UIUtils.ShowMessage("Login failed. Try later", this); } UIUtils.HideSpinner(this, spinner); }); }
public static void CheckCrash() { System.Threading.Tasks.Task.Run(() => { var stream = DependencyService.Get <IFileSaveLoad>().OpenFile("crash"); if (stream != null && stream.Length != 0) { var sr = new System.IO.StreamReader(stream); var msg = sr.ReadToEnd(); stream.Dispose(); DependencyService.Get <IFileSaveLoad>().DeleteFile("crash"); DataGate.SendCrash(msg, (r) => { }); } else { if (stream != null) { stream.Dispose(); } } }); }