Пример #1
0
        public void Execute()
        {
            InitializationStarted?.Invoke(this, null);
            var graph    = CreateClusteringGraph();
            var ilouvain = new ILouvain(graph, _clusteringAttributes);

            ilouvain.DataUpdateEvent += (s, e) => RunDataUpdate?.Invoke(this, e);
            InitializationFinished?.Invoke(this, null);

            ClusteringStarted?.Invoke(this, null);
            ilouvain.Execute();
            ClusteringFinished?.Invoke(this, null);

            DistributingStarted?.Invoke(this, null);
            List <UserSuspicion> userSuspicionLevel = CreateUserSuspicionLevels(ilouvain.ILouvainExecutionResult);

            DistributingFinished?.Invoke(this, null);

            LatestRunResults = new AlgorithmResultsEventArgs()
            {
                Partition                   = ilouvain.ILouvainExecutionResult,
                UsersSuspicionLevel         = userSuspicionLevel,
                AttributesRarityMeasurement = _attributesRarityMeasurement,
                ClusteringAttributes        = _clusteringAttributes,
                DistributionAttributes      = _distributionAttributes
            };
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InteractiveCodeEditor" /> class.
        /// </summary>
        /// <param name="objectWriter">Interactive result visualizer object writer.</param>
        /// <param name="interactiveExecution">Interactive execution with delayed evaluation.</param>
        /// <param name="fontFamily">The font family.</param>
        /// <param name="fontSize">Size of the font.</param>
        /// <param name="indentationSize">Size of the indentation.</param>
        /// <param name="highlightingColors">The highlighting colors.</param>
        public InteractiveCodeEditor(InteractiveResultVisualizer objectWriter, SimpleCache <InteractiveExecution> interactiveExecution, string fontFamily, double fontSize, int indentationSize, params ICSharpCode.AvalonEdit.Highlighting.HighlightingColor[] highlightingColors)
            : base(fontFamily, fontSize, indentationSize, highlightingColors)
        {
            // Run initialization of the window in background STA thread
            IsEnabled = false;
            InteractiveExecutionCache = interactiveExecution;
            System.Threading.Thread thread = new System.Threading.Thread(() =>
            {
                try
                {
                    InteractiveExecution.scriptBase._InternalObjectWriter_ = new ObjectWriter()
                    {
                        InteractiveCodeEditor = this,
                    };
                    InteractiveExecution.scriptBase.ObjectWriter = objectWriter;

                    Dispatcher.InvokeAsync(() =>
                    {
                        IsEnabled = true;
                        Executing?.Invoke(false);
                    });
                    Initialize();
                    Dispatcher.InvokeAsync(() =>
                    {
                        InitializationFinished?.Invoke();
                    });
                }
                catch (ExitRequestedException)
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        CloseRequested?.Invoke();
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            });
            thread.SetApartmentState(System.Threading.ApartmentState.STA);
            thread.Start();
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InteractiveCodeEditor" /> class.
        /// </summary>
        /// <param name="objectWriter">Interactive result visualizer object writer.</param>
        /// <param name="fontFamily">The font family.</param>
        /// <param name="fontSize">Size of the font.</param>
        /// <param name="indentationSize">Size of the indentation.</param>
        /// <param name="highlightingColors">The highlighting colors.</param>
        public InteractiveCodeEditor(InteractiveResultVisualizer objectWriter, string fontFamily, double fontSize, int indentationSize, params ICSharpCode.AvalonEdit.Highlighting.HighlightingColor[] highlightingColors)
            : base(fontFamily, fontSize, indentationSize, highlightingColors)
        {
            interactiveExecution = new InteractiveExecution();
            interactiveExecution.scriptBase._InternalObjectWriter_ = new ObjectWriter()
            {
                InteractiveCodeEditor = this,
            };
            interactiveExecution.scriptBase.ObjectWriter = objectWriter;

            // Run initialization of the window in background task
            IsEnabled = false;
            Task.Run(() =>
            {
                try
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        IsEnabled = true;
                        Executing?.Invoke(false);
                    });
                    Initialize();
                    Dispatcher.InvokeAsync(() =>
                    {
                        InitializationFinished?.Invoke();
                    });
                }
                catch (ExitRequestedException)
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        CloseRequested?.Invoke();
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            });
        }
Пример #4
0
 public void OnInitializationFinished()
 {
     InitializationFinished?.Invoke(this, EventArgs.Empty);
 }