Example #1
0
        public void Initialize(string pluginFolderPath, PluginType pluginType, string fileFilter)
        {
            // Plug-in containers have to be initialized on the other domain in order to enable "on the fly" plug-in swapping.
            switch (pluginType)
            {
            case PluginType.Persistence:
                SafeContainerCreation(() => _pluginContainer = new PluginPersistenceProvider(pluginFolderPath));
                break;

            case PluginType.Interruption:
                SafeContainerCreation(() => _pluginContainer = new PluginInterruptionTrigger(pluginFolderPath));
                break;

            case PluginType.Vdm:
                SafeContainerCreation(() => _pluginContainer = new PluginVdmSettings(pluginFolderPath));
                break;
            }

            var watcher = new PluginWatcher(pluginFolderPath, fileFilter);

            watcher.Created += (sender, args) => ExecuteSta(() => InstallPugin(GetGuidDromAssembly(args.FullPath), args.FullPath, true));
            watcher.Deleted += (sender, args) => ExecuteSta(() => UninstallPugin(GetGuidDromAssembly(args.FullPath), args.FullPath));
            watcher.Error   += (sender, args) => Error(watcher, new PluginErrorEventArgs(new Exception(WatcherErrorMessage), null));
        }
Example #2
0
        public void Initialize( string pluginFolderPath, PluginType pluginType, string fileFilter )
        {
            // Plug-in containers have to be initialized on the other domain in order to enable "on the fly" plug-in swapping.
            switch ( pluginType )
            {
                case PluginType.Persistence:
                    SafeContainerCreation( () => _pluginContainer = new PluginPersistenceProvider( pluginFolderPath ) );
                    break;
                case PluginType.Interruption:
                    SafeContainerCreation( () => _pluginContainer = new PluginInterruptionTrigger( pluginFolderPath ) );
                    break;
                case PluginType.Vdm:
                    SafeContainerCreation( () => _pluginContainer = new PluginVdmSettings( pluginFolderPath ) );
                    break;
            }

            var watcher = new PluginWatcher( pluginFolderPath, fileFilter );
            watcher.Created += ( sender, args ) => ExecuteSta( () => InstallPugin( GetGuidDromAssembly( args.FullPath ), args.FullPath, true ) );
            watcher.Deleted += ( sender, args ) => ExecuteSta( () => UninstallPugin( GetGuidDromAssembly( args.FullPath ), args.FullPath ) );
            watcher.Error += ( sender, args ) => Error( watcher, new PluginErrorEventArgs( new Exception( WatcherErrorMessage ), null ) );
        }