Exemple #1
0
        public void Add(string id, string title, string description, Image image, string latestVersion, string currentVersion = "")
        {
            UIListBoxItem c = new UIListBoxItem();

            {
                var withBlock = c;

                //Assign an auto generated name
                withBlock.Id     = id;
                withBlock.Name   = "item" + flpListBox.Controls.Count + 1;
                withBlock.Margin = new Padding(0);

                //Set properties
                withBlock.Title          = title;
                withBlock.Description    = description;
                withBlock.LatestVersion  = latestVersion;
                withBlock.CurrentVersion = currentVersion;
                withBlock.Image          = image;
            }

            //To check when the selection is changed
            c.SelectionChanged += SelectionChanged;
            c.Click            += ItemClicked;
            c.DoubleClick      += ItemDoubleClicked;

            flpListBox.Controls.Add(c);
            SetupAnchors();
        }
Exemple #2
0
        public void Remove(string name)
        {
            //Grab which control is being removed
            UIListBoxItem c = (UIListBoxItem)flpListBox.Controls[name];

            flpListBox.Controls.Remove(c);

            //Remove the event hook
            c.SelectionChanged -= SelectionChanged;
            c.Click            -= ItemClicked;
            c.DoubleClick      -= ItemDoubleClicked;

            //Now dispose of properly
            c.Dispose();
            SetupAnchors();
        }
Exemple #3
0
        public void Clear()
        {
            do
            {
                if (flpListBox.Controls.Count == 0)
                {
                    break;
                }

                UIListBoxItem c = (UIListBoxItem)flpListBox.Controls[0];
                flpListBox.Controls.Remove(c);
                //Remove the event hook
                c.SelectionChanged -= SelectionChanged;
                c.Click            -= ItemClicked;
                c.DoubleClick      -= ItemDoubleClicked;
                //Now dispose of properly
                c.Dispose();
            }while (true);

            LastSelectedItem = null;
        }
Exemple #4
0
        public void Remove(int Index)
        {
            UIListBoxItem c = (UIListBoxItem)flpListBox.Controls[Index];

            Remove(c.Name);  //Call the below sub
        }
Exemple #5
0
 private void ItemDoubleClicked(object sender, EventArgs e)
 {
     DoubleClickedItem = (UIListBoxItem)sender;
     ItemDoubleClick?.Invoke(this, flpListBox.Controls.IndexOfKey(((UIListBoxItem)sender).Name));
 }