Inheritance: System.Windows.Controls.ChildWindow
Esempio n. 1
0
        /// <summary>
        /// Called when the button to create a new list is clicked
        /// </summary>
        /// <param name="sender">Button</param>
        /// <param name="e">event args</param>
        private void NewListButtonClick(object sender, RoutedEventArgs e)
        {
            ModifyListChildWindow newListWindow = new ModifyListChildWindow();

            newListWindow.NewList = true;

            newListWindow.Closed += new EventHandler(ModifyListWindowClosed);
            newListWindow.Show();
        }
Esempio n. 2
0
        /// <summary>
        /// Displays UI to edit a list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditListButtonClick(object sender, RoutedEventArgs e)
        {
            Control control = sender as Control;
            ModifyListChildWindow newListWindow = new ModifyListChildWindow((DefaultScope.List)control.Tag);

            newListWindow.NewList = false;

            newListWindow.Closed += new EventHandler(ModifyListWindowClosed);
            newListWindow.Show();
        }
Esempio n. 3
0
        /// <summary>
        /// Called when the new list creation window is closed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ModifyListWindowClosed(object sender, EventArgs e)
        {
            ModifyListChildWindow newListWindow = sender as ModifyListChildWindow;

            bool?dialogResult = newListWindow.DialogResult;

            if (dialogResult == true)
            {
                // If the user clicked ok, add the new list
                ModelList list = newListWindow.List;

                if (newListWindow.NewList)
                {
                    try
                    {
                        ContextModel.Instance.AddList(list);
                    }
                    catch (ArgumentException)
                    {
                        // Warn the user that the list name is bad
                        MessageBox.Show("The Name for the new list must be unique");

                        // Redisplay the window
                        newListWindow.Show();
                    }
                }

                // Commit the change
                ContextModel.Instance.SaveChanges();
            }
            else
            {
                // Revert the change
                ContextModel.Instance.CancelChanges();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Called when the button to create a new list is clicked
        /// </summary>
        /// <param name="sender">Button</param>
        /// <param name="e">event args</param>
        private void NewListButtonClick(object sender, RoutedEventArgs e)
        {
            ModifyListChildWindow newListWindow = new ModifyListChildWindow();
            newListWindow.NewList = true;

            newListWindow.Closed += new EventHandler(ModifyListWindowClosed);
            newListWindow.Show();
        }
Esempio n. 5
0
        /// <summary>
        /// Displays UI to edit a list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditListButtonClick(object sender, RoutedEventArgs e)
        {
            Control control = sender as Control;
            ModifyListChildWindow newListWindow = new ModifyListChildWindow((DefaultScope.List)control.Tag);
            newListWindow.NewList = false;

            newListWindow.Closed += new EventHandler(ModifyListWindowClosed);
            newListWindow.Show();
        }