Exemple #1
0
        public TagBase Create(ITagModel tagModel)
        {
            TagBase tag = null;

            switch (tagModel.Type)
            {
            case TagType.Text:
                tag = CreateTextTag(tagModel);
                break;

            case TagType.Icon:
                tag = CreateIconTag(tagModel);
                break;

            case TagType.Area:
                tag = CreateAreaTag(tagModel);
                break;

            case TagType.Vector:
                tag = CreateVectorTag(tagModel);
                break;
            }

            if (tag != null)
            {
                tag.Id          = tagModel.Id;
                tag.DataContext = tagModel;
            }

            return(tag);
        }
 public static TagViewModel ConvertModelToViewModel(ITagModel tag)
 {
     return(new TagViewModel()
     {
         Id = tag.Id, Name = tag.Name
     });
 }
 public void Create(ITagModel tag)
 {
     if (tag != null)
     {
         var dto = ModelConverter.ConvertTagModelToDto(tag);
         DalFactory.TagHandler.Create(dto);
     }
 }
Exemple #4
0
 public void Edit(ITagModel tag)
 {
     if (tag != null)
     {
         TagDto dto = ModelConverter.ConvertTagModelToDto(tag);
         DalFactory.TagHandler.Update(dto);
     }
 }
Exemple #5
0
        public static TagDto ConvertTagModelToDto(ITagModel model)
        {
            _tagDto = new TagDto()
            {
                Id   = model.Id,
                Name = model.Name
            };

            return(_tagDto);
        }
Exemple #6
0
        private VectorTag CreateVectorTag(ITagModel tagModel)
        {
            VectorTag tag = new VectorTag();

            SetTagBasePropertyBinding(tag);
            SetLineTextTagBasePropertyBindings(tag);
            SetVectorTagPropertyBindings(tag);

            return(tag);
        }
Exemple #7
0
        private AreaTag CreateAreaTag(ITagModel tagModel)
        {
            AreaTag tag = new AreaTag();

            SetTagBasePropertyBinding(tag);
            SetLineTextTagBasePropertyBindings(tag);
            SetAreaTagPropertyBindings(tag);

            return(tag);
        }
Exemple #8
0
        private IconTag CreateIconTag(ITagModel tagModel)
        {
            tagModel.TagNameVisibility = Visibility.Collapsed;
            IconTag tag = new IconTag();

            SetTagBasePropertyBinding(tag);
            SetIconTagPropertyBindings(tag);

            return(tag);
        }
Exemple #9
0
        private void TagModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Location")
            {
                ITagModel tagModel = sender as ITagModel;

                if (_tagCacheDict.TryGetValue(tagModel.Id, out TagBase tagBase))
                {
                    TagLocationChanged?.Invoke(tagBase, tagModel);
                }
            }
        }
 public ViewModelConverter(ITagModel tag)
 {
     _tag = tag;
 }
Exemple #11
0
 public static TagTableStorageEntity Create(ITagModel model)
 {
     return(model.ToStorageModel <TagTableStorageEntity>());
 }
Exemple #12
0
        private void RemoveTagDisplay(ConcurrentDictionary <string, TagBase> tagCacheDict, ITagModel removeTagModel)
        {
            if (tagCacheDict.TryRemove(removeTagModel.Id, out TagBase tagBase))
            {
                tagBase.Click -= Tag_Click;
                tagBase.PreviewMouseRightButtonUp -= Tag_PreviewMouseRightButtonUp;

                tagBase.PreviewMouseLeftButtonDown -= Tag_PreviewMouseLeftButtonDown;
                tagBase.PreviewMouseMove           -= Tag_PreviewMouseMove;
                tagBase.PreviewMouseLeftButtonUp   -= Tag_PreviewMouseLeftButtonUp;

                _canvasTags.Children.Remove(tagBase);

                if (tagBase.DataContext is ITagModel tagModel)
                {
                    tagModel.PropertyChanged -= TagModel_PropertyChanged;
                }
            }
        }
Exemple #13
0
        private void UpdateTagDisplay(ConcurrentDictionary <string, TagBase> tagCacheDict, ITagModel updateTagModel)
        {
            if (tagCacheDict.TryGetValue(updateTagModel.Id, out TagBase tagBase))
            {
                if (tagBase.DataContext is ITagModel oldTagModel)
                {
                    oldTagModel.PropertyChanged -= TagModel_PropertyChanged;
                }

                tagBase.DataContext             = updateTagModel;
                updateTagModel.PropertyChanged += TagModel_PropertyChanged;
            }
        }
Exemple #14
0
        private void AddTagDisplay(ConcurrentDictionary <string, TagBase> tagCacheDict, ITagModel addTagModel)
        {
            addTagModel.PropertyChanged += TagModel_PropertyChanged;
            TagBase tag = TagFactory.Instance.Create(addTagModel);

            tag.Click += Tag_Click;
            tag.PreviewMouseRightButtonUp += Tag_PreviewMouseRightButtonUp;

            tag.PreviewMouseLeftButtonDown += Tag_PreviewMouseLeftButtonDown;
            tag.PreviewMouseMove           += Tag_PreviewMouseMove;
            tag.PreviewMouseLeftButtonUp   += Tag_PreviewMouseLeftButtonUp;

            _canvasTags.Children.Add(tag);
            tagCacheDict.AddOrUpdate(addTagModel.Id, tag, (k, v) => tag);
        }
 private void TagContainer_TagLocationChanged(TagBase arg1, ITagModel arg2)
 {
 }