コード例 #1
0
        /// <summary>
        /// Method called on edit click to navigate to a Section edit window.
        /// </summary>
        /// <param name="sender">The object sender of the event.</param>
        /// <param name="e">Routed event arguments.</param>
        public override void EditItem_Click(object sender, RoutedEventArgs e)
        {
            // Check if an AclGroup is founded.
            if (SelectedItem != null)
            {
                // Show open file dialog box
                using (WindowFormSectionLayout dlg = new WindowFormSectionLayout(SelectedItem))
                {
                    bool?result = dlg.ShowDialog();

                    // Process open file dialog box results
                    if (result == true)
                    {
                        NotifyChanged(dlg.NewForm);
                    }
                    else
                    {
                        NotifyCanceled(dlg.NewForm);
                    }
                }
            }
            else
            {
                string message = Exceptions.GetReferenceNull(nameof(SelectedItem), typeof(SectionEntity)).Message;
                log.Warn(message);
                MessageBoxs.Warning(message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Method called on click event to add a new Section.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">Routed event arguments.</param>
        public override void AddItem_Click(object sender, RoutedEventArgs e)
        {
            // Show open file dialog box
            using (WindowFormSectionLayout dlg = new WindowFormSectionLayout(new SectionEntity()))
            {
                bool?result = dlg.ShowDialog();

                //if (!dlg.Activate())
                //{
                //    string message = "Sections edit file dialog box is busy. Please try again.";
                //    log.Warn(message);
                //    MessageBoxs.Warning(message);
                //    dlg.Close();
                //}

                // Process open file dialog box results
                if (result == true)
                {
                    NotifyAdded(dlg.NewForm);
                }
                else
                {
                    NotifyCanceled(dlg.NewForm);
                }
            }
        }
コード例 #3
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;
                }
            }
        }