Beispiel #1
0
 public void RemovePlugin(PluginWidget plugin)
 {
     flowControl.RemoveChild(plugin);
 }
Beispiel #2
0
        public PluginWidget(string path)
        {
            Path = path;
            Name = path.GetFileName();

            base.Margin = Margin;
            this.PluginType = GetPluginType();

            //---- image
            pluginImage = new PluginImageButton();
            pluginImage.Click += (s, e) =>
                {
                    if (!InstallOrUninstall())
                        errorSound();
                };
            //pluginImage.MouseEntered += (s, e) => openFolderBtn.Visible = moreActionsBtn.Visible = true;
            //pluginImage.MouseExited += (s, e) => openFolderBtn.Visible = moreActionsBtn.Visible = false;
            AddChild(pluginImage, 33, 3);

            //---- buttons
            openFolderBtn = new ImageButton();
            //openFolderBtn.Visible = false;
            openFolderBtn.Image = imgOpenFolder;
            openFolderBtn.Click += (s, e) => { Desktop.OpenFolder(Path); };

            moreActionsBtn = new ImageButton();
            //moreActionsBtn.Visible = false;
            moreActionsBtn.Image = imgMoreActions;
            moreActionsBtn.ButtonReleased += (s, e) =>
                {
                    if (e.Button == PointerButton.Left)
                    {
                        lastClicked = this;
                        menu.Popup(this, e.X, e.Y);
                    }
                };

            AddChild(openFolderBtn, 6, 6);
            AddChild(moreActionsBtn, 6, 25);

            AddChild(new VerticalLine(), new Rectangle(28, 6, 1, 34));

            //---- lbl
            lblName = new Label(Name);
            lblAuthor = new Label("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // I only choose the very best of hacks
            lblVersion = new Label("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

            AddChild(lblName, new Rectangle(117, 2, 132, 19));
            AddChild(lblAuthor, new Rectangle(117, 15, 132, 19));
            AddChild(lblVersion, new Rectangle(117, 28, 132, 19));

            lblName.ButtonPressed += (s, e) =>
            {
                if (e.MultiplePress == 2)
                {
                    StartRename();
                    e.Handled = true;
                }
            };

            lblAuthor.Opacity = lblVersion.Opacity = .5;

            lblAuthor.Text = lblVersion.Text = "";

            //---- txt
            txtNameRename = new TextEntry();
            txtNameRename.Visible = false;
            txtNameRename.KeyPressed += (s, e) =>
            {
                if (e.Key == Key.Return)
                {
                    if (Rename(txtNameRename.Text))
                        EndRename();
                    else
                        errorSound();
                }
                else if (e.Key == Key.Escape)
                {
                    EndRename();
                }
            };

            AddChild(txtNameRename, new Rectangle(117, 2, 132d, 22));

            //AddChild(new VerticalLine(), new Rectangle(250, 6, 1, 34));

            //---- settings button
            settingsBtn = new Button();
            settingsBtn.Image = imgSettings;
            settingsBtn.ImagePosition = ContentPosition.Center;
            settingsBtn.WidthRequest = 25;
            settingsBtn.HeightRequest = 22;
            settingsBtn.Sensitive = false;
            settingsBtn.Clicked += (s, e) => { ShowSettings(); };
            AddChild(settingsBtn, 256, 11);

            //AddChild(new VerticalLine(), new Rectangle(250, 6, 1, 34));

            //----links
            linksQuad = new QuadImageLinkButton();
            AddChild(linksQuad, 284, 0);
            //AddChild(linksQuad, 252, 0);

            //----size
            HeightRequest = Size.Height;
            WidthRequest = Size.Width;

            if (App.InitDropShadow != null)
                App.InitDropShadow(this);
            if (App.InitOpacityAnimation != null)
            {
                Opacity = 0;
                App.InitOpacityAnimation(this);
            }
            Load();
        }