예제 #1
0
        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);
        }
예제 #2
0
        private void Sel_onClicked(uiControl c)
        {
            Plugin_Manager_List_Item sel = c as Plugin_Manager_List_Item;

            Select_Plugin(sel.Get_Plugin());
        }