示例#1
0
 protected virtual void HoverItem(ModuleSelectorItem item)
 {
     if (item != null)
     {
         this._moduleInfo.SetModule(item.Module);
     }
     else
     {
         this._moduleInfo.SetModule((LogicalModule)null);
     }
 }
示例#2
0
        protected virtual void SelectItem(string panelID, bool eventCallback, bool rightClicked)
        {
            ModuleSelectorItem moduleSelectorItem;

            if (panelID == null || !this._items.TryGetValue(panelID, out moduleSelectorItem) || this._selectedItem == moduleSelectorItem)
            {
                return;
            }
            this._selectedItem = moduleSelectorItem;
            if (!eventCallback || this.SelectedModuleChanged == null)
            {
                return;
            }
            this.SelectedModuleChanged((object)this, rightClicked);
        }
示例#3
0
 public void SetAvailableModules(
     IEnumerable <LogicalModule> modules,
     LogicalModule selected,
     bool enableSelection = true)
 {
     if (enableSelection)
     {
         this._page.DetachItems();
     }
     this.DisposeItems();
     this._items.Clear();
     foreach (ModuleSelectorItem moduleSelectorItem in modules.Select <LogicalModule, ModuleSelectorItem>((Func <LogicalModule, ModuleSelectorItem>)(module => new ModuleSelectorItem(this.UI, Guid.NewGuid().ToString(), module))))
     {
         this._items[moduleSelectorItem.ID] = moduleSelectorItem;
     }
     if (enableSelection)
     {
         ModuleSelectorItem moduleSelectorItem1 = new ModuleSelectorItem(this.UI, Guid.NewGuid().ToString(), new LogicalModule()
         {
             ModuleName  = App.Localize("@UI_MODULENAME_NO_MODULE"),
             ModuleTitle = App.Localize("@UI_MODULENAME_NO_MODULE"),
             Description = App.Localize("@UI_NO_MODULE_DESC"),
             Icon        = "moduleicon_no_selection"
         });
         this._items[moduleSelectorItem1.ID] = moduleSelectorItem1;
         bool flag = false;
         if (selected != null)
         {
             ModuleSelectorItem moduleSelectorItem2 = this._items.Values.FirstOrDefault <ModuleSelectorItem>((Func <ModuleSelectorItem, bool>)(x => x.Module == selected));
             if (moduleSelectorItem2 != null)
             {
                 this.HoverItem(moduleSelectorItem2);
                 flag = true;
             }
         }
         if (!flag)
         {
             this.HoverItem(moduleSelectorItem1);
         }
     }
     this._page.ReplaceItems((IEnumerable <ModuleSelectorItem>) this._items.Values, enableSelection);
 }