Esempio n. 1
0
        /// <summary>
        /// Method called on edit click to navigate to a User 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)
        {
            if (SelectedItem != null)
            {
                // Show open file dialog box
                WindowFormUserLayout dlg = new WindowFormUserLayout(SelectedItem);
                bool?result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    NotifyChanged(dlg.NewForm);
                }
                else
                {
                    NotifyCanceled(dlg.NewForm);
                }
            }
            else
            {
                string message = string.Format("{0} not found !", nameof(UserEntity));
                log.Warn(message);
                MessageBoxs.Warning(message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Method called on add user 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 AddUser_Click(object sender, RoutedEventArgs e)
        {
            using (WindowFormUserLayout dlg = new WindowFormUserLayout())
            {
                bool?result = dlg.ShowDialog();

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

                    UserEntityCollection.DbInsert(new List <UserEntity> {
                        dlg.NewForm
                    });

                    if (MainFrame?.Content?.GetType() == typeof(PageUsersLayout))
                    {
                        ((PageUsersLayout)MainFrame.Content).Model.Users.Items.Add(dlg.NewForm);
                    }

                    log.Warn("Adding or editing User informations. Done");
                    MessageBoxs.IsBusy = false;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Method called on click event to add a new User.
        /// </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)
        {
            WindowFormUserLayout dlg = new WindowFormUserLayout();
            bool?result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                NotifyAdded(dlg.NewForm);
            }
            else
            {
                NotifyCanceled(dlg.NewForm);
            }
        }