Beispiel #1
0
        public void CompareAll(object ownerViewModel)
        {
            Messenger.Default.Send(new PerformingComparisonMessage());
            var generator = new VarietyPairGenerator();
            generator.Process(_projectService.Project);

            var pipeline = new MultiThreadedPipeline<VarietyPair>(GetCompareProcessors());

            var progressVM = new ProgressViewModel(vm =>
                {
                    vm.Text = "Comparing all variety pairs...";
                    pipeline.Process(_projectService.Project.VarietyPairs);
                    while (!pipeline.WaitForComplete(500))
                    {
                        if (vm.Canceled)
                        {
                            pipeline.Cancel();
                            pipeline.WaitForComplete();
                            break;
                        }
                    }
                    if (vm.Canceled)
                    {
                        _projectService.Project.VarietyPairs.Clear();
                    }
                    else
                    {
                        vm.Text = "Analyzing results...";
                        Messenger.Default.Send(new ComparisonPerformedMessage());
                    }
                }, false, true);
            pipeline.ProgressUpdated += (sender, e) => progressVM.Value = e.PercentCompleted;

            _dialogService.ShowModalDialog(ownerViewModel, progressVM);
        }
Beispiel #2
0
        public void StemAll(object ownerViewModel, StemmingMethod method)
        {
            if (method == StemmingMethod.Automatic)
            {
                foreach (Variety variety in _projectService.Project.Varieties)
                {
                    variety.Affixes.Clear();
                }
            }

            var pipeline   = new MultiThreadedPipeline <Variety>(GetStemProcessors(method));
            var progressVM = new ProgressViewModel(pvm =>
            {
                pvm.Text = "Stemming all varieties...";
                pipeline.Process(_projectService.Project.Varieties);
                while (!pipeline.WaitForComplete(100))
                {
                    if (pvm.Canceled)
                    {
                        pipeline.Cancel();
                        pipeline.WaitForComplete();
                    }
                }
            }, false, true);

            pipeline.ProgressUpdated += (sender, e) => progressVM.Value = e.PercentCompleted;

            _dialogService.ShowModalDialog(ownerViewModel, progressVM);
            Messenger.Default.Send(new DomainModelChangedMessage(true));
        }
Beispiel #3
0
        public void SegmentAll()
        {
            var pipeline = new MultiThreadedPipeline <Variety>(GetSegmentProcessors());

            pipeline.Process(Project.Varieties);
            pipeline.WaitForComplete();
        }
Beispiel #4
0
        public void SegmentAll()
        {
            _busyService.ShowBusyIndicatorUntilFinishDrawing();
            var pipeline = new MultiThreadedPipeline <Variety>(GetSegmentProcessors());

            pipeline.Process(_projectService.Project.Varieties);
            pipeline.WaitForComplete();
        }
Beispiel #5
0
        public void CompareAll(object ownerViewModel)
        {
            if (_projectService.Project.Varieties.Count == 0 || _projectService.Project.Meanings.Count == 0)
            {
                return;
            }

            Messenger.Default.Send(new PerformingComparisonMessage());
            var generator = new VarietyPairGenerator();

            generator.Process(_projectService.Project);

            var pipeline = new MultiThreadedPipeline <VarietyPair>(GetCompareProcessors());

            var progressVM = new ProgressViewModel(vm =>
            {
                vm.Text = "Comparing all variety pairs...";
                pipeline.Process(_projectService.Project.VarietyPairs);
                while (!pipeline.WaitForComplete(500))
                {
                    if (vm.Canceled)
                    {
                        pipeline.Cancel();
                        pipeline.WaitForComplete();
                        break;
                    }
                }
                if (vm.Canceled)
                {
                    _projectService.Project.VarietyPairs.Clear();
                }
                else
                {
                    vm.Text = "Analyzing results...";
                    Messenger.Default.Send(new ComparisonPerformedMessage());
                }
            }, false, true);

            pipeline.ProgressUpdated += (sender, e) => progressVM.Value = e.PercentCompleted;

            _dialogService.ShowModalDialog(ownerViewModel, progressVM);
        }
Beispiel #6
0
 public void SegmentAll()
 {
     var pipeline = new MultiThreadedPipeline<Variety>(GetSegmentProcessors());
     pipeline.Process(Project.Varieties);
     pipeline.WaitForComplete();
 }
Beispiel #7
0
        public void StemAll(object ownerViewModel, StemmingMethod method)
        {
            if (method == StemmingMethod.Automatic)
            {
                foreach (Variety variety in _projectService.Project.Varieties)
                    variety.Affixes.Clear();
            }

            var pipeline = new MultiThreadedPipeline<Variety>(GetStemProcessors(method));
            var progressVM = new ProgressViewModel(pvm =>
                {
                    pvm.Text = "Stemming all varieties...";
                    pipeline.Process(_projectService.Project.Varieties);
                    while (!pipeline.WaitForComplete(100))
                    {
                        if (pvm.Canceled)
                        {
                            pipeline.Cancel();
                            pipeline.WaitForComplete();
                        }
                    }
                }, false, true);
            pipeline.ProgressUpdated += (sender, e) => progressVM.Value = e.PercentCompleted;

            _dialogService.ShowModalDialog(ownerViewModel, progressVM);
            Messenger.Default.Send(new DomainModelChangedMessage(true));
        }
Beispiel #8
0
 public void SegmentAll()
 {
     _busyService.ShowBusyIndicatorUntilFinishDrawing();
     var pipeline = new MultiThreadedPipeline<Variety>(GetSegmentProcessors());
     pipeline.Process(_projectService.Project.Varieties);
     pipeline.WaitForComplete();
 }