public ShellMainViewModel(IExportService exportService, IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, ISharedService shared) { _exportService = exportService; _regionManager = regionManager; _container = container; _eventAggregator = eventAggregator; _shared = shared; ExportFilesCommand = new DelegateCommand(() => _exportService.ExportToFileSystem("c:\\ext\\todel")); ExportZipCommand = new DelegateCommand(() => _exportService.ExportDoubleZipPasswordToFileSystem("c:\\ext\\todel\\conspector.zip", "123")); ExportGitCommand = new DelegateCommand(() => { var dlg = new GetPasswordDlg(); var result = dlg.ShowDialog(); if (result != null && result.Value) _exportService.ExportDoubleZipPasswordToGit("c:\\Ext\\GIT\\Stumps", dlg.Password); }); ExportGitPublicCommand = new DelegateCommand(() => { var dlg = new GetPasswordDlg(); var result = dlg.ShowDialog(); if (result != null && result.Value) _exportService.ExportPublicGit(dlg.Password); }); ImportGitPublicCommand = new DelegateCommand(() => { var res = MessageBox.Show(@"Подтверждение", @"Вы уверены, что хотите импортировать данные из публичного репозитория?", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { _exportService.ImportGitPublic(); _eventAggregator.GetEvent<DatabaseImportedEvent>().Publish("Imported"); } }); ImportZipCommand = new DelegateCommand(() => { var dlg = new GetPasswordDlg(); var result = dlg.ShowDialog(); if (result != null && result.Value) { _exportService.ImportDoubleZip( "c:\\ext\\Git\\stumps\\conspector.zip", dlg.Password); _eventAggregator.GetEvent<DatabaseImportedEvent>().Publish("Imported"); } }); ImportFilesCommand = new DelegateCommand(() => { _exportService.ImportFromFileSystem("c:\\ext\\todel"); _eventAggregator.GetEvent<DatabaseImportedEvent>().Publish("Imported"); }); ImportFolderCommand = new DelegateCommand(() => { _exportService.ImportFolder("c:\\ext\\todel\\Conspector"); _eventAggregator.GetEvent<DatabaseImportedEvent>().Publish("Imported"); }); ActiveMaterialChangeCommand = new DelegateCommand<SelectedItemChangedEventArgs>(args => { var a = args.Item as DocumentPanel; if (a != null) { var b = a.Content as IItemRegionView; if (b != null) _shared.SetCurrentMaterial(b.PanelId); } }); var openFile = new DelegateCommand<Guid?> (s => { var region = _regionManager.Regions[Top.RegionNames.DocumentViewRegion]; var view = region.Views .OfType<IDocumentViewerRegionView>() .FirstOrDefault(v => v.PanelId == s); if (view != null) region.Activate(view); else { var newView = _container.Resolve<IDocumentViewerRegionView>(); newView.OpenMaterial(s ?? Guid.Empty); region.Add(newView); } }); Interfaces.CompositeCommands.OpenSourceCommand.RegisterCommand(openFile); var openBlock = new DelegateCommand<Guid?> (s => { var region = _regionManager.Regions[Top.RegionNames.DocumentViewRegion]; var view = region.Views .OfType<IBlockViewerRegionView>() .FirstOrDefault(v => v.PanelId == s); if (view != null) region.Activate(view); else { var newView = _container.Resolve<IBlockViewerRegionView>(); if (s != null) { newView.OpenBlock(s.Value); region.Add(newView); } } }); Interfaces.CompositeCommands.OpenBlockCommand.RegisterCommand(openBlock); }