public StartupViewModel(IShell shell, IAppModel appModel) { shell_ = shell; appModel_ = appModel; appModel_.LoadConfig(); var recent = appModel_.GetRecentDocuments(); BaseList = new ReactiveList <string>(recent); OpenRecentDbCommand = ReactiveCommand.Create <string>(uri => { if (!OpenBoardView(uri)) { appModel_.RemoveRecent(uri); appModel_.SaveConfig(); BaseList.Remove(uri); DialogCoordinator.Instance.ShowMessageAsync(this, "Ошибка", "База была удалена или перемещена из данной папки"); } }); NewDbCommand = ReactiveCommand.Create(() => shell.ShowView <WizardView>()); OpenDbCommand = ReactiveCommand.Create(() => { var dialog = new OpenFileDialog() { Filter = "SQLite DataBase | *.db", Title = "Открытие базы" }; if (dialog.ShowDialog() == DialogResult.OK) { OpenBoardView(dialog.FileName); } }); }//ctor
} //ctor private void RemoveRecent(string uri) { appModel.RemoveRecent(uri); appModel.SaveConfig(); BaseList.PublishCollection(appModel.GetRecentDocuments().Take(3)); }