private void CreateRepository(RepositoryType t) { switch (t) { case RepositoryType.BINARY: fileService = new BinaryFileService(); break; case RepositoryType.TEXT: fileService = new TextFileService(); break; } if (t != RepositoryType.MEMORY && !CheckOpenSave) { try { if (dialogService.SaveFileDialog(Path, t) == true) { fileService.Save(dialogService.FilePath, Bicycles); RepositoryCreator.Initialize(t, dialogService.FilePath); Statusbar.SelectRepository(t, dialogService.FilePath); dialogService.ShowMessage("Файл создан"); } } catch (Exception ex) { dialogService.ShowMessage(ex.Message); } } if (t == RepositoryType.MEMORY) { RepositoryCreator.Initialize(t, dialogService.FilePath); RepositoryCreator.Repository.CreateRepository(); Statusbar.SelectMemoryRepository(); return; } CheckOpenSave = false; }