Beispiel #1
0
        public void SelectItem(ToolBoxItemControl item)
        {
            Logger.MethodCalled();

            if (!ToolBoxItems.ContainsKey(item.ItemId))
            {
                Logger.ErrorF("Invalid item provided for selection => [{0}]. Item is not registered yet", item.ItemId);
                throw new ArgumentException(string.Format("Invalid item provided for selection => [{0}]. Item is not registered yet", item.ItemId));
            }

            if (SelectedItem == null)
            {
                selectedItem            = item;
                SelectedItem.IsSelected = true;

                Logger.SelectionChanged(item);
            }
            else if (SelectedItem.ItemId == item.ItemId)
            {
                Logger.DebugF("Item [{0}, Type={1}] is already selected", item, item.GetType().Name);
                return;
            }
            else
            {
                UnselectAllItems();
                selectedItem            = item;
                SelectedItem.IsSelected = true;

                Logger.SelectionChanged(item);
            }
        }
Beispiel #2
0
        public void SelectAllItems()
        {
            ToolBoxItems
            .ToList().ForEach(t => t.Value.IsSelected = true);

            Logger.Debug("All items are Selected");
        }
Beispiel #3
0
        public void UnselectAllItems()
        {
            ToolBoxItems
            .Where(i => i.Value.IsSelected == true)
            .ToList().ForEach(t => t.Value.IsSelected = false);

            Logger.Debug("All items Unselected");
        }
Beispiel #4
0
        public ToolBoxItemControl GetSelectedItem()
        {
            var item = ToolBoxItems
                       .Where(i => i.Value.IsSelected == true)
                       .ToList().FirstOrDefault().Value;

            Logger.DebugF("Returning SelectItem => {0}", item.ItemId);
            return(item);
        }
Beispiel #5
0
 public void RegisterItem(ToolBoxItemControl item)
 {
     if (!ToolBoxItems.ContainsKey(item.ItemId))
     {
         ToolBoxItems.Add(item.ItemId, item);
         Logger.DebugF("ToolBoxItem with Guid [{0}] registered", item.ItemId);
     }
     else
     {
         Logger.WarnF("ToolBoxItem with Guid [{0}] is already registered", item.ItemId);
     }
 }