예제 #1
0
        public void Run()
        {
            _view.Attach(this);

            var            task      = _backgroundTaskFactory.GetTask();
            IList <string> databases = new List <string>();

            task.Action = () =>
            {
                databases = _databaseService.FindAll();
            };
            task.OnSuccess = () =>
            {
                _view.StopDatabaseListRefresh();
                _view.ShowDatabases(databases);
                _view.Database = _settingsService.GetDatabaseName();
            };
            task.OnError = error =>
            {
                _view.StopDatabaseListRefresh();
                _errorView.Run(error.Message);
            };
            _view.StartDatabaseListRefresh();
            task.Run();
        }