Exemplo n.º 1
0
 public UserSwitchViewModel(
     IDataApiClient dataApiClient,
     Action loginSuccessfulCallback,
     Action loginFailedCallback,
     IPasswordBoxSpawner passwordBoxSpawner,
     IViewSpawner <LoginViewModel> loginViewSpawner,
     IViewSpawner <ChangePasswordViewModel> changePasswordViewSpawner)
 {
     this.dataApiClient           = dataApiClient;
     this.loginSuccessfulCallback = loginSuccessfulCallback;
     this.loginFailedCallback     = loginFailedCallback;
     this.loginViewSpawner        = loginViewSpawner;
     LoginViewModel         = new LoginViewModel(dataApiClient, passwordBoxSpawner, changePasswordViewSpawner);
     OpenLoginWindowCommand = new RelayCommand(OpenLoginWindow);
 }
Exemplo n.º 2
0
        public CreateProjectViewModel(
            IDataApiClient dataApiClient,

            IObjectDatabase <DataProject> projectDatabase,
            IObjectDatabase <DataCollectionProtocol> protocolDatabase,
            IObjectDatabase <DataCollectionProtocolParameter> protocolParameterDatabase,
            IViewSpawner <CreateProtocolViewModel> createProtocolViewSpawner)
        {
            this.dataApiClient = dataApiClient;

            this.projectDatabase           = projectDatabase;
            this.protocolDatabase          = protocolDatabase;
            this.protocolParameterDatabase = protocolParameterDatabase;
            this.createProtocolViewSpawner = createProtocolViewSpawner;
            ProtocolsAutoCompleteViewModel = new AutoCompleteTextBoxViewModel <DataCollectionProtocol>(
                x => x.Id,
                protocolDatabase,
                new DataCollectionProtocolAutoCompleteMatcher());
            CreateNewProtocolCommand = new RelayCommand(CreateNewProtocol);
            EditProtocolCommand      = new RelayCommand(EditProtocol, () => ProtocolsAutoCompleteViewModel.SelectedObject != null);
            SaveCommand   = new AsyncRelayCommand <IClosable>(Save, CanSave);
            CancelCommand = new RelayCommand <IClosable>(closable => closable.Close(false));
        }