示例#1
0
 protected void RemoveFromSelected(GeneralTag tag)
 {
     RemoveFromSelectedRecusive(tag);
     uxSelectedTags.RowStyles.RemoveAt(uxSelectedTags.RowStyles.Count - 1);
     //uxSelectedTags.RowCount--;
     UpdateMenuItem(true);
 }
示例#2
0
 void addToParent(GameObject parent, GeneralTag tag)
 {
     if (parent.GetComponent <GeneralTag>() != null)
     {
         parent.GetComponent <GeneralTag>().children.Add(tag);
     }
 }
示例#3
0
 protected TaxonomyStruct GetTaxonomy(GeneralTag tag)
 {
     return(new TaxonomyStruct
     {
         ID = tag.Guid,
         Name = tag.Title
     });
 }
示例#4
0
        private GeneralTag CreateNewTag()
        {
            var        title = (string)uxSuggestions.SelectedItem;
            GeneralTag tag;

            tag = new GeneralTag
            {
                Counter = 1,
                Guid    = Guid.Empty,
                Title   = uxKeyword.Text
            };
            return(tag);
        }
示例#5
0
        protected TaxonomyStruct GetSelected(GeneralTag tag)
        {
            /*if(tag.Guid == Guid.Empty)
             * { //if it's "new" tag, make sure the title is unique
             *      return
             *              (from Control control in uxSelectedTags.Controls select control.Tag as GeneralTag).Any(t => t.Title == tag.Title);
             * }
             * return  (from Control control in uxSelectedTags.Controls select control.Tag as GeneralTag).Any(current => current != null && current.Guid == tag.Guid);*/

            if (tag.Guid == Guid.Empty)
            {
                return(SelectedTags.FirstOrDefault(t => t.Name.ToLower() == tag.Title.ToLower()));
            }
            return(SelectedTags.FirstOrDefault(t => t.ID == tag.Guid));
        }
示例#6
0
        protected Label CreateRemoveImage(GeneralTag tag)
        {
            var label = new Label
            {
                Tag        = tag,
                Width      = 20,
                Height     = 20,
                Image      = Properties.Resources.remove,
                ImageAlign = ContentAlignment.MiddleCenter
            };

            ConfigureRemoveLabel(label);

            return(label);
        }
    protected void updateParent()
    {
        if (parent != null && transform.parent && transform.parent.gameObject.GetComponent <GeneralTag>() == parent)
        {
            return;
        }

        if (transform.parent != null)
        {
            parent = transform.parent.gameObject.GetComponent <GeneralTag>();
        }
        else
        {
            parent = null;
        }
    }
示例#8
0
        protected Label CreateSelectedLabel(GeneralTag tag)
        {
            Color color = GetColor(tag);
            var   label = new Label
            {
                Text        = tag.Title,
                Tag         = tag,
                Width       = 500,
                Font        = new Font(new FontFamily("Segoe UI"), 9.5f),
                ForeColor   = color,
                UseMnemonic = false
            };

            ConfigureSelectedLabel(label);
            return(label);
        }
示例#9
0
    private static void enrichXmlWithGeneralAttributes(XmlDocument xmlDoc, GeneralTag tag, XmlNode node)
    {
        if (!String.IsNullOrEmpty(tag.teardownName))
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("name");
            attribute.Value = tag.teardownName;
            node.Attributes.Append(attribute);
        }

        if (!String.IsNullOrEmpty(tag.tags))
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("tags");
            attribute.Value = tag.tags;
            node.Attributes.Append(attribute);
        }
    }
示例#10
0
        protected Color GetColor(GeneralTag tag)
        {
            Color color;

            if (OriginalTags.Contains(tag.Guid))
            {            //if the tag is already one of the tags assigned to the article
                color = Color.Black;
            }
            else if (tag.Guid == Guid.Empty)
            {            //if it's a tag that has not yet existed
                color = Color.Blue;
            }
            else
            {
                color = Color.Green;
            }
            return(color);
        }
示例#11
0
        protected void RemoveFromSelectedRecusive(GeneralTag tag)
        {
            var selected = GetSelected(tag);

            if (selected != null)
            {
                foreach (Control control in uxSelectedTags.Controls)
                {
                    var target = control.Tag as GeneralTag;
                    if (target != null && target == tag)
                    {
                        uxSelectedTags.Controls.Remove(control);
                        RemoveFromSelectedRecusive(tag);
                        break;
                    }
                }
            }
            SelectedTags.Remove(selected);
        }
示例#12
0
        protected Label GetTagLabel(GeneralTag tag)
        {
            double size;

            if (tag.Counter >= 0)
            {
                size = Math.Log(tag.Counter, 1.4);
            }
            else
            {
                size = 8;
            }
            if (size > 20)
            {
                size = 20;
            }
            else if (size < 8)
            {
                size = 8;
            }
            var label = new Label
            {
                Text      = tag.Title,
                Tag       = tag,
                Font      = new Font(new FontFamily("Segoe UI"), (float)size, FontStyle.Underline),
                AutoSize  = true,
                ForeColor = Color.Blue,
                Anchor    = AnchorStyles.None
            };

            label.MouseClick += delegate
            {
                AddSelectedTag(tag);
            };
            label.MouseMove += delegate
            {
                Cursor.Current = Cursors.Hand;
            };
            return(label);
        }
示例#13
0
 void attachGeneralProperties(GeneralTag tag, XmlNode xmlNode)
 {
     tag.tags         = readString(xmlNode, "tags");
     tag.teardownName = readString(xmlNode, "name");
 }
示例#14
0
        /// <summary>
        /// To add a new general tag that does not exist in Sitecore,
        /// give the general tag an empty Guid
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="color"></param>
        protected void AddSelectedTag(GeneralTag tag)
        {
            if (tag == null)
            {
                return;
            }
            if (GetSelected(tag) != null)
            {
                return;
            }

            string[] selectedTaxonomyParts = tag.Path.Split('/');
            selectedTaxonomyParts = selectedTaxonomyParts.SkipWhile(x => !x.Equals("Taxonomy")).ToArray();
            selectedTaxonomyParts = selectedTaxonomyParts.Skip(1).ToArray();
            string taxonomyRoot = selectedTaxonomyParts.First();

            switch (taxonomyRoot.ToLower())
            {
            case "general tags":
            case "create as new tag":
                //general tags case
                uxSelectedTags.RowStyles.Add(new RowStyle(SizeType.Absolute, 20f));

                uxSelectedTags.Controls.Add(CreateRemoveImage(tag));
                uxSelectedTags.Controls.Add(CreateSelectedLabel(tag));
                SelectedTags.Add(GetTaxonomy(tag));
                UpdateMenuItem(true);
                break;

            case "market segments":
                TaxonomyStruct marketItem = new TaxonomyStruct();
                marketItem.ID   = tag.Guid;
                marketItem.Name = tag.Title;
                MyPageSelector.pageMarketSegmentsControl.TabController.AddToSelected(marketItem);
                break;

            case "industries":
                TaxonomyStruct industryItem = new TaxonomyStruct();
                industryItem.ID   = tag.Guid;
                industryItem.Name = tag.Title;
                MyPageSelector.pageIndustriesControl.TabController.AddToSelected(industryItem);
                break;

            case "subjects":
                TaxonomyStruct subjectItem = new TaxonomyStruct();
                subjectItem.ID   = tag.Guid;
                subjectItem.Name = tag.Title;
                MyPageSelector.pageSubjectsControl.TabController.AddToSelected(subjectItem);
                break;

            case "therapeutic categories":
                TaxonomyStruct tcItem = new TaxonomyStruct();
                tcItem.ID   = tag.Guid;
                tcItem.Name = tag.Title;
                MyPageSelector.pageTherapeuticCategoriesControl.TabController.AddToSelected(tcItem);
                break;

            default:
                break;
            }
        }