Exemplo n.º 1
0
 /// <summary>
 /// This executes the closing event when the Edit Assumptions window is closed.
 /// The method refreshes the groups list and rebinds the visible assumptions.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ParseGroupWindow_Closed(object sender, EventArgs e)
 {
     //Execute assumption window closing event
     groupCombo.ItemsSource   = null;
     groupCombo.ItemsSource   = ParseGroup.GetParseGroups();
     groupCombo.SelectedValue = ParseGroup.GetParseGroups().ToArray()[0];
 }
Exemplo n.º 2
0
        /// <summary>
        /// Get all non-predefined parse groups.
        /// </summary>
        /// <returns>All non-predefined parse groups.</returns>
        public static List <ParseGroup> GetUserGroups()
        {
            List <ParseGroup> userGroups = new List <ParseGroup>();

            foreach (ParseGroup pg in ParseGroup.GetParseGroups())
            {
                if (!pg.Predefined)
                {
                    userGroups.Add(pg);
                }
            }
            return(userGroups);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Layout the content of the window.
        /// </summary>
        private void LayoutDesign()
        {
            //Set up grid
            Grid grid = new Grid();

            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });

            //Create group selection box and label
            StackPanel comboLabelStack = new StackPanel();
            TextBlock  comboLabel      = new TextBlock();

            comboLabel.Text = "Select Group:";
            comboLabelStack.Children.Add(comboLabel);
            StackPanel comboStack = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };
            Button editGroupButton = new Button();

            editGroupButton.Content = "Edit";
            editGroupButton.Margin  = new Thickness(0, 0, 5, 0);
            editGroupButton.Click  += new RoutedEventHandler(EditGroupButton_Click);
            comboStack.Children.Add(editGroupButton);
            groupCombo                   = new ComboBox();
            groupCombo.ItemsSource       = ParseGroup.GetParseGroups();
            groupCombo.SelectionChanged += new SelectionChangedEventHandler(AssumptionGroupChanged);
            comboStack.Children.Add(groupCombo);
            comboStack.MaxWidth = 400;
            comboLabelStack.Children.Add(comboStack);
            comboLabelStack.Margin = new Thickness(0, 0, 0, 10);

            //Create Assumption checkbox list
            visibibleAssumptions           = new ListBox();
            visibibleAssumptions.MaxWidth  = 400;
            visibibleAssumptions.MaxHeight = 800;
            visibibleAssumptions.MinWidth  = 400;
            visibibleAssumptions.MinHeight = 200;
            visibibleAssumptions.Margin    = new Thickness(0, 0, 0, 10);
            groupCombo.SelectedValue       = ParseGroup.GetParseGroups().ToArray()[0];

            //Create Select and Deselect All buttons
            StackPanel selectDeselectPanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            selectDeselectPanel.HorizontalAlignment = HorizontalAlignment.Center;
            Button selectBtn = new Button();

            selectBtn.Content = "Select All";
            selectBtn.Width   = 75;
            selectBtn.Click  += new RoutedEventHandler(SelectAllButton_Click);
            selectBtn.Margin  = new Thickness(0, 0, 10, 0);
            selectDeselectPanel.Children.Add(selectBtn);
            Button deselectBtn = new Button();

            deselectBtn.Content = "Deselect All";
            deselectBtn.Width   = 75;
            deselectBtn.Click  += new RoutedEventHandler(DeselectAllButton_Click);
            selectDeselectPanel.Children.Add(deselectBtn);

            //Set element locations in grid and add to grid
            Grid.SetColumn(visibibleAssumptions, 0);
            Grid.SetRow(visibibleAssumptions, 1);
            grid.Children.Add(visibibleAssumptions);
            Grid.SetColumn(comboLabelStack, 0);
            Grid.SetRow(comboLabelStack, 0);
            grid.Children.Add(comboLabelStack);
            Grid.SetColumn(selectDeselectPanel, 0);
            Grid.SetRow(selectDeselectPanel, 2);
            grid.Children.Add(selectDeselectPanel);

            //Set the content of the window to be the newly designed layout
            this.Content = grid;
        }