/// <summary> /// Method called on add item click event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Routed event arguments <see cref="RoutedEventArgs"/>.</param> public override void AddItem_Click(object sender, RoutedEventArgs e) { try { // Start to busy application. MessageBoxs.IsBusy = true; log.Warn("Adding Album informations. Please wait..."); // Show open file dialog box using (WindowFormAlbumLayout dlg = new WindowFormAlbumLayout(new AlbumEntity())) { bool?result = dlg.ShowDialog(); /* * if (!dlg.Activate()) * { * log.Warn("Albums edit file dialog boxn is busy. Please try again."); * MessageBoxs.Warning("Albums edit file dialog boxn is busy. Please try again."); * dlg.Close(); * } */ // Process open file dialog box results if (result == true) { NotifyAdded(dlg.NewForm); } else { NotifyCanceled(dlg.NewForm); } } } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Error(ex.Output()); } // Stop to busy application. finally { log.Warn("Updating Album informations. Done."); MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on edit <see cref="AlbumEntity"/> click event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Routed event arguments <see cref="RoutedEventArgs"/>.</param> public override void EditItem_Click(object sender, RoutedEventArgs e) { try { // Start to busy application. MessageBoxs.IsBusy = true; log.Warn("Editing Album informations. Please wait..."); // Check if an AclGroup is founded. if (SelectedItem != null) { // Show open file dialog box WindowFormAlbumLayout dlg = new WindowFormAlbumLayout(SelectedItem); bool?result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { NotifyChanged(dlg.NewForm); } else { NotifyCanceled(dlg.NewForm); } log.Warn("Editing Album informations. Done."); } else { string message = $"{typeof(AlbumEntity).Name} not found !"; log.Warn(message); MessageBoxs.Warning(message); } } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Error(ex.Output()); } // Stop to busy application. finally { MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on add album click event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">The routed event arguments <see cref="RoutedEventArgs"/>.</param> private void CatalogAddAlbum_Click(object sender, RoutedEventArgs e) { // Show open file dialog box using (WindowFormAlbumLayout dlg = new WindowFormAlbumLayout(new AlbumEntity())) { bool?result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { log.Info("Adding or editing Album informations. Please wait..."); AlbumEntityCollection.DbInsert(new List <AlbumEntity> { dlg.NewForm }); log.Info("Adding or editing Section informations. Done"); MessageBoxs.IsBusy = false; } } }