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

            Items.Add(item);
            OnItemAdded(Items.Last());
            return(Items.Last());
        }
Exemplo n.º 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");
     }
 }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 7
0
 public FeatureStackEventArgs(FeatureStackItem item)
 {
     FeatureStackItem = item;
 }