logo Zagros Plug-in Architecture
This architrcture can be used for create a project like Eclipse which all parts (like GUI,DA,,etc) of it's structure are plug-ins


Plug-in
A Plug-In

To run the example project navigate to{[projectpath]}/zagros/example/plugin.test/ and run Plugin.Engine.exe

To extend this test application or to add plug-ins just add you're plug-in (DLL File that has a class which implements IPlugin and has requirements attributes )
into Plugins folder : {[projectpath]}/zagros/example

If your plug-in ,plugininfo attribute has (Runable =True) the plug-in is main plug-in

Diagram
the violet plug-in is main plug-in

Example Code:

WorkBench

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Plugin.Core;
using Plugin.Configs;
using System.Windows.Forms;

namespace TestPlugin
{
// This Plug-in has a slot for other plug-ins to connect with its
[Slot("Workbench")]
//This is plug-in information
[PluginInfo("Workbench","none","Syamand Mahrofy","Armani Software Ltd.","2009/08/24","1.0.0.0")]
//This Plug-in is [Runable] because this is master pllug-in
[PluginSettings(Run=true,IsControl=false)]

public class Workbench:IPlugin
{
private XMLConfig MainConfig=new XMLConfig();

private IPlugins _Plugins=new IPlugins();

public IConfigoration Config
{
get{return MainConfig;}
set{MainConfig=value;}
}

public IPlugin Parent
{
get;
set;
}

public IPlugins Plugins
{
get {return _Plugins; }
}

public void Run(params object[] parameters)
{
//First entry point of program
MasterForm masterForm = new MasterForm();
foreach (IPlugin plg in Plugins)
{
PluginSettingsAttribute setting = PluginSettingsAttribute.FromPlugin(plg);
if ((setting.IsControl) && (plg.Value is Control))
{
masterForm.Controls.Add(plg.Value as Control);
}
}
Application.Run(masterForm);
}

public object Value
{
get;
set;
}

}
}



Example Toolbar

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Plugin.Core;

namespace testControlPlugin
{
//This plug-in have an Extention for connect this plug-in to workbench
[Extention("Workbench")]
// This Plug-in has a slot for other plug-ins to connect with its
[Slot("ToolBar")]
[PluginInfo("Example Control","none","Syamand Mahrofy","Armani Software Ltd.","2009/08/24","1.0.0.0")]
[PluginSettings(Run=false,IsControl=true)]
public partial class TestControl : UserControl,IPlugin
{
public TestControl()
{
InitializeComponent();
}

#region IPlugin Members

private IPlugins _plugins=new IPlugins();

public IConfigoration Config
{
get;
set;
}

public new IPlugin Parent
{
get;
set;
}

public IPlugins Plugins
{
get
{
return _plugins;
}
}

public void Run(params object[] parameters)
{
if (Parent.Config.Exist("ExampleToolbar.Message"))
{
string MSG = (string)Parent.Config["ExampleToolbar.Message"];
MessageBox.Show(MSG);
}
else
{
Parent.Config["ExampleToolbar.Message"] = "He guys thats test!";
MessageBox.Show("ExampleToolbar Installed");
}
}
public object Value
{
get
{
return this;
}
set
{

}
}

#endregion
}
}
  • For contact with me use following :

kaksyamand@gmail.com

Last edited Oct 31, 2012 at 9:10 AM by syamah, version 21