Ejemplo n.º 1
0
 private void Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
 {
     foreach (RepositoryItemTag tag in mTags)
     {
         RepositoryItemTag newTag = new RepositoryItemTag();
         newTag.Guid        = tag.Guid;
         newTag.Name        = tag.Name;
         newTag.Description = tag.Description;
         newTag.ItemName    = tag.ItemName;
     }
 }
Ejemplo n.º 2
0
        public ucTag(RepositoryItemTag tag)
        {
            InitializeComponent();
            mTag = tag;
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(lblTagName, Label.ContentProperty, mTag, RepositoryItemTag.Fields.Name);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(lblTagName, Label.ToolTipProperty, mTag, RepositoryItemTag.Fields.Description);
            tagStack.Background   = (Brush)bc.ConvertFrom("#cde0f2");
            closeImage.Visibility = Visibility.Hidden;

            xDeleteTagBtn.Tag = tag;
        }
        private TextCompletionData GetTagName(RepositoryItemTag GT)
        {
            TextCompletionData TCD = new TextCompletionData("@" + GT.Name);

            TCD.Description = GT.Description;

            BitmapImage b = new BitmapImage();

            b.BeginInit();
            b.UriSource = new Uri("pack://*****:*****@AddActivity_16x16.png");
            b.EndInit();
            TCD.Image = b;

            return(TCD);
        }
Ejemplo n.º 4
0
        private void BaseInit(ObservableList <RepositoryItemTag> fullTagsList = null)
        {
            if (WorkSpace.UserProfile.Solution == null)
            {
                return;
            }

            if (fullTagsList == null)
            {
                mUseSolutionTags = true;
                mFullTagsList    = WorkSpace.UserProfile.Solution.Tags;

                if (mAddTags == true)
                {
                    mFullListEditTag = new RepositoryItemTag()
                    {
                        Name = "Add/Edit Solution Tags..."
                    };
                }
            }
            else
            {
                mFullTagsList = fullTagsList;
            }

            mFullTagsList.CollectionChanged += mFullTagsList_CollectionChanged;

            LoadItemTagsToView();//show current saved tags

            if (mItemTagsType == eItemTagsType.Guid)
            {
                mItemTagsGUID.CollectionChanged += MItemTags_CollectionChanged;
            }
            else
            {
                mItemTagsKey.CollectionChanged += MItemTags_CollectionChanged;
            }


            SetComboTagsSource();
            if (mAddTags == false)
            {
                TagLabel.Content   = "Filter By :";
                AddTagBtn1.Content = "Tag...";
            }
        }
Ejemplo n.º 5
0
        private Guid GetOrCreateTagInSolution(string TagName)
        {
            if (TagName.StartsWith("@"))
            {
                TagName = TagName.Substring(1);
            }
            Guid TagGuid = (from x in  WorkSpace.Instance.Solution.Tags where x.Name == TagName select x.Guid).FirstOrDefault();

            if (TagGuid == Guid.Empty)
            {
                //TODO: notify the user that tags are added to solution and he needs to save it
                RepositoryItemTag RIT = new RepositoryItemTag()
                {
                    Name = TagName
                };
                TagGuid = RIT.Guid;
                WorkSpace.Instance.Solution.Tags.Add(RIT);
            }
            return(TagGuid);
        }
Ejemplo n.º 6
0
        public static string GetTagsListAsString(ObservableList <Guid> tagsIDsList)
        {
            string tagsDesc = string.Empty;

            if (tagsIDsList != null)
            {
                if (tagsIDsList.Count > 0)
                {
                    foreach (Guid tagID in tagsIDsList)
                    {
                        RepositoryItemTag tag = WorkSpace.Instance.Solution.Tags.Where(x => x.Guid == tagID).FirstOrDefault();
                        if (tag != null)
                        {
                            tagsDesc += "#" + tag.Name;
                        }
                    }
                }
            }

            return(tagsDesc);
        }
Ejemplo n.º 7
0
        //Load saved tags on BF
        private void LoadItemTagsToView()
        {
            TagsStackPanl.Children.Clear();
            IEnumerable <RepositoryItemTag> ttg = mFullTagsList.ItemsAsEnumerable();

            for (int i = 0; i < GetItemTagsCount(); i++)
            {
                // Get the Name for solution tags.
                RepositoryItemTag t = null;
                if (mItemTagsType == eItemTagsType.Guid)
                {
                    t = (from x in ttg where x.Guid == (Guid)mItemTagsGUID[i] select x).FirstOrDefault();
                }
                else
                {
                    t = (from x in ttg where x.Guid == ((RepositoryItemKey)mItemTagsKey[i]).Guid select x).FirstOrDefault();
                }

                if (t != null)
                {
                    // add saved tags
                    ucTag tag = new ucTag(t);
                    tag.xDeleteTagBtn.Click += XDeleteTagBtn_Click;
                    TagsStackPanl.Children.Add(tag);
                }
                else
                {
                    //removing tag which not exist on solution anymore from the item tags list
                    if (mItemTagsType == eItemTagsType.Guid)
                    {
                        mItemTagsGUID.RemoveAt(i);
                    }
                    else
                    {
                        mItemTagsKey.RemoveAt(i);
                    }
                    i--;
                }
            }
        }