Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the Controls
        /// </summary>
        /// <author>Bernhard Bruns, Christopher Licht, Moritz Eversmann</author>
        private void InitializeConsolidationControls()
        {
            ConsolidationListBox.ItemsSource = ConsolidatorSettings.ConsolidationOptions;


            ConsolidationListBox.Style = (Style)(Application.Current.TryFindResource("ListBox"));
            ConsolidationListBox.ItemContainerStyle = (Style)Application.Current.TryFindResource("ListBoxItemWithCheckbox");

            ConsolidationListBox.SelectionMode = SelectionMode.Extended;

            EventListBox.Style = (Style)(Application.Current.TryFindResource("ListBox"));
            EventListBox.ItemContainerStyle = (Style)Application.Current.TryFindResource("ListBoxItemWithCheckbox");
            EventListBox.SelectionMode      = SelectionMode.Extended;



            EventListBox.Visibility            = Visibility.Visible;
            EventPanel.Visibility              = Visibility.Collapsed;
            SliderPanel.Visibility             = Visibility.Collapsed;
            AvailableEventsHeader.Visibility   = Visibility.Visible;
            StartConsolidationButton.IsEnabled = false;

            NumberOfEventsSlider.Minimum = 1;
            NumberOfEventsSlider.Maximum = ConsolidationHelper.GetMaximumNumberOfUsedEvents();
        }
        /// <summary>
        /// Calls the static method of ConsolidationHelper and update the matrix-fields.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Christopher Licht</author>
        private void StartConsolidationClick(object sender, RoutedEventArgs e)
        {
            HashSet <Field>  _ListOfNetWithSelectedOptions = new HashSet <Field>();
            HashSet <String> listOfEvents       = new HashSet <String>();
            HashSet <Field>  listOfMatrixFields = new HashSet <Field>();
            int andOrSelection = -1;

            _listOfSelectedOptions = new HashSet <string>();

            andOrSelection = AndRadioButton.IsChecked == true ? 0 : 1;

            foreach (String selectedListViewItem in ConsolidationListBox.SelectedItems)
            {
                _listOfSelectedOptions.Add(selectedListViewItem);
            }

            foreach (String selectedEvent in EventListBox.SelectedItems)
            {
                listOfEvents.Add(selectedEvent);
            }

            foreach (var matrixField in MainWindow.MatrixSelection.MatrixFields)
            {
                listOfMatrixFields.Add(matrixField);
            }

            _ListOfNetWithSelectedOptions = ConsolidationHelper.StartConsolidation(listOfMatrixFields, _listOfSelectedOptions, listOfEvents, andOrSelection, (int)NumberOfEvents.Value);

            if (_ListOfNetWithSelectedOptions.Count == 0)
            {
                ModernDialog.ShowMessage("No results were found.", "Attention", MessageBoxButton.OK);
            }
            else
            {
                MatrixVisualizationGrid.ItemsSource = null;
                MatrixVisualizationGrid.ItemsSource = _ListOfNetWithSelectedOptions;
            }
        }