Esempio n. 1
0
        /// <summary>
        /// Method called on <see cref="SectionEntity"/> default change event.
        /// </summary>
        /// <param name="sender">The <see cref="object"/> sender of the event.</param>
        /// <param name="e">Entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param>
        private void SectionsDataGrid_DefaultChanged(object sender, EntityChangesEventArgs e)
        {
            try
            {
                MessageBoxs.IsBusy = true;
                log.Warn("Setting default Section. Please wait...");

                SectionEntity newEntity = (SectionEntity)e.NewEntity;
                SectionEntityCollection.SetDefault(newEntity);
                Model.LoadSections();

                log.Warn("Setting default Section. Done.");
            }

            catch (Exception ex)
            {
                log.Fatal(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Setting default Section. Fail.");
            }

            finally
            {
                MessageBoxs.IsBusy = false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Method called on add section 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 CatalogAddSection_Click(object sender, RoutedEventArgs e)
        {
            // Show open file dialog box
            using (WindowFormSectionLayout dlg = new WindowFormSectionLayout(new SectionEntity()))
            {
                bool?result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    log.Info("Adding or editing Section informations. Please wait...");

                    SectionEntityCollection.DbInsert(new List <SectionEntity> {
                        dlg.NewForm
                    });

                    log.Info("Adding or editing Section informations. Done");
                    MessageBoxs.IsBusy = false;
                }
            }
        }