Пример #1
0
 public void Reset()
 {
     lock (locker)
     {
         ItemDictionary = new Dictionary <string, IModel>();
         EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
     }
 }
Пример #2
0
 public void Set(IDictionary <string, IModel> newStore)
 {
     lock (locker)
     {
         ItemDictionary = new Dictionary <string, IModel>();
         foreach (var m in newStore)
         {
             ItemDictionary[m.Key] = m.Value;
         }
         EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
     }
 }
Пример #3
0
        public void Add(IModel model)
        {
            lock (locker)
            {
                if (ItemDictionary == null)
                {
                    ItemDictionary = new Dictionary <string, IModel>();
                }

                ItemDictionary[model.Name] = model;
                EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
            }
        }
Пример #4
0
        public override void Add(ToolStripMenuItem item)
        {
            lock (locker)
            {
                if (ItemDictionary == null)
                {
                    ItemDictionary = new Dictionary <string, ToolStripMenuItem>();
                }

                ItemDictionary[item.Text] = item;

                EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
            }
        }
Пример #5
0
 public void Set(ModelCommonStringStore newStore)
 {
     lock (locker)
     {
         if (newStore?.ToModelList()?.Count > 0)
         {
             ItemDictionary = new Dictionary <string, IModel>();
             foreach (var m in newStore.ToModelList())
             {
                 ItemDictionary[m.Name] = m;
             }
             EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
         }
     }
 }
Пример #6
0
        public override void Set(IList <ToolStripMenuItem> menuList)
        {
            lock (locker)
            {
                ItemDictionary = new Dictionary <string, ToolStripMenuItem>();

                if (menuList?.Count > 0)
                {
                    foreach (var menu in menuList)
                    {
                        Add(menu);
                    }
                }
            }
            EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
        }
Пример #7
0
        public void Remove(string item)
        {
            lock (locker)
            {
                if (!(ItemDictionary?.Count > 0) || string.IsNullOrWhiteSpace(item))
                {
                    return;
                }

                IModel menu = GetItem(item);
                if (menu == null)
                {
                    return;
                }

                ItemDictionary.Remove(item);
                EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
            }
        }
Пример #8
0
        public override void Clear()
        {
            ItemDictionary = new Dictionary <string, ToolStripMenuItem>();

            EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
        }
Пример #9
0
 public override void Refresh()
 {
     EvntCollectionChanged?.Invoke(this, new BoolEventArgs(true));
 }