Menu

How to create a plugin

Dary

This is the full code for the plugin to add website content.

using System;
using Eto.Forms;
using Crescent.Core.UI;

namespace Crescent.Addins.OfficialWS
{
    public class WebsitePanel : CSPanel
    {
        WebView wv = new WebView();
        public WebsitePanel()
        {   
            Content = wv;
            wv.Url = new Uri("https://sourceforge.net/p/crescent-editor/wiki/Home/");         
        }

        public class ShowWSPanelCommand : CSCommand
        {
            public ShowWSPanelCommand()
            {
                Load += ShowWSPanelCommand_Load;
                MenuText = "&Documentation";
                ToolBarText = "Documentation";
                ToolTip = "Documentation";
            }

            private void ShowWSPanelCommand_Load(object sender, EventArgs e)
            {
                // website panel should show up on startup without clicking
                this.Execute();
            }

            protected override void OnExecuted(EventArgs e)
            {
                base.OnExecuted(e);                
                ((this.Parent as Eto.Forms.Control).ControlObject as IDocking).Dock(typeof(WebsitePanel), DockingPosition.Center);                
            }
        }
    }
}

Crescent.Core.UI is the name space of which defines all classes you need to inherit from.
Basically Crescent.Core.UI is a subset of eto.forms (https://github.com/picoe/Eto). We extend eto to meet the needs of docking mechnisms which implementations are platform-dependent. (ex. WinForms Docking Suite for WinForms)

Eto allows you to embed your own GUI, so you can use your UI framework if you want to. But remember that your plugin will be platform dependent unless you write GUI for each platform or use platform-independent GUI.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.