CleanDetails() public method

public CleanDetails ( ) : void
return void
Ejemplo n.º 1
0
        public void Subscribe(SessionController sessionController)
        {
            var events = sessionController.SessionEventsObservable
                .ObserveOnDispatcher();

            _subscriptions = new List<IDisposable>
            {
                sessionController.SessionEventsObservable.OfType<MinorSessionUpdateEventArgs>()
                    .Where(e => e.EventType == OperationsState.Finished 
                            || e.EventType == OperationsState.Error)
                    .Subscribe(args =>
                    {
                        SessionFinished();
                    }),
                events.OfType<MinorSessionUpdateEventArgs>()
                    .Subscribe(args =>
                    {
                        SetState(args.EventType);
                        Switch.On(args.ProgressUpdateMode)
                            .Case(ProgressUpdateMode.SetValue, () =>
                            {
                                _viewModel.IsProgressIndeterminate = false;
                                _viewModel.Progress = args.PercentCompleted;
                            })
                            .Case(ProgressUpdateMode.Indeterminate, () =>
                            {
                                _viewModel.IsProgressIndeterminate = true;
                            })
                            .Case(ProgressUpdateMode.PreserveValue, ()=>
                            {
                               
                            });
                        
                    }),

                events.OfType<MutationFinishedEventArgs>()
                 .Subscribe(args => _viewModel.MutantAssemblies.ReplaceRange(args.MutantsGrouped)),

                events.OfType<TestingProgressEventArgs>()
                 .Subscribe(args =>
                 {
                         _viewModel.OperationsState = OperationsState.Testing;
                     _viewModel.OperationsStateDescription = args.Description;

                        _viewModel.Progress = args.NumberOfAllMutantsTested.AsPercentageOf(args.NumberOfAllMutants);
                 }),
                 events.OfType<MutationScoreInfoEventArgs>()
                 .Subscribe(args =>
                 {
            
                         if (args.NumberOfFirstOrderMutants!=0)
                         {
                            _viewModel.MutantsRatio = string.Format("Mutants killed: {0}/{1}(FOM:{2}) ", args.NumberOfMutantsKilled, args.NumberOfAllNonEquivalent, args.NumberOfFirstOrderMutants);
                         }
                         else
                         { 
                            _viewModel.MutantsRatio = string.Format("Mutants killed: {0}/{1}", args.NumberOfMutantsKilled, args.NumberOfAllNonEquivalent);
                         }
                         _viewModel.MutationScore = string.Format(@"Mutation score: {0}%", args.MutationScore.AsPercentageOf(1.0d));
                     if (args.NumberOfMarkedEq!=0)
                     {
                         _viewModel.MarkedEq = string.Format("Mutants equivalent: {0}", args.NumberOfMarkedEq);
                     }
                     else
                     {
                         _viewModel.MarkedEq = "";
                     }
                  
            
                 }),
               _viewModel.WhenPropertyChanged(vm => vm.SelectedMutationTreeItem).OfType<Mutant>()
                   .Subscribe(x =>
                   {
                       sessionController.LoadDetails(x);
                       sessionController.TestWithHighPriority(x);
                   } ),
               _viewModel.WhenPropertyChanged(vm => vm.SelectedMutationTreeItem).Where(i => !(i is Mutant))
                   .Subscribe(x => sessionController.CleanDetails()),
               _viewModel.WhenPropertyChanged(vm => vm.SelectedMutationTreeItem).Where(i => !(i is Mutant))
                   .Subscribe(x => sessionController.CleanDetails()),

                events.Subscribe((e) => { }, (e) => { }, () =>
                {
                    
                }),
            };

        }
Ejemplo n.º 2
0
        public void Subscribe(SessionController sessionController)
        {
            var events = sessionController.SessionEventsObservable
                         .ObserveOnDispatcher();

            _subscriptions = new List <IDisposable>
            {
                sessionController.SessionEventsObservable.OfType <MinorSessionUpdateEventArgs>()
                .Where(e => e.EventType == OperationsState.Finished ||
                       e.EventType == OperationsState.Error)
                .Subscribe(args =>
                {
                    SessionFinished();
                }),
                events.OfType <MinorSessionUpdateEventArgs>()
                .Subscribe(args =>
                {
                    SetState(args.EventType);
                    Switch.On(args.ProgressUpdateMode)
                    .Case(ProgressUpdateMode.SetValue, () =>
                    {
                        _viewModel.IsProgressIndeterminate = false;
                        _viewModel.Progress = args.PercentCompleted;
                    })
                    .Case(ProgressUpdateMode.Indeterminate, () =>
                    {
                        _viewModel.IsProgressIndeterminate = true;
                    })
                    .Case(ProgressUpdateMode.PreserveValue, () =>
                    {
                    });
                }),

                events.OfType <MutationFinishedEventArgs>()
                .Subscribe(args => _viewModel.MutantAssemblies.ReplaceRange(args.MutantsGrouped)),

                events.OfType <TestingProgressEventArgs>()
                .Subscribe(args =>
                {
                    _viewModel.OperationsState            = OperationsState.Testing;
                    _viewModel.OperationsStateDescription = args.Description;

                    _viewModel.Progress = args.NumberOfAllMutantsTested.AsPercentageOf(args.NumberOfAllMutants);
                }),
                events.OfType <MutationScoreInfoEventArgs>()
                .Subscribe(args =>
                {
                    if (args.NumberOfFirstOrderMutants != 0)
                    {
                        _viewModel.MutantsRatio = string.Format("Mutants killed: {0}/{1}(FOM:{2}) ", args.NumberOfMutantsKilled, args.NumberOfAllNonEquivalent, args.NumberOfFirstOrderMutants);
                    }
                    else
                    {
                        _viewModel.MutantsRatio = string.Format("Mutants killed: {0}/{1}", args.NumberOfMutantsKilled, args.NumberOfAllNonEquivalent);
                    }
                    _viewModel.MutationScore = string.Format(@"Mutation score: {0}%", args.MutationScore.AsPercentageOf(1.0d));
                    if (args.NumberOfMarkedEq != 0)
                    {
                        _viewModel.MarkedEq = string.Format("Mutants equivalent: {0}", args.NumberOfMarkedEq);
                    }
                    else
                    {
                        _viewModel.MarkedEq = "";
                    }
                }),
                _viewModel.WhenPropertyChanged(vm => vm.SelectedMutationTreeItem).OfType <Mutant>()
                .Subscribe(x =>
                {
                    sessionController.LoadDetails(x);
                    sessionController.TestWithHighPriority(x);
                }),
                _viewModel.WhenPropertyChanged(vm => vm.SelectedMutationTreeItem).Where(i => !(i is Mutant))
                .Subscribe(x => sessionController.CleanDetails()),
                _viewModel.WhenPropertyChanged(vm => vm.SelectedMutationTreeItem).Where(i => !(i is Mutant))
                .Subscribe(x => sessionController.CleanDetails()),

                events.Subscribe((e) => { }, (e) => { }, () =>
                {
                }),
            };
        }