private async void SignUpBtn_Click(object sender, RoutedEventArgs e) { if (!AllInputFieldsIsValid()) { return; } if (!await LogicHelper.IsInternet()) { return; } CreateBtn.IsEnabled = false; ChangePictureBtn.IsEnabled = false; ProgRing.IsActive = true; var result = await ViewModel.CreateNewUser(); if (result != null) { ProgRing.IsActive = false; CreateBtn.IsEnabled = true; ChangePictureBtn.IsEnabled = true; if (result.Status == RegisterStatus.Ok) { Frame.Navigate(typeof(MainPage)); } else { var dialog = new MessageDialog("", "Failed to create user"); switch (result.Status) { case RegisterStatus.EmailError: dialog.Content = "The Email is not valid!"; break; case RegisterStatus.PasswordError: dialog.Content = "Password contains invalid characters. Enter the another password."; break; case RegisterStatus.UserExistsOnEmail: dialog.Content = $"User with email '{ViewModel.UserData.Email}' already exist"; break; default: dialog.Content = "An error occurred when trying to create a user. Please try again later."; break; } await dialog.ShowAsync(); } } else { var dialog = new MessageDialog("Internal server error. Please try again later.", "Failed to create user"); await dialog.ShowAsync(); } }