/// <summary>
        /// This function loads the data from the database into the fields and update the user interface
        /// </summary>
        /// <author>Thomas Meents, Bernhard Bruns</author>
        private void LoadDataFromDatabase()
        {
            string connectionName = DBWorker.GetConnectionName();

            Dispatcher.BeginInvoke((Action)(() =>
            {
                MiningInfo.BBCode += "\nLoading data from " + connectionName;
                MiningInfoScrollViewer.ScrollToEnd();
            }));

            if (MainWindow.MatrixSelection.SelectionHasChangedSinceLastLoading || EventSelectionModel.GetInstance().SelectionHasChangedSinceLastLoading)
            {
                foreach (Field field in MainWindow.MatrixSelection.MatrixFields)
                {
                    if (_cancellationToken.IsCancellationRequested)
                    {
                        break;
                    }

                    DBConnectionHelpers.LoadFactsInField(field);

                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        ProgressBar.Value += 1;
                    }));
                }
                MainWindow.MatrixSelection.SelectionHasChangedSinceLastLoading = false;
                EventSelectionModel.GetInstance().SelectionHasChangedSinceLastLoading = false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Builds an EventDimensionSelector for each event dimension.
        /// </summary>
        private void BuildEventDimensionsSelectors()
        {
            //reset gui
            EventDimensionList.Children.Clear();

            //clear the the internal representation of the selected dimensions
            EventSelectionModel.GetInstance().Clear();

            _listOfDimensionSelectors = new List <EventDimensionSelector>();

            if (DBWorker.MetaData == null || DBWorker.MetaData.ListOfEventDimensions == null || DBWorker.MetaData.ListOfEventDimensions.Count == 0)
            {
                TextBlock textBlock = new TextBlock {
                    Text = "No events available."
                };
                EventDimensionList.Children.Add(textBlock);
                return;
            }

            //build EventDimensionSelector for each event dimension
            for (int i = 0; i < DBWorker.MetaData.ListOfEventDimensions.Count; i++)
            {
                //skip empty dimension
                if (DBWorker.MetaData.ListOfEventDimensions[i].IsEmptyDimension)
                {
                    continue;
                }

                //create EventDimensionSelector for dimension
                int axis = i + 1;
                EventDimensionSelector dimSelector = new EventDimensionSelector(axis);
                dimSelector.Init(DBWorker.MetaData.ListOfEventDimensions, DBWorker.MetaData.ListOfEventDimensions[i]);
                _listOfDimensionSelectors.Add(dimSelector);

                //add selector to panel
                EventDimensionList.Children.Add(dimSelector.DimensionSelectorGrid);
            }

            //build internal representation of the selected dimensions
            foreach (EventDimensionSelector dimSelector in _listOfDimensionSelectors)
            {
                int       axis                     = dimSelector.Axis;
                Dimension dim                      = dimSelector.ShowedDimension;
                int       levelDepth               = dimSelector.GetSelectedLevelDepth();
                int       aggregationDepth         = dimSelector.GetSelectedAggregationDepth();
                List <DimensionContent> dimContent = dimSelector.GetSelectedDimensionContent();
                EventSelectionModel.GetInstance().AddSelectedDimension(new SelectedDimension(axis, dim, levelDepth, aggregationDepth - 1, true, dimContent, true));
            }

            InitEventListener();
        }
        /// <summary>
        /// Load a list of facts and eventlogs in the fields.
        /// </summary>
        /// <param name="field"></param>
        /// <author>Bernhard Bruns,Thomas Meents, Moritz Eversmann</author>
        public static bool LoadFactsInField(Field field)
        {
            try
            {
                List <List <Case> > listOfFacts = DBWorker.GetFacts(MainWindow.MatrixSelection.SelectedDimensions, EventSelectionModel.GetInstance().SelectedDimensions, field);

                foreach (List <Case> fact in listOfFacts)
                {
                    if (fact != null)
                    {
                        field.EventLog.Cases.AddRange(fact);
                    }
                }

                return(true);
            }
            catch (TimeoutException ex)
            {
                ErrorHandling.ReportErrorToUser("Error: Database Timeout. " + ex.Message);
            }
            catch (Exception ex)
            {
                if (ex is NoParamsGivenException || ex is NotImplementedException || ex is ArgumentException)
                {
                    ErrorHandling.ReportErrorToUser("Error: " + ex.Message);
                }
                else
                {
                    throw;
                }
            }

            return(false);
        }
Beispiel #4
0
 private void updateInternalEventSelectionModel(int axis, Dimension dimension, int levelDepth, int aggregatioDepth, List <DimensionContent> dimensionContent)
 {
     EventSelectionModel.GetInstance().Update(axis, dimension, levelDepth, aggregatioDepth, dimensionContent);
 }