public void Setup()
        {
            _tagsManager            = Substitute.For <ITagsManager>();
            _courseCalculator       = Substitute.For <ICourseCalculator>();
            _velocityCalculator     = Substitute.For <IVelocityCalculator>();
            _tracksManager          = Substitute.For <ITracksManager>();
            _seperationEventChecker = Substitute.For <ISeperationEventChecker>();
            _uut = new TrackWarehouse(_tagsManager, _courseCalculator,
                                      _velocityCalculator, _tracksManager, _seperationEventChecker);

            _tracks = new List <Track> {
                new Track()
                {
                    Tag = "1"
                },
                new Track()
                {
                    Tag = "2"
                },
                new Track()
                {
                    Tag = "1"
                }
            };

            _tags = new List <string> {
                "1", "2"
            };
            // Det gør ingen forskel, hvad der står i x.Manage()
            _tagsManager.WhenForAnyArgs(x => x.Manage(ref _tags, _tracks))
            .Do(x => x[0] = _tags);
        }
        public TagsManagerMainView(ITagsManager tagsManager, TagsManagerMainViewModel model, 
            IIdeaManager ideaManager, IRelationManager relationManager, IBlockManager blockManager, IMaterialManager materialManager)
        {
            _relationManager = relationManager;
            _blockManager = blockManager;
            var db = new AllDb()
            {
                RelationManager = _relationManager,
                IdeaManager = ideaManager,
                BlockManager = _blockManager,
                TagsManager = tagsManager,
                MaterialManager = materialManager
            };
            InitializeComponent();
            _tagHelper = new TagTreeHelper(treeList, db);
            _tagHelper.ReloadTree();

            model.NodeAdded += dto =>
            {
                dto.AddNodeToTree(treeList);
                treeList.CurrentItem = dto;
            };

            model.NodeAnnihilated += dto => dto.AnnihilateNode(treeList);

            model.MaterialUpdate += dto => dto.UpdateMaterialInTree(treeList);

            Loaded += (sender, args) =>
            {
                DataContext = model;

                treeList.View.ValidateCell += (o, e) =>
                {
                    var wrong = Path.GetInvalidFileNameChars();
                    if (e.Value.ToString().Any(wrong.Contains))
                        e.IsValid = false;
                };

                treeList.View.PreviewKeyDown += (o, eventArgs) =>
                {
                    if (eventArgs.Key == Key.Enter || eventArgs.Key == Key.Return)
                    {
                        eventArgs.Handled = true;
                        treeList.View.CloseEditor();
                        RenameCurrent();
                    }
                };

                treeList.View.ShownEditor += ViewOnShownEditor;

                model.RenameTag += dto => Dispatcher.Invoke(() =>
                {
                    treeList.View.AllowEditing = true;
                    treeList.View.ShowEditor(true);
                }, DispatcherPriority.Background);

                model.Refresh += () => Dispatcher.Invoke(() => _tagHelper.ReloadTree(),
                    DispatcherPriority.Background);
            };
        }
Ejemplo n.º 3
0
 public MaterialsManager(DataBaseConnection db,
                         Sanitizer sanitizer,
                         ITagsManager tagsManager,
                         IOptions <MaterialsOptions> materialsOptions) : base(db)
 {
     this.tagsManager      = tagsManager;
     this.sanitizer        = sanitizer;
     this.materialsOptions = materialsOptions.Value;
 }
Ejemplo n.º 4
0
 public SyncTagRelatedBkCountJob(
     ILogger <SyncTagRelatedBkCountJob> logger,
     IBkManager bkManager,
     ITagsManager tagsManager)
 {
     _logger      = logger;
     _bkManager   = bkManager;
     _tagsManager = tagsManager;
 }
        public TagSelectorView(ITagsManager tagsManager, IIdeaManager ideaManager, 
            IBlockManager blockManager, IRelationManager relationManager, ISettingsService settingsService, IMaterialManager materialManager)
        {
            _settingsService = settingsService;
            var allDb = new AllDb
            {
                RelationManager = relationManager,
                BlockManager = blockManager,
                IdeaManager = ideaManager,
                TagsManager = tagsManager,
                MaterialManager = materialManager
            };

            InitializeComponent();
            Loaded += (sender, args) =>
            {
                var model = RegionContext.GetObservableContext(this).Value as ISelectTagRegionView;

                if (model != null)
                {
                    var selectItem = new DelegateCommand<Guid>(id =>
                    {
                        if (model.TargetType == typeof(Tag))
                            _settingsService.AddRecentTag(id);
                        if (model.TargetType == typeof(Idea))
                            _settingsService.AddRecentIdea(id);
                        if (model.TargetType == typeof(Block))
                            _settingsService.AddRecentBlock(id);
                        if (model.TargetType == typeof(Comment))
                            _settingsService.AddRecentComment(id);
                        if (model.TargetType == typeof(Guidable))
                            _settingsService.AddRecentGuidable(id);

                        model.OkCommand.Execute(id);
                    });
                    var items = model.TargetType == typeof (Tag)
                        ? _settingsService.GetRecentTags()
                        : model.TargetType == typeof (Idea)
                            ? _settingsService.GetRecentIdeas()
                            : model.TargetType == typeof (Block)
                                ? _settingsService.GetRecentBlocks()
                                : model.TargetType == typeof (Guidable)
                                    ? _settingsService.GetRecentGuidables()
                                    : _settingsService.GetRecentComments();

                    var recent = new BarSubItem() {CategoryName = "BuiltInMenus", Content = "Recent"};
                    MainMenu.Items.Add(recent);
                    foreach (var item in items.OrderByDescending(i => i.Order))
                        recent.Items.Add(new BarButtonItem{Content = item.Name,
                            CommandParameter = item.Id, Command = selectItem});
                }
                DataContext = model;
            };
            _tagHelper = new TagTreeHelper(treeList, allDb);
            _tagHelper.ReloadTree();
        }
