Ejemplo n.º 1
0
        public void Remove(AccountGridButton button)
        {
            var i = Array.IndexOf <AccountGridButton>(buttons, button);

            if (i != -1)
            {
                var b = new AccountGridButton[buttons.Length - 1];

                if (b.Length > 0)
                {
                    if (i > 0)
                    {
                        Array.Copy(buttons, b, i);
                    }

                    if (i < buttons.Length - 1)
                    {
                        Array.Copy(buttons, i + 1, b, i, b.Length - i);

                        for (var j = b.Length - 1; j >= i; --j)
                        {
                            b[j].Index = j;
                        }
                    }
                }

                this.buttons = b;
                this.pending = true;
                this.Controls.Remove(button);
            }
        }
Ejemplo n.º 2
0
        public void Add(AccountGridButton button)
        {
            var existing = buttons.Length;
            var b        = new AccountGridButton[existing + 1];

            Array.Copy(buttons, b, existing);
            b[existing] = button;

            button.Index = existing;

            this.buttons = b;
            this.pending = true;
            this.Controls.Add(button);
        }
Ejemplo n.º 3
0
        public void AddRange(params AccountGridButton[] buttons)
        {
            var existing = this.buttons.Length;
            var b        = new AccountGridButton[existing + buttons.Length];

            if (existing > 0)
            {
                Array.Copy(this.buttons, b, existing);
            }
            Array.Copy(buttons, 0, b, existing, buttons.Length);

            for (var i = b.Length - 1; i >= existing; --i)
            {
                b[i].Index = i;
            }

            this.buttons = b;
            this.pending = true;
            this.Controls.AddRange(buttons);
        }
Ejemplo n.º 4
0
        private void AddAccount(Settings.IAccount account, bool sort)
        {
            var button = new AccountGridButton();
            button.AccountData = account;
            if (string.IsNullOrEmpty(account.WindowsAccount))
                button.AccountName = "(current user)";

            button.MouseEnter += button_MouseEnter;
            button.MouseLeave += button_MouseLeave;

            buttons.Add(account.UID, button);

            gridContainer.Add(button);

            if (sort && !(Settings.SortingMode.Value == Settings.SortMode.None && Settings.SortingOrder.Value == Settings.SortOrder.Ascending))
                gridContainer.Sort(Settings.SortingMode.Value, Settings.SortingOrder.Value);
        }
Ejemplo n.º 5
0
 void OnButtonDataChanged(AccountGridButton button, object data)
 {
     if (button.IsHovered)
     {
         if (data is Exception)
             ShowTooltip(button, ((Exception)data).Message);
         else if (tooltip != null && tooltip.Visible)
             tooltip.HideTooltip();
     }
 }
 public void Remove(AccountGridButton button)
 {
     if (buttons.Remove(button))
     {
         panelContents.Controls.Remove(button);
         isDirty = true;
         this.Invalidate();
     }
 }
        public void Add(AccountGridButton button)
        {
            button.FontLarge = fontLarge;
            button.FontSmall = fontSmall;
            button.ShowAccount = showAccount;

            panelContents.Controls.Add(button);
            button.Index = buttons.Count;
            buttons.Add(button);
            isDirty = true;
            this.Invalidate();

            button.MouseClick += button_MouseClick;
        }