Пример #1
0
        public ExceptionViewModel(Exception exception, IApplicationService applicationService)
        {
            _exception          = exception;
            _applicationService = applicationService;

            OpenLogFolderCommand = ReactiveCommand.Create(Observable.Return(_applicationService.LogFolder != null))
                                   .DisposeWith(this);

            CopyCommand = ReactiveCommand.Create(Observable.Return(exception != null))
                          .DisposeWith(this);

            ContinueCommand = ReactiveCommand.Create()
                              .DisposeWith(this);

            ExitCommand = ReactiveCommand.Create()
                          .DisposeWith(this);

            RestartCommand = ReactiveCommand.Create()
                             .DisposeWith(this);

            OpenLogFolderCommand.ActivateGestures()
            .Subscribe(x => OpenLogFolder())
            .DisposeWith(this);

            CopyCommand.ActivateGestures()
            .Subscribe(x => Copy())
            .DisposeWith(this);

            ContinueCommand.ActivateGestures()
            .Subscribe(x => Continue())
            .DisposeWith(this);

            ExitCommand
            .ActivateGestures()
            .Subscribe(x => Exit())
            .DisposeWith(this);

            RestartCommand
            .ActivateGestures()
            .Subscribe(x => Restart())
            .DisposeWith(this);

            Closed.Take(1)
            .Subscribe(x =>
            {
                // Force all other potential exceptions to be realized
                // from the Finalizer thread to surface to the UI
                GC.Collect(2, GCCollectionMode.Forced);
                GC.WaitForPendingFinalizers();
            })
            .DisposeWith(this);
        }
        public ExceptionViewModel(Exception exception, IApplicationService applicationService)
        {
            _exception          = exception;
            _applicationService = applicationService;

            OpenLogFolderCommand = ReactiveCommand.Create(Observable.Return(_applicationService.LogFolder != null))
                                   .DisposeWith(this);

            CopyCommand = ReactiveCommand.Create(Observable.Return(exception != null))
                          .DisposeWith(this);

            ContinueCommand = ReactiveCommand.Create()
                              .DisposeWith(this);

            ExitCommand = ReactiveCommand.Create()
                          .DisposeWith(this);

            RestartCommand = ReactiveCommand.Create()
                             .DisposeWith(this);

            OpenLogFolderCommand.ActivateGestures()
            .Subscribe(x => OpenLogFolder())
            .DisposeWith(this);

            CopyCommand.ActivateGestures()
            .Subscribe(x => Copy())
            .DisposeWith(this);

            ContinueCommand.ActivateGestures()
            .Subscribe(x => Continue())
            .DisposeWith(this);

            ExitCommand
            .ActivateGestures()
            .Subscribe(x => Exit())
            .DisposeWith(this);

            RestartCommand
            .ActivateGestures()
            .Subscribe(x => Restart())
            .DisposeWith(this);
        }