Ejemplo n.º 6
0
        public static async Task <List <Tag> > GetMatchAsync(string term)
        {
            using (IUnityContainer unit = IoCConfiguration.container.CreateChildContainer())
            {
                ITagsManager manager = unit.Resolve <ITagsManager>();

                List <Tag> tags = await manager.FetchTagsWithMatchingName(term);

                return(tags);
            }
        }
Ejemplo n.º 7
0
 public ReaderController(IReaderManager readerManager,
                         IReaderHistoryManager readerHistoryManager,
                         ITagsManager tagsManager,
                         IRecommendationManager recommendationManager,
                         IUserManager userManager)
 {
     this.readerManager = readerManager;
     this.readerHistoryManager = readerHistoryManager;
     this.tagManager = tagsManager;
     this.recommendationManager = recommendationManager;
     this.userManager = userManager;
 }
Ejemplo n.º 8
0
 public KnowledgeCenterController(IResourceManager resourceManager
                                  , IReadRecordManager readRecordManager
                                  , ITagsManager tagsManager
                                  , ISortManager sortManager
                                  , IDeptManager deptManager)
 {
     _sortManager       = sortManager;
     _resourceManager   = resourceManager;
     _readRecordManager = readRecordManager;
     _tagsManager       = tagsManager;
     _deptManager       = deptManager;
 }
Ejemplo n.º 9
0
 public ReaderController(IReaderManager readerManager,
                         IReaderHistoryManager readerHistoryManager,
                         ITagsManager tagsManager,
                         IRecommendationManager recommendationManager,
                         IUserManager userManager)
 {
     this.readerManager         = readerManager;
     this.readerHistoryManager  = readerHistoryManager;
     this.tagManager            = tagsManager;
     this.recommendationManager = recommendationManager;
     this.userManager           = userManager;
 }
Ejemplo n.º 10
0
 public ItemsManager(IItemsCrudService itemsCrudService, ICollectionsManager collectionsManager, IModelValidatorsStore validatorsStore,
                     IModelAuthenticatorsStore authenticatorsStore, IResourcesManager resourcesManager, ITagsManager tagsManager, ICPUnitOfWork cPUnitOfWork, IMapper mapper)
 {
     this.mapper              = mapper;
     this.cPUnitOfWork        = cPUnitOfWork;
     this.itemsCrudService    = itemsCrudService;
     this.collectionsManager  = collectionsManager;
     this.validatorsStore     = validatorsStore;
     this.authenticatorsStore = authenticatorsStore;
     this.resourcesManager    = resourcesManager;
     this.tagsManager         = tagsManager;
 }
Ejemplo n.º 11
0
 public MaterialsManager(
     DataBaseConnection db,
     SanitizerService sanitizerService,
     ICategoriesCache categoriesCache,
     ITagsManager tagsManager,
     IOptions <MaterialsOptions> materialsOptions) : base(db)
 {
     this.tagsManager      = tagsManager;
     this.sanitizerService = sanitizerService;
     this.materialsOptions = materialsOptions.Value;
     this.categoriesCache  = categoriesCache;
 }
Ejemplo n.º 12
0
        public TrackWarehouse(ITagsManager tagsManager, ICourseCalculator courseCalculator,
                              IVelocityCalculator velocityCalculator, ITracksManager tracksManager,
                              ISeperationEventChecker seperationEventChecker)
        {
            _tagsManager            = tagsManager;
            _courseCalculator       = courseCalculator;
            _velocityCalculator     = velocityCalculator;
            _tracksManager          = tracksManager;
            _seperationEventChecker = seperationEventChecker;

            _tracksInAirspace = new List <Track>();
            _tagsInAirspace   = new List <string>();
        }
Ejemplo n.º 13
0
        private RateMyPClient()
        {
            var httpClient = new HttpClient();

            //httpClient.BaseAddress = new Uri("https://localhost:44382");
            httpClient.BaseAddress = new Uri("https://ratemypserver79.azurewebsites.net");
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            Teachers = new TeachersManager(httpClient);
            Students = new StudentsManager(httpClient);
            Ratings  = new RatingsManager(httpClient);
            Courses  = new CoursesManager(httpClient);
            Tags     = new TagsManager(httpClient);
        }
        public ConspEditorMainViewModel(IIdeaManager ideaManager, IMaterialManager materialManager,
            ITagsManager tagsManager, IParticlesManager particlesManager, IBlockManager blockManager,
            IEventAggregator eventAggregator, IRelationManager relationManager, ICommentManager commentManager)
        {
            _ideaManager = ideaManager;
            _materialManager = materialManager;
            _tagsManager = tagsManager;
            _particlesManager = particlesManager;
            _blockManager = blockManager;
            _eventAggregator = eventAggregator;
            _relationManager = relationManager;
            _commentManager = commentManager;
            Bookmarks = new List<string>();

            _eventAggregator.GetEvent<MaterialUpdatedEvent>().Subscribe(MaterialUpdated);
        }
        public CreateIdeaDlgViewModel(ITagsManager tagsManager, IParticlesManager particleManager,
            IIdeaManager ideaManager, IBlockManager blockManager, IEventAggregator eventAggregator)
        {
            _tagsManager = tagsManager;
            _particleManager = particleManager;
            _ideaManager = ideaManager;
            _blockManager = blockManager;
            _eventAggregator = eventAggregator;
            AddParticleVm = new AddParticleViewViewModel(_particleManager);
            OkCommand = new DelegateCommand<Window>((wnd) =>
            {
                var idea = _ideaManager.CreateIdea(Caption);
                if (_parentTag != null)
                    _ideaManager.AddTagToIdea(idea, _parentTag);

                if (AddParticleVm.AddParticle)
                    if (AddParticleVm.UseNewParticle)
                    {
                        var particle = _particleManager.CreateParticle(AddParticleVm.NewParticle.Material,
                            AddParticleVm.NewParticle.Begin, AddParticleVm.NewParticle.End);
                        _blockManager.AddParticleToBlock(idea, particle);
                    }
                    else if (AddParticleVm.UseExistParticle && AddParticleVm.ExistParticle.HasValue)
                    {
                        var particle = _particleManager.GetParticleById(AddParticleVm.ExistParticle.Value);
                        _blockManager.AddParticleToBlock(idea, particle);
                    }

                _eventAggregator.GetEvent<BlockAddedEvent>().Publish(idea.Id);
                wnd.DialogResult = true;
                wnd.Close();
            }, wnd => !String.IsNullOrWhiteSpace(Caption));

            SelectTagCommand = new DelegateCommand(() =>
            {
                var dlg = new SelectTagDlg(typeof (Tag));
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value && dlg.Id.HasValue)
                {
                    _parentTag = _tagsManager.GetTagById(dlg.Id.Value);
                    TagCaption = _parentTag.Caption;
                    AddToTag = true;
                }
            });
        }
Ejemplo n.º 16
0
        public async Task FetchTagsWithMatchingName_Meh()
        {
            VolatileMainDataset dataSet     = new VolatileMainDataset();
            Mock <ITagsManager> mockService = new Mock <ITagsManager>();

            mockService.Setup(s => s.FetchTagsWithMatchingName(It.IsAny <string>()))
            .Returns <string>(term => Task.FromResult <List <Tag> >(
                                  dataSet.Tags
                                  .Where(el => el.Name.Contains(term))
                                  .Select(el => el.ToExposed())
                                  .ToList())
                              );
            this.tagsManager = mockService.Object;

            List <Tag> tags = await this.tagsManager.FetchTagsWithMatchingName("Meh");

            Assert.AreEqual(1, tags.Count);
        }
        public void SetUp()
        {
            _transponderReceiver = Substitute.For <ITransponderReceiver>();
            _trackTransmitter    = new TrackTransmitter();
            _dateTimeBuilder     = new DateTimeBuilder();

            _trackObjectifier = new TrackObjectifier(_dateTimeBuilder);

            _trackReciever = new TrackReciever(_transponderReceiver,
                                               _trackObjectifier, _trackTransmitter);
            _output                 = Substitute.For <IOutput>();
            _tracksManager          = Substitute.For <ITracksManager>();
            _tagsManager            = Substitute.For <ITagsManager>();
            _courseCalculator       = Substitute.For <ICourseCalculator>();
            _velocityCalculator     = Substitute.For <IVelocityCalculator>();
            _seperationEventChecker = Substitute.For <ISeperationEventChecker>();

            _uut = new TrackWarehouse(_tagsManager, _courseCalculator,
                                      _velocityCalculator, _tracksManager, _seperationEventChecker);
            _atmController = new AtmController(_trackTransmitter, _output, _uut);


            _list = new List <string> {
                "ATR423;39045;12932;14000;20151006213456000"
            };

            _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; };

            // Arrange
            _tags = new List <string> {
                "ATR423"
            };
            _tagsManager.WhenForAnyArgs(x => x.Manage(ref _tags,
                                                      new List <Track>()))
            .Do(x => x[0] = _tags);

            // Act
            _transponderReceiver.TransponderDataReady +=
                Raise.EventWith(new RawTransponderDataEventArgs(_list));
        }
        public CreateIdeaDlgViewModel(ITagsManager tagsManager, IParticlesManager particleManager,
            IIdeaManager ideaManager, IBlockManager blockManager, IEventAggregator eventAggregator, ISettingsService settingsService)
        {
            _tagsManager = tagsManager;
            _particleManager = particleManager;
            _ideaManager = ideaManager;
            _blockManager = blockManager;
            _eventAggregator = eventAggregator;
            _settingsService = settingsService;

            RecentTags = new List<RecentTag>();
            RecentTags.AddRange(
                settingsService.GetRecentTags()
                    .Select(a => new RecentTag() {Id = a.Id, TagLong = a.Name,
                                                  TagShort = a.Name.Substring(0, Math.Min(a.Name.Length, 20)) + (Math.Min(a.Name.Length, 20) == 20 ? "...;" : ";")
                    }));

            AddParticleVm = new AddParticleViewViewModel(_particleManager);
            OkCommand = new DelegateCommand<Window>((wnd) =>
            {
                var idea = _ideaManager.CreateIdea(Caption);
                if (_parentTag != null)
                    _ideaManager.AddTagToIdea(idea, _parentTag);

                if (AddParticleVm.AddParticle)
                    if (AddParticleVm.UseNewParticle)
                    {
                        var particle = _particleManager.CreateParticle(AddParticleVm.NewParticle.Material,
                            AddParticleVm.NewParticle.Begin, AddParticleVm.NewParticle.End);
                        _blockManager.AddParticleToBlock(idea, particle);
                        ParticleId = particle.Id;
                    }
                    else if (AddParticleVm.UseExistParticle && AddParticleVm.ExistParticle.HasValue)
                    {
                        var particle = _particleManager.GetParticleById(AddParticleVm.ExistParticle.Value);
                        _blockManager.AddParticleToBlock(idea, particle);
                        ParticleId = particle.Id;
                    }

                IdeaId = idea.Id;
                _eventAggregator.GetEvent<BlockAddedEvent>().Publish(idea.Id);
                wnd.DialogResult = true;
                wnd.Close();
            }, wnd => !String.IsNullOrWhiteSpace(Caption));

            SelectTagCommand = new DelegateCommand(() =>
            {
                var dlg = new SelectTagDlg(typeof (Tag));
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value && dlg.Id.HasValue)
                {
                    _parentTag = _tagsManager.GetTagById(dlg.Id.Value);
                    TagCaption = _parentTag.Caption;
                    AddToTag = true;
                }
            });

            ClickTagCommand = new DelegateCommand<RecentTag>(rt =>
            {
                _parentTag = _tagsManager.GetTagById(rt.Id);
                TagCaption = _parentTag.Caption;
                AddToTag = true;
            });
        }
Ejemplo n.º 19
0
 public ArticleController(IArticleManager articleManager, ICommentsManager commentsManager, ITagsManager tagsManager)
 {
     this._articleManager  = articleManager;
     this._commentsManager = commentsManager;
     this._tagsManager     = tagsManager;
 }
        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);
                }
            });
        }
Ejemplo n.º 21
0
 public TagsApiController(ITagsManager tagsManager, IRecommendationManager recommendationManager)
 {
     this.tagsManager           = tagsManager;
     this.recommendationManager = recommendationManager;
 }
Ejemplo n.º 22
0
 public LayoutController(ITagsManager tagsManager)
 {
     this._tagsManager = tagsManager;
 }
Ejemplo n.º 23
0
 public TagsApiController(ITagsManager tagsManager, IRecommendationManager recommendationManager)
 {
     this.tagsManager = tagsManager;
     this.recommendationManager = recommendationManager;
 }
Ejemplo n.º 24
0
 public TagsController(ITagsManager mngr)
 {
     _tagsManager = mngr;
 }
Ejemplo n.º 25
0
 public TagService()
 {
     _tagManager = DependencyResolver.Current.GetService <ITagsManager>();
 }
Ejemplo n.º 26
0
 public TagController(ITagsManager tagsManager)
 {
     this._tagsManager = tagsManager;
 }