Пример #1
0
        public NewProfileViewModel(IMediator mediator, IDialogManager dialogManager)
        {
            DisplayName    = "New profile";
            _mediator      = mediator;
            _dialogManager = dialogManager;

            Validator = new NewProfileValidator();

            ReactiveCommand.CreateAsyncTask(this.WhenAnyValue(x => x.IsValid), x => CreateProfile())
            .SetNewCommand(this, x => x.CreateCommand)
            .Subscribe();

            // Must gray out if Creation running...
            ReactiveCommand.Create(CreateCommand.IsExecuting.Select(x => !x))
            .SetNewCommand(this, x => x.CancelCommand).Subscribe(x => TryClose());

            ClearErrors();

            Activator = new ViewModelActivator();

            this.WhenActivated(x => {
                BaseProfiles.ElementAt(0).Name = "Default (global profile)";
                ParentProfile = BaseProfiles.First();
            });
        }
Пример #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         BaseProfiles.Dispose();
     }
 }