Exemple #1
0
 private void OnItemRemoved(FeatureStackItem item)
 {
     if (ItemRemoved != null)
     {
         ItemRemoved(this, new FeatureStackEventArgs(item));
     }
     RenderFeatureStack();
 }
Exemple #2
0
        public FeatureStackItem AddItem(string value)
        {
            FeatureStackItem item = new FeatureStackItem()
            {
                Value = value
            };

            Items.Add(item);
            OnItemAdded(Items.Last());
            return(Items.Last());
        }
Exemple #3
0
 public void RemoveItems(FeatureStackItem featureStackItem)
 {
     if (Items.Count(it => it.ID == featureStackItem.ID) > 0)
     {
         Items.Remove(featureStackItem);
         OnItemRemoved(featureStackItem);
     }
     else
     {
         throw new Exception("Cannot find item");
     }
 }
Exemple #4
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);
            FeatureStackItem fs = GetItemUnder(e.Location);

            if (fs != null)
            {
                SelectedItem = fs;
                if (ItemClicked != null)
                {
                    ItemClicked(this, new FeatureStackEventArgs(fs));
                }
                RenderFeatureStack();
            }
        }
Exemple #5
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            FeatureStackItem fs = GetItemUnder(e.Location);

            if (fs != null)
            {
                if (!fs.Hover)
                {
                    Items.ForEach((item) =>
                    {
                        item.Hover = false;
                    });
                    fs.Hover = true;
                    RenderFeatureStack();
                }
                if (MouseOverItem != null)
                {
                    MouseOverItem(this, new FeatureStackEventArgs(fs));
                }
                onItem = false;
            }
            else
            {
                if (!onItem)
                {
                    Items.ForEach((item) =>
                    {
                        item.Hover = false;
                    });
                    if (!onItem)
                    {
                        RenderFeatureStack();
                    }
                    onItem = true;
                }
            }
        }
Exemple #6
0
 public void loadSamples(ControlData control)
 {
     if (control != null && control != _control)
     {
         _control = control;
         if (_control.Features.Count > 0)
         {
             Items.Clear();
             foreach (SampleData sample in control.Features)
             {
                 FeatureStackItem item = AddItem(sample.Name);
                 item.Tag      = sample;
                 item.Selected = false;
             }
             var first = Items.First();
             first.Selected = true;
             _selectedItem  = first;
         }
     }
     if (ItemClicked != null)
     {
         ItemClicked(this, new FeatureStackEventArgs(_selectedItem));
     }
 }
Exemple #7
0
 public FeatureStackEventArgs(FeatureStackItem item)
 {
     FeatureStackItem = item;
 }