private async Task <bool> Login() { try { var loader = new ResourceLoader(); IsLoading = Visibility.Visible; var check = await PostHelper.CheckExist(TempEmail); if (check) { string salt = await PostHelper.GetSalt(TempEmail); if (!String.IsNullOrEmpty(salt)) { //尝试登录 var login = await PostHelper.Login(TempEmail, InputPassword, salt); if (login) { App.isInOfflineMode = false; LocalSettingHelper.AddValue("OfflineMode", "false"); return(true); } else { Messenger.Default.Send <GenericMessage <string> >(new GenericMessage <string>(loader.GetString("NotCorrectContent")), "toast"); IsLoading = Visibility.Collapsed; return(false); } } else { Messenger.Default.Send <GenericMessage <string> >(new GenericMessage <string>(loader.GetString("NotCorrectContent")), "toast"); IsLoading = Visibility.Collapsed; return(false); } } else { Messenger.Default.Send <GenericMessage <string> >(new GenericMessage <string>(loader.GetString("AccountNotExistContent")), "toast"); IsLoading = Visibility.Collapsed; return(false); } } catch (Exception e) { var task = ExceptionHelper.WriteRecord(e); return(false); } }