private async void ButtonConnect_Tapped(object sender, TappedRoutedEventArgs e) { if (UserKeyToValidate.Text.Length == 23) { MainPage.ShowLoader(ResourceLoader.GetForCurrentView().GetString("CheckingKey")); IEncrypter encrypter = new AESEncrypter(); synchronizer.SetEncrypter(encrypter, UserKeyToValidate.Text); bool result = false; try { result = await synchronizer.DecryptWithKey(UserKeyToValidate.Text); if (result) { MainPage.ShowLoader(ResourceLoader.GetForCurrentView().GetString("SynchronizingAccountsWithCloud")); try { await AccountStorage.Instance.Synchronize(); vault.Add(new PasswordCredential(RESOURCE_NAME, USERNAME_NAME, UserKeyToValidate.Text)); Frame.Navigate(typeof(SetupSynchronizationFinishedPage), mainPage); } catch (OneDriveException ex) { MessageDialog dialog = GetOneDriveErrorMessageDialog(ex); await dialog.ShowAsync(); } finally { MainPage.HideLoader(); } } else { MainPage.HideLoader(); MainPage.AddBanner(new Banner(BannerType.Danger, ResourceLoader.GetForCurrentView().GetString("EnteredKeyIncorrect"), true)); } } catch (NetworkException) { MainPage.HideLoader(); MainPage.AddBanner(new Banner(BannerType.Danger, ResourceLoader.GetForCurrentView().GetString("BannerUnableToValidateKey"), true)); } } }