private void Logar() { TodoistService todoistService = new TodoistService(); //Take off the focus from any. Focus(); ApplicationBar.IsVisible = false; OverlayPopup.IsOpen = true; ShowOverlay.Begin(); progressIndicator.IsVisible = true; progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Connecting to Todoist service"; signUpLoginBtn.IsEnabled = false; SystemTray.SetProgressIndicator(this, progressIndicator); loginButton.IsEnabled = false; todoistService.Login(EmailTxtBox.Text, PasswordBox.Password, (data) => { NavigationService.Navigate(Utils.MainTodoistPage()); }, (error) => { loginButton.IsEnabled = true; MessageBox.Show(error, "Metroist", MessageBoxButton.OK); }, () => { ShowOverlay.Stop(); OverlayPopup.IsOpen = false; progressIndicator.IsIndeterminate = false; progressIndicator.IsVisible = false; ApplicationBar.IsVisible = true; signUpLoginBtn.IsEnabled = true; }); //Empty the passwordbox, just for visual security. PasswordBox.Password = string.Empty; if (RememberCheckBox.IsChecked == true) { app.localLoginInfo.isRecorded = true; app.localLoginInfo.email = EmailTxtBox.Text; app.localLoginInfo.password = PasswordBox.Password; } }