/// <summary> /// Displays the book information. /// </summary> /// <param name="url">The URL.</param> private async void DisplayBookInfo(string url) { MyGridView.Opacity = 0.5; IsLoading(true); try { Book book = await CreateBookObjectFromApiObject.CreateBookFromGoogleApi(url); var contentDialog = new ContentDialogController().CreateBookContentDialog(book); if (LoggedInUser.CurrentLoggedInUser == null) { contentDialog.IsPrimaryButtonEnabled = false; } ContentDialogResult result = await contentDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { await DonauApi.ApiHelper.PostBook(LoggedInUser.CurrentLoggedInUser, book); UpdateCollection(); } } catch (Exception e) { new ContentDialogController().CreateErrorContentDialog(e.Message); } IsLoading(false); MyGridView.Opacity = 1; }
/// <summary> /// Handles the DeleteClick event of the MyButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Windows.UI.Xaml.RoutedEventArgs" /> instance containing the event data.</param> private async void MyButton_DeleteClick(object sender, RoutedEventArgs e) { var btn = e.OriginalSource as Button; if (await ApiHelper.DeleteACollection(LoggedInUser.CurrentLoggedInUser, btn.Tag.ToString())) { var cd = new ContentDialogController().CreateContentDialogMessage("Success!").ShowAsync(); UpdateCollection(); } else { MyListView_Collection.Header = "failed"; } }
/// <summary> /// Handles the Click event of the MyButton_Register_Submit control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Windows.UI.Xaml.RoutedEventArgs" /> instance containing the event data.</param> private async void MyButton_Register_Submit_Click(object sender, RoutedEventArgs e) { if (await new RegController().RegisteredUser(MyTextBox_Username.Text, MyTextBox_Password.Password)) { MyButton_Register_Submit.Visibility = Visibility.Collapsed; MyButton_Register.Visibility = Visibility.Visible; MyButton_Login.Visibility = Visibility.Visible; MyButton_Logout.Visibility = Visibility.Visible; var cd = new ContentDialogController().CreateContentDialogMessage("Success!").ShowAsync(); MyTextBox_Username.Header = ""; MyTextBox_Username.Text = ""; MyTextBox_Username.PlaceholderText = "Username:"******""; MyTextBox_Password.Password = ""; MyTextBox_Password.PlaceholderText = "Password:"******"Something went wrong or user already registered!").ShowAsync(); } }