コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
            PluginManager pm = new PluginManager();
            pm.Setup();

            Close();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Rohansi/PluginTest
        static void Main(string[] args)
        {
            RoomFactory = new Factory<IRoom>();
            RoomFactory.Added += type => Console.WriteLine("Added IRoom '{0}'", type);
            RoomFactory.Removed += type => Console.WriteLine("Removed IRoom '{0}'", type);

            RoomFactory.Discover();

            PluginManager = new PluginManager();
            PluginManager.Initializer = plugin => plugin.Discover(RoomFactory);
            PluginManager.Loaded += name => Console.WriteLine("Loaded '{0}'", name);
            PluginManager.Unloaded += name => Console.WriteLine("Unloaded '{0}'", name);

            const string pluginFileName = "PluginAaaa.dll";

            PluginManager.Load(pluginFileName);

            var a = new PluginRoom("PluginA.TestRoom");
            a.Send("11111111");

            PluginManager.Unload(pluginFileName);

            a.Send("22222222");

            Console.WriteLine("Replace plugin assembly");
            Console.ReadLine();

            PluginManager.Load(pluginFileName);

            a.Send("33333333");
            a.Dispose();

            PluginManager.Unload(pluginFileName);

            DumpAssemblyNames();
        }