예제 #1
0
 //adds a tag to the display
 public void AddTag(TagButton tagIn)
 {
     if (tagIn.Text == "") //if tag text is empty, dont add
     {
         return;
     }
     this.tags.Add(tagIn);
     AddTagToPage(tagIn);
     RefreshTags();
 }
예제 #2
0
        //deletes the tag from the display
        public void DeleteTags()
        {
            Console.WriteLine("deleting tags");
            int i = 0;

            while (i < tags.Count) //move through tag list to find all that are hightlighted and delete them
            {
                TagButton button = tags[i];
                if (button.isHighlighted())
                {
                    tags.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }
        }
예제 #3
0
        //adds the given tag to the optimal row
        private void AddTagToOptimalRow(TagButton newTag)
        {
            List <View> rows = this.Children.ToList();

            rows.RemoveAt(0);

            int newTagWidth = newTag.CalculateButtonWidth();

            StackLayout optimalRow = null;

            if (newTagWidth >= MasterNavigationPage.current.Width)
            {
                optimalRow = MakeNewTagsRow();
            }
            else
            {
                foreach (StackLayout row in rows)
                {
                    if (row.Width == 0)
                    {
                        optimalRow = row;
                        break;
                    }
                    else if (LayoutWidth(row) + newTagWidth <= MasterNavigationPage.current.Width)
                    {
                        optimalRow = row;
                        break;
                    }
                }

                if (optimalRow == null)
                {
                    optimalRow = MakeNewTagsRow();
                }
            }

            optimalRow.Children.Add(newTag);
        }
예제 #4
0
        //adds a tag to the page
        private void AddTagToPage(TagButton newTag)
        {
            TagButton newButton = newTag;

            AddTagToOptimalRow(newButton);
        }