diff --git a/DownKyi/ViewModels/ViewLoginViewModel.cs b/DownKyi/ViewModels/ViewLoginViewModel.cs index 6767e83..4b89904 100644 --- a/DownKyi/ViewModels/ViewLoginViewModel.cs +++ b/DownKyi/ViewModels/ViewLoginViewModel.cs @@ -98,26 +98,34 @@ namespace DownKyi.ViewModels /// private void Login() { - var loginUrl = LoginQR.GetLoginUrl(); - if (loginUrl == null) { return; } - - if (loginUrl.Status != true) + try { - ExecuteBackSpace(); - return; - } + var loginUrl = LoginQR.GetLoginUrl(); + if (loginUrl == null) { return; } - if (loginUrl.Data == null || loginUrl.Data.Url == null) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("GetLoginUrlFailed")); - return; - } + if (loginUrl.Status != true) + { + ExecuteBackSpace(); + return; + } - PropertyChangeAsync(new Action(() => { LoginQRCode = LoginQR.GetLoginQRCode(loginUrl.Data.Url); })); - Core.Utils.Debugging.Console.PrintLine(loginUrl.Data.Url + "\n"); - LogManager.Debug(Tag, loginUrl.Data.Url); + if (loginUrl.Data == null || loginUrl.Data.Url == null) + { + eventAggregator.GetEvent().Publish(DictionaryResource.GetString("GetLoginUrlFailed")); + return; + } + + PropertyChangeAsync(new Action(() => { LoginQRCode = LoginQR.GetLoginQRCode(loginUrl.Data.Url); })); + Core.Utils.Debugging.Console.PrintLine(loginUrl.Data.Url + "\n"); + LogManager.Debug(Tag, loginUrl.Data.Url); - GetLoginStatus(loginUrl.Data.OauthKey); + GetLoginStatus(loginUrl.Data.OauthKey); + } + catch (Exception e) + { + Core.Utils.Debugging.Console.PrintLine("Login()发生异常: {0}", e); + LogManager.Error(Tag, e); + } } ///