Exemple #1
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            ISmartIndentationService smartIndentationService,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            IVimApplicationSettings vimApplicationSettings,
            IExtensionAdapterBroker extensionAdapterBroker,
            SVsServiceProvider serviceProvider,
            ITelemetryProvider telemetryProvider)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _dte                     = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility         = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager             = textManager;
            _sharedService           = sharedServiceFactory.Create();
            _vsMonitorSelection      = serviceProvider.GetService <SVsShellMonitorSelection, IVsMonitorSelection>();
            _vimApplicationSettings  = vimApplicationSettings;
            _smartIndentationService = smartIndentationService;
            _extensionAdapterBroker  = extensionAdapterBroker;

            _vsMonitorSelection.AdviseSelectionEvents(this, out uint cookie);

            InitTelemetry(telemetryProvider.GetOrCreate(vimApplicationSettings, _dte), vimApplicationSettings);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the Conference class.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="controlService"></param>
 /// <param name="conference"></param>
 /// <param name="sharedService"></param>
 /// <param name="lazyLoadChildren"></param>
 public ConferenceNodeViewModel(ITreeViewItemViewModel parent, ISeasonStandingsControlService controlService,
                                Conference conference, ISharedService sharedService = null, bool lazyLoadChildren = true)
     : base(parent, controlService, sharedService, lazyLoadChildren)
 {
     // Assign argument values to member fields.
     _conference = conference ?? throw new ArgumentNullException("conference");
 }
 public AuthController(IAccountService accountService, ISharedService sharedService, IAgencyService agencyService, IFacebookHelper facebookHelper)
 {
     _accountService = accountService;
     _sharedService  = sharedService;
     _agencyService  = agencyService;
     _facebookHelper = facebookHelper;
 }
 /// <summary>
 /// Initializes a new instance of the SeasonStandingsService class
 /// </summary>
 /// <param name="sharedService"></param>
 /// <param name="dataMapper"></param>
 /// <param name="storedProcedureRepository"></param>
 public SeasonStandingsService(ISharedService sharedService, IDataMapper dataMapper,
                               IStoredProcedureRepository storedProcedureRepository)
 {
     _sharedService             = sharedService;
     _dataMapper                = dataMapper;
     _storedProcedureRepository = storedProcedureRepository;
 }
Exemple #5
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            ISmartIndentationService smartIndentationService,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            IVimApplicationSettings vimApplicationSettings,
            SVsServiceProvider serviceProvider)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager = textManager;
            _sharedService = sharedServiceFactory.Create();
            _vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>();
            _fontProperties = new TextEditorFontProperties(serviceProvider);
            _vimApplicationSettings = vimApplicationSettings;
            _smartIndentationService = smartIndentationService;

            uint cookie;
            _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
        }
 public void SetUp()
 {
     _parent         = A.Fake <ITreeViewItemViewModel>();
     _controlService = A.Fake <ISeasonStandingsControlService>();
     _conference     = new Conference();
     _sharedService  = A.Fake <ISharedService>();
 }
 /// <summary>
 /// Initializes a new instance of the TeamSeasonsControlService class
 /// </summary>
 /// <param name="sharedService"></param>
 /// <param name="teamSeasonRepository"></param>
 /// <param name="storedProcedureRepository"></param>
 public TeamSeasonsControlService(ISharedService sharedService, IRepository <TeamSeason> teamSeasonRepository,
                                  IStoredProcedureRepository storedProcedureRepository)
 {
     _sharedService             = sharedService;
     _teamSeasonRepository      = teamSeasonRepository;
     _storedProcedureRepository = storedProcedureRepository;
 }
Exemple #8
0
 public AccountService(IAccountRepository accountRepository, IMovementService movementService,
                       ISharedService sharedService)
 {
     _accountRepository = accountRepository;
     _movementService   = movementService;
     _sharedService     = sharedService;
 }
Exemple #9
0
 public void SetUp()
 {
     _parent         = A.Fake <TreeViewItemViewModel>();
     _controlService = A.Fake <ISeasonStandingsControlService>();
     _division       = new Division();
     _sharedService  = A.Fake <ISharedService>();
 }
Exemple #10
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            IWordUtilFactory wordUtilFactory,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            SVsServiceProvider serviceProvider)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _wordUtilFactory = wordUtilFactory;
            _dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager = textManager;
            _sharedService = sharedServiceFactory.Create();
            _vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>();

            uint cookie;
            _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
        }
Exemple #11
0
 public AccountService(
     ILoggerFactory loggerFactory,
     UserManager <EDIApplicationUser> userManager,
     RoleManager <IdentityRole> roleManager,
     IAsyncRepository <Country> countryRepository,
     IAsyncRepository <Province> provinceRepository,
     IAsyncIdentityRepository accountRepository,
     IHostEnvironment hostingEnvironment,
     IHttpContextAccessor httpContextAccessor,
     IEmailSender emailSender,
     AuthenticationStateProvider authenticationStateProvider,
     ServiceContext dbContext,
     AppIdentityDbContext identityContext,
     ISharedService sharedService,
     UserSettings UserSettings,
     IOptions <EDIAppSettings> settings)
 {
     _logger = loggerFactory.CreateLogger <AccountService>();
     _httpContextAccessor         = httpContextAccessor;
     _userManager                 = userManager;
     _roleManager                 = roleManager;
     _countryRepository           = countryRepository;
     _provinceRepository          = provinceRepository;
     _accountRepository           = accountRepository;
     _hostingEnvironment          = hostingEnvironment;
     _authenticationStateProvider = authenticationStateProvider;
     _dbContext       = dbContext;
     _identityContext = identityContext;
     _emailSender     = emailSender;
     _userSettings    = UserSettings;
     POAppSettings    = settings.Value;
     _sharedService   = sharedService;
 }
 public ApiController(
     ISharedService sharedService,
     IPersonalService personalService)
 {
     this.sharedService   = sharedService;
     this.personalService = personalService;
 }
 /// <summary>
 /// Initializes a new instance of the DivisionViewModel class.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="controlService"></param>
 /// <param name="division"></param>
 /// <param name="sharedService"></param>
 /// <param name="lazyLoadChildren"></param>
 public DivisionNodeViewModel(ITreeViewItemViewModel parent, ISeasonStandingsControlService controlService,
                              Division division, ISharedService sharedService = null, bool lazyLoadChildren = false)
     : base(parent, controlService, sharedService, lazyLoadChildren)
 {
     // Assign argument values to member fields.
     _division = division ?? throw new ArgumentNullException("division");
 }
Exemple #14
0
 public SharedOrchestrator(
     ISharedService sharedService,
     IMapper mapper)
 {
     this.sharedService = sharedService;
     this.mapper        = mapper;
 }
Exemple #15
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            IWordUtilFactory wordUtilFactory,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            SVsServiceProvider serviceProvider)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _wordUtilFactory    = wordUtilFactory;
            _dte                = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility    = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager        = textManager;
            _sharedService      = sharedServiceFactory.Create();
            _vsMonitorSelection = serviceProvider.GetService <SVsShellMonitorSelection, IVsMonitorSelection>();

            uint cookie;

            _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
        }
Exemple #16
0
 public TeacherService(
     UserManager <EDIApplicationUser> userManager,
     ILoggerFactory loggerFactory,
     IAsyncRepository <Teacher> teacherRepository,
     IAsyncIdentityRepository accountRepository,
     IAsyncRepository <QuestionnairesDataTeacherProfile> profileRepository,
     IHostEnvironment hostingEnvironment,
     IHttpContextAccessor httpContextAccessor,
     AuthenticationStateProvider authenticationStateProvider,
     ServiceContext dbContext,
     AppIdentityDbContext identityContext,
     ISharedService sharedService,
     UserSettings UserSettings,
     IOptions <EDIAppSettings> settings)
 {
     _logger = loggerFactory.CreateLogger <TeacherService>();
     _httpContextAccessor         = httpContextAccessor;
     _teacherRepository           = teacherRepository;
     _accountRepository           = accountRepository;
     _profileRepository           = profileRepository;
     _hostingEnvironment          = hostingEnvironment;
     _userManager                 = userManager;
     _dbContext                   = dbContext;
     _identityContext             = identityContext;
     _authenticationStateProvider = authenticationStateProvider;
     _sharedService               = sharedService;
     _userSettings                = UserSettings;
     EDIppSettings                = settings.Value;
 }
 public void SetUp()
 {
     _parentControl        = A.Fake <ILeaguesTreeViewViewModel>();
     _controlService       = A.Fake <ISeasonStandingsControlService>();
     _league               = new League();
     _conferenceRepository = A.Fake <IRepository <Conference> >();
     _sharedService        = A.Fake <ISharedService>();
 }
Exemple #18
0
 public void SetUp()
 {
     _sharedService             = A.Fake <ISharedService>();
     _leagueRepository          = A.Fake <IRepository <League> >();
     _conferenceRepository      = A.Fake <IRepository <Conference> >();
     _divisionRepository        = A.Fake <IRepository <Division> >();
     _storedProcedureRepository = A.Fake <IStoredProcedureRepository>();
 }
        public void SetUp()
        {
            _sharedService  = A.Fake <ISharedService>();
            _controlService = A.Fake <IGamesWindowService>();

            _gameFinderWindow             = A.Fake <IGameFinderWindow>();
            _gameFinderWindow.DataContext = A.Fake <IGameFinderWindowViewModel>();
        }
Exemple #20
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="serviceHandlers">The service handler container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public OnDataCollectionContext(
     IServiceHandlers serviceHandlers
     , IDataCollection collector
     , ISharedService sharedServices
     , MicroserviceId originatorId
     , IMicroserviceDispatch outgoingRequest) : base(serviceHandlers, collector, sharedServices, originatorId, outgoingRequest)
 {
 }
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="rq">The incoming request.</param>
 /// <param name="rsCol">The outgoing response collection.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public CommandMethodRequestContext(TransmissionPayload rq, List <TransmissionPayload> rsCol
                                    , IPayloadSerializationContainer serializer
                                    , IDataCollection collector
                                    , ISharedService sharedServices
                                    , MicroserviceId originatorId
                                    , ICommandOutgoing outgoingRequest) : base(rq, rsCol, serializer, collector, sharedServices, originatorId, outgoingRequest)
 {
 }
Exemple #22
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public OnDataCollectionContext(
     IPayloadSerializationContainer serializer
     , IDataCollection collector
     , ISharedService sharedServices
     , MicroserviceId originatorId
     , IMicroserviceDispatch outgoingRequest) : base(serializer, collector, sharedServices, originatorId, outgoingRequest)
 {
 }
Exemple #23
0
        /// <summary>
        /// Initializes a new instance of the GamesWindowViewModel class
        /// </summary>
        /// <param name="sharedService"></param>
        /// <param name="controlService"></param>
        /// <param name="gameFinder"></param>
        public GamesWindowViewModel(ISharedService sharedService, IGamesWindowService controlService,
                                    IGameFinderWindow gameFinder)
            : base(sharedService)
        {
            _controlService = controlService;

            GameFinder = gameFinder;
        }
        /// <summary>
        /// Initializes a new instance of the GameFinderWindow class
        /// </summary>
        public GameFinderWindow()
        {
            InitializeComponent();

            _sharedService = WpfGlobals.Container.Resolve <ISharedService>();

            DataContext = WpfGlobals.Container.Resolve <IGameFinderWindowViewModel>();
        }
 /// <summary>
 /// This is the method that register the shared service reference.
 /// </summary>
 protected override void SharedServicesChange(ISharedService sharedServices)
 {
     base.SharedServicesChange(sharedServices);
     if (mSharedServices != null)
     {
         mSharedServices.RegisterService <IEntityCacheAsync <K, E> >(this);
     }
 }
Exemple #26
0
 /// <summary>
 /// This method is called to set or remove the shared service reference.
 /// You can override your logic to safely set the shared service collection here.
 /// </summary>
 /// <param name="sharedServices">The shared service reference or null if this is not set.</param>
 protected virtual void SharedServicesChange(ISharedService sharedServices)
 {
     mSharedServices = sharedServices;
     if (mSharedServices != null)
     {
         RegisterSupportedMessages();
         mSharedServices.RegisterService <IChannelService>(this, "Channel");
     }
 }
Exemple #27
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="rq">The incoming request.</param>
 /// <param name="rsCol">The outgoing response collection.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 public CommandMethodInlineContext(TransmissionPayload rq, List <TransmissionPayload> rsCol
                                   , IPayloadSerializationContainer serializer
                                   , IDataCollection collector
                                   , ISharedService sharedServices
                                   , MicroserviceId originatorId) : base(serializer, collector, sharedServices, originatorId)
 {
     Request   = rq;
     Responses = rsCol;
 }
Exemple #28
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="schedule">The incoming schedule.</param>
 /// <param name="token">The cancellation token.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 public CommandScheduleInlineContext(Schedule schedule, CancellationToken token
                                     , IPayloadSerializationContainer serializer
                                     , IDataCollection collector
                                     , ISharedService sharedServices
                                     , MicroserviceId originatorId) : base(serializer, collector, sharedServices, originatorId)
 {
     Schedule = schedule;
     Token    = token;
 }
        /// <summary>
        /// Initializes a new instance of the StandingsControlViewModel class
        /// </summary>
        /// <param name="controlService"></param>
        public SeasonStandingsControlViewModel(ISharedService sharedService,
                                               ISeasonStandingsControlService controlService, IRepository <Conference> conferenceRepository)
            : base(sharedService)
        {
            _controlService       = controlService;
            _conferenceRepository = conferenceRepository;

            _leaguesTreeViewViewModel = null;
        }
Exemple #30
0
 public HomeController(IHostingEnvironment hostingEnvironment, IFileHelper fileHelper, ISharedService sharedService,
                       IAccountService __IAccountService, IFacebookJob __IFacebookJob)
 {
     _hostingEnvironment = hostingEnvironment;
     _fileHelper         = fileHelper;
     _sharedService      = sharedService;
     _accountService     = __IAccountService;
     _IFacebookJob       = __IFacebookJob;
 }
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="rq">The incoming request.</param>
 /// <param name="rsCol">The outgoing response collection.</param>
 /// <param name="serviceHandlers">The service handlers container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public CommandRequestContextBase(TransmissionPayload rq, List <TransmissionPayload> rsCol
                                  , IServiceHandlers serviceHandlers
                                  , IDataCollection collector
                                  , ISharedService sharedServices
                                  , MicroserviceId originatorId
                                  , O outgoingRequest) : base(serviceHandlers, collector, sharedServices, originatorId, outgoingRequest)
 {
     Request   = rq;
     Responses = rsCol;
 }
 public AccountCampaignController(ISharedService sharedService,
                                  IFacebookHelper facebookHelper,
                                  IAccountService accountService,
                                  ICampaignService campaignService)
 {
     _facebookHelper  = facebookHelper;
     _campaignService = campaignService;
     _sharedService   = sharedService;
     _accountService  = accountService;
 }
Exemple #33
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextBufferFactoryService textBufferFactoryService,
     ISharedService sharedService,
     SVsServiceProvider serviceProvider)
 {
     _vsAdapter = adapter;
     _serviceProvider = serviceProvider;
     _textManager = _serviceProvider.GetService<SVsTextManager, IVsTextManager>();
     _textDocumentFactoryService = textDocumentFactoryService;
     _textBufferFactoryService = textBufferFactoryService;
     _runningDocumentTable = _serviceProvider.GetService<SVsRunningDocumentTable, IVsRunningDocumentTable>();
     _sharedService = sharedService;
 }
 public IdeaManager(IDbInteropService dbInterop, ISharedService shared)
 {
     _dbInterop = dbInterop;
     _shared = shared;
 }
        public TagsManagerMainViewModel(ITagsManager tagsManager, IBlockManager blockManager,
            EventAggregator eventAggregator, IReferenceManager referenceManager, IRelationManager relationManager,
            IIdeaManager ideaManager, ISharedService shared, IMaterialManager materialManager, IParticlesManager particlesManager)
        {
            _eventAggregator = eventAggregator;
            _shared = shared;

            _db = new AllDb()
            {
                TagsManager = tagsManager,
                RelationManager = relationManager,
                IdeaManager = ideaManager,
                BlockManager = blockManager,
                MaterialManager = materialManager,
                ParticlesManager = particlesManager
            };

            _eventAggregator.GetEvent<BlockAddedEvent>().Subscribe(guid =>
            {
                var block = _db.BlockManager.GetBlockById(guid);
                if (block is Idea)
                {
                    var ideaDto = IdeaDto.FromBase(block as Idea, _db);
                    OnNodeAdded(ideaDto);
                }
                if (block is Relation)
                {
                    var relDto = RelationDto.FromBase(block as Relation, _db);
                    OnNodeAdded(relDto);
                }
                if (block is Comment)
                {
                    var commDto = CommentDto.FromBase(block as Comment, _db);
                    OnNodeAdded(commDto);
                }
            });

            _eventAggregator.GetEvent<DatabaseImportedEvent>().Subscribe(s => OnRefresh());

            _eventAggregator.GetEvent<MaterialUpdatedEvent>().Subscribe(guid =>
            {
                var mat = _db.MaterialManager.GetMaterialById(guid);
                var matDto = MaterialDto.FromBase(mat, _db);
                OnMaterialUpdate(matDto as MaterialDto);
            });

            NewTagCommand = new DelegateCommand<TreeItemDto>((dto) =>
            {
                if (dto == null || dto is TagDto)
                {
                    var added = _db.TagsManager.AddTag(dto == null ? null : (Guid?) dto.Id, "New tag");
                    var addedDto = TagDto.FromBase(added, _db);
                    OnNodeAdded(addedDto);
                    OnRenameTag(addedDto);
                }
            });

            NewIdeaCommand = new DelegateCommand<TreeItemDto>(dto =>
            {
                /*var added = _ideaManager.CreateIdea("New idea");
                var addedDto = _map.Map<IdeaDto>(added);
                OnNodeAdded(addedDto);
                OnRenameTag(addedDto);*/
            });

            AddReferenceCommand = new DelegateCommand<TreeItemDto>(dto =>
            {
                if (dto is IdeaDto || dto is RelationDto)
                {
                    var dlgVm = new CreateReferenceDlgViewModel(_db.BlockManager, dto);
                    if (shared.SelectedParticle != Guid.Empty)
                    {
                        var pis = _db.ParticlesManager.GetParticleInplacesForParticle(shared.SelectedParticle);
                        if (pis != null && pis.Any())
                        {
                            var block = _db.BlockManager.GetBlockById(pis.First().BlockId) as Idea;
                            if (block != null)
                                dlgVm.Block2 = new NamedGuid() {Caption = block.Caption, Uid = block.Id};
                        }
                    }

                    var dlg = new CreateReferenceDlg(dlgVm);
                    var res = dlg.ShowDialog();
                    if (res.HasValue && res.Value)
                    {
                        if (dlgVm.IsTo || dlgVm.IsBoth)
                        {
                            var refer = referenceManager.CreateReference(dlgVm.Block1.Uid, dlgVm.Block2.Uid);
                            OnNodeAdded(ReferenceDto.FromBase(refer, _db));
                        }
                        if (dlgVm.IsFrom || dlgVm.IsBoth)
                        {
                            var refer = referenceManager.CreateReference(dlgVm.Block2.Uid, dlgVm.Block1.Uid);
                            OnNodeAdded(ReferenceDto.FromBase(refer, _db));
                        }
                    }
                }
            });

            ClearCommand = new DelegateCommand(() =>
            {
                tagsManager.DeleteAllTAgs();
                OnRefresh();
            });

            OpenIdeaCommand = new DelegateCommand<TreeItemDto>(dto =>
            {
                if (dto is IdeaDto)
                    Interfaces.CompositeCommands.OpenBlockCommand.Execute(dto.Id);
                if (dto is MaterialDto)
                    Interfaces.CompositeCommands.OpenSourceCommand.Execute(dto.Id);
            });

            RenameCommand = new DelegateCommand<TreeItemDto>(OnRenameTag);

            AddCurrentMaterialCommand = new DelegateCommand<TagDto>(dto =>
            {
                if (_shared.CurrentMaterial.HasValue)
                {
                    _db.TagsManager.ApplyTagToMaterial(_shared.CurrentMaterial.Value, dto.Id);
                    var m = _db.MaterialManager.GetMaterialById(_shared.CurrentMaterial.Value);
                    var addedDto = MaterialDto.FromBase(m, _db);
                    OnNodeAdded(addedDto);
                }
            });

            DeleteCommand = new DelegateCommand<TreeItemDto>(dto =>
            {
                if (dto is IdeaDto)
                {
                    _db.IdeaManager.DeleteIdea((dto as IdeaDto).Id);
                    NodeAnnihilated(dto);
                }
            });
        }
        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);
        }