예제 #1
0
        public MainViewModel(
            IDataApiClient dataApiClient,
            DataVisualizer dataVisualizer,
            IReadonlyObjectDatabase <UserProfile> userDatabase,
            IReadonlyObjectDatabase <DataSet> dataSetDatabase,
            IReadonlyObjectDatabase <DataProject> dataProjectDatabase,
            IClipboard clipboard,
            IClosable mainWindow)
        {
            this.dataApiClient       = dataApiClient;
            this.userDatabase        = userDatabase;
            this.mainWindow          = mainWindow;
            DataSetMainViewModel     = new DataSetMainViewModel(dataApiClient, dataSetDatabase, dataProjectDatabase, clipboard);
            CollectionsMainViewModel = new CollectionsMainViewModel(dataApiClient, dataVisualizer, userDatabase, clipboard);

            var passwordBoxSpawner = new WpfPasswordBoxSpawner();
            var loginViewSpawner   = new WpfWindowSpawner <LoginViewModel>(vm => new LoginWindow {
                ViewModel = vm
            });
            var changePasswordViewSpawner = new WpfWindowSpawner <ChangePasswordViewModel>(vm => new ChangePasswordWindow {
                ViewModel = vm
            });

            UserSwitchViewModel = new UserSwitchViewModel(
                dataApiClient,
                LoginSuccessful,
                LoginFailed,
                passwordBoxSpawner,
                loginViewSpawner,
                changePasswordViewSpawner);
            OpenUserManagementWindowCommand = new RelayCommand(OpenUserManagementWindow);
            OpenAboutWindowCommand          = new RelayCommand(OpenAboutWindow);
        }
예제 #2
0
        public async void LoginSuccessful()
        {
            await CollectionsMainViewModel.Reload();

            UserSwitchViewModel.TriggerOnPropertyChangedEvents();
        }