예제 #1
0
        public void RemoveIconAt(int index)
        {
            if (_icons == null || index < 0 || index >= _icons.Length)
            {
                return;
            }

            if (_icons.Length == 1)
            {
                ClearIcons();
                return;
            }

            Suspended           = true;
            _icons[index].Owner = null;

            var tmp = new AppbarIcon[_icons.Length - 1];
            int c   = 0;

            for (int i = 0; i < _icons.Length; i++)
            {
                if (i != index)
                {
                    tmp[c++] = _icons[i];
                }
            }

            _icons    = tmp;
            Suspended = false;
        }
예제 #2
0
        public void AddIcon(AppbarIcon icon)
        {
            // Update Array Size
            if (_icons == null)
            {
                _icons = new AppbarIcon[1];
            }
            else
            {
                var tmp = new AppbarIcon[_icons.Length + 1];
                Array.Copy(_icons, tmp, _icons.Length);
                _icons = tmp;
            }

            // Update Owner
            if (icon.Owner != null)
            {
                icon.Owner.RemoveIcon(icon);
            }
            icon.Owner = this;

            // Assign Value
            _icons[_icons.Length - 1] = icon;

            Invalidate();
        }
예제 #3
0
        public void RemoveIcon(AppbarIcon icon)
        {
            if (_icons == null)
            {
                return;
            }

            for (int i = 0; i < _icons.Length; i++)
            {
                if (_icons[i] == icon)
                {
                    RemoveIconAt(i);
                    return;
                }
            }
        }