Пример #1
0
        /// <summary>
        /// updates the state of an individual tag
        /// </summary>
        /// <param name="name">name of the tag to be updated</param>
        /// <param name="state">state of the tag</param>
        /// <param name="updateUI">specify whether or not to update the UI to reflect this update</param>
        public void UpdateTag(string name, TagButtonState state = TagButtonState.INACTIVE, bool updateUI = false)
        {
            TagButton btn = GetTagButton(name);

            btn.State     = state;
            TagDict[name] = btn;
            if (updateUI)
            {
                ResetUI();
            }
        }
 private void StyleButton(ref Button btn, TagButtonState state)
 {
     if (state == TagButtonState.ACTIVE)
     {
         btn.BackColor = Color.Blue;
         btn.ForeColor = Color.White;
     }
     else
     {
         btn.BackColor = System.Drawing.SystemColors.ScrollBar;
         btn.ForeColor = Color.Black;
     }
 }
        private Button GetNewUITagButton(string tagName, TagButtonState state)
        {
            Button btn = new Button();

            btn.FlatAppearance.BorderSize         = 0;
            btn.FlatAppearance.BorderColor        = Color.Blue;
            btn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.RoyalBlue;
            btn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.CornflowerBlue;
            btn.FlatStyle    = System.Windows.Forms.FlatStyle.Flat;
            btn.Margin       = new System.Windows.Forms.Padding(2);
            btn.Name         = "tag_" + tagName;
            btn.AutoSize     = true;
            btn.MaximumSize  = new Size(100, 30);
            btn.AutoEllipsis = true;

            btn.TabIndex = TagDict.Count + 1;
            btn.Text     = tagName;
            btn.UseVisualStyleBackColor = false;

            StyleButton(ref btn, state);
            return(btn);
        }
Пример #4
0
 //update the tag manager panel UI with new tags
 public static void UpdateUI(string tag, TagButtonState state = TagButtonState.INACTIVE, bool updateUI = true)
 {
     TagManager?.UpdateTag(tag, state, updateUI);
 }