public void Collapse_All() { foreach (uiList_TreeNode node in list.Get_Children()) { node.Collapse(); } }
private void Select_Plugin(Plugin p) { set_layout_dirty(); if (!list.isEmpty) { pl_tab.Select(); //set ALL selectors to inactive first. foreach (var sel in list.Get_Children()) { ((Plugin_Manager_List_Item)sel).Active = false; } } else { tab_ins.Select(); } // Unregister our error event hook for the last plugin we had selected Plugin last = GetPlugin(); if (last != null) { last.onError -= onPluginError; } selected = null; if (p != null) { selected = p.Hash; Plugin_Manager_List_Item sel = list[p.Hash] as Plugin_Manager_List_Item; if (sel != null) { sel.Active = true; } } p.onError += onPluginError; control_panel.Set_Collapsed(selected == null); float thumb_aspect = 1f; float thumb_sz = 256f; if (p == null || p.data == null) { this.pl_title.Text = ""; this.pl_auth.Text = ""; this.pl_desc.Text = ""; //this.pl_desc.isDisabled = true; this.pl_vers.Text = ""; this.pl_thumb.Image = null; this.pl_toggle.isVisible = false; this.pl_toggle.isChecked = false; this.pl_errors.Collapse(); } else { this.pl_title.Text = p.data.NAME; this.pl_auth.Text = String.Format("<color=#808080ff>Author:</color> {0}", p.data.AUTHOR); this.pl_desc.Text = (string.IsNullOrEmpty(p.data.DESCRIPTION) ? "<b><color=#808080ff>No Description</color></b>" : p.data.DESCRIPTION); //this.pl_desc.isDisabled = false; this.pl_vers.Text = p.data.VERSION.ToString(); this.pl_thumb.Image = p.thumbnail; this.pl_toggle.isVisible = true; this.pl_toggle.isChecked = p.Enabled; this.pl_errors.Set_Collapsed(!p.HasErrors); } if (this.pl_thumb.Image == null) { thumb_sz = 0f; } else { thumb_aspect = ((float)this.pl_thumb.Image.height / (float)this.pl_thumb.Image.width); } float thumb_height = (thumb_sz * thumb_aspect); pl_thumb.Set_Size(thumb_sz, thumb_height); }
private void Rebuild_Plugins_UI() { pending_rebuild = false; list.Clear_Children(); string search_str = search.text.ToLower(); // add all the plugins to the sidebar foreach (KeyValuePair <string, Plugin_Download_Data> kv in this.plugins) { Plugin_Download_Data plugin = kv.Value; Plugin_Data dat = new Plugin_Data() { AUTHOR = plugin.Author, NAME = plugin.Name, DESCRIPTION = plugin.Description }; if (search_str.Length > 0) { bool match = false; if (plugin.Name.ToLower().IndexOf(search_str) > -1) { match = true; } if (plugin.Author.ToLower().IndexOf(search_str) > -1) { match = true; } if (!match) { continue; } } Plugin_StoreItem itm = uiControl.Create <Plugin_StoreItem>(); itm.onClicked += this.Select_Plugin; itm.Set_Plugin_Data(dat); list.Add(itm.plugin_hash, itm); } // select one of the plugins if (list.Get_Children().Count() > 0) { if (this.selected_plugin == null) { //Select nothing, show instructions instead //Select_Plugin(list.Get_Children()[0]); tabPanel.Select_Tab(INSTRUCTION_TAB_NAME); } else { uiControl found = null; foreach (uiControl c in this.list.Get_Children()) { Plugin_StoreItem itm = (Plugin_StoreItem)c; if (itm.plugin_hash == selected_plugin.plugin_hash) { found = c; break; } } if (found != null) { Select_Plugin(found); } else { Select_Plugin(list.Get_Children().First()); } } } else { Select_Plugin(null); } }