Esempio n. 1
0
        // can be executed on any thread
        public void Load(PluginCatalogEntry catalogEntry)
        {
            if (CatalogEntry != null)
            {
                throw new InvalidOperationException("Plugin can be loaded only once");
            }

            CatalogEntry = catalogEntry;
            Title        = catalogEntry.Name;

            Initialize();

            _log.Debug(String.Format("Loading plugin {0} from {1}, {2}", CatalogEntry.Name, CatalogEntry.AssemblyPath, CatalogEntry.MainClass));

            var host = _childContainer.Resolve <PluginViewOfHost>();

            host.FatalError += OnFatalError;

            _remoteProcess = _childContainer.Resolve <PluginProcessProxy>();

            _log.Debug("Starting plugin process");
            _remoteProcess.Start();
            new ProcessMonitor(OnProcessExited).Start(_remoteProcess.Process);

            _log.Debug("Calling LoadPlugin()");
            _remoteProcess.LoadPlugin();
        }
Esempio n. 2
0
 private async void LoadPlugin(PluginCatalogEntry catalogEntry)
 {
     try
     {
         var plugin = await _pluginController.LoadPluginAsync(catalogEntry);
         SelectedPlugin = plugin;
     }
     catch (Exception ex)
     {
         _errorHandlingService.ShowError("Error loading plugin", ex);
     }
 }
Esempio n. 3
0
        private async void LoadPlugin(PluginCatalogEntry catalogEntry)
        {
            try
            {
                var plugin = await _pluginController.LoadPluginAsync(catalogEntry);

                SelectedPlugin = plugin;
            }
            catch (Exception ex)
            {
                _errorHandlingService.ShowError("Error loading plugin", ex);
            }
        }
 public Task <Plugin> LoadPluginAsync(PluginCatalogEntry info)
 {
     return
         (Task.Factory.StartNew(() => LoadPlugin(info))
          .ContinueWith(
              loadPluginTask =>
     {
         var plugin = loadPluginTask.Result;
         plugin.CreateView();
         LoadedPlugins.Add(plugin);
         return plugin;
     },
              _scheduler));
 }
Esempio n. 5
0
        private void LoadPlugin(PluginCatalogEntry catalogEntry)
        {
            var task      = _pluginController.LoadPluginAsync(catalogEntry);
            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();

            task.ContinueWith(t =>
            {
                try
                {
                    SelectedPlugin = t.Result;
                }
                catch (Exception ex)
                {
                    _errorHandlingService.ShowError("Error loading plugin", ex);
                }
            }, scheduler);
        }
        private Plugin LoadPlugin(PluginCatalogEntry info)
        {
            var plugin = _container.Resolve <Plugin>();

            plugin.Error += OnPluginError;

            try
            {
                plugin.Load(info);
            }
            catch (Exception)
            {
                DisposePlugin(plugin);
                throw;
            }

            return(plugin);
        }
Esempio n. 7
0
        private Plugin LoadPlugin(PluginCatalogEntry info)
        {
            var plugin = _container.Resolve<Plugin>();
            plugin.Error += OnPluginError;

            try
            {
                plugin.Load(info);
            }
            catch (Exception)
            {
                DisposePlugin(plugin);
                throw;
            }

            return plugin;
        }
Esempio n. 8
0
 public Task<Plugin> LoadPluginAsync(PluginCatalogEntry info)
 {
     return
         Task.Factory.StartNew(() => LoadPlugin(info))
         .ContinueWith(
             loadPluginTask =>
             {
                 var plugin = loadPluginTask.Result;
                 plugin.CreateView();
                 LoadedPlugins.Add(plugin);
                 return plugin;
             },
             _scheduler);
 }
Esempio n. 9
0
        private void LoadPlugin(PluginCatalogEntry catalogEntry)
        {

            var task = _pluginController.LoadPluginAsync(catalogEntry);
            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
            task.ContinueWith(t =>
                                    {
                                        try
                                        {
                                            SelectedPlugin = t.Result;
                                        }
                                        catch (Exception ex)
                                        {
                                            _errorHandlingService.ShowError("Error loading plugin", ex);
                                        }
                                    }, scheduler);
        }
Esempio n. 10
0
        // can be executed on any thread
        public void Load(PluginCatalogEntry catalogEntry)
        {
            if (CatalogEntry != null) throw new InvalidOperationException("Plugin can be loaded only once");

            CatalogEntry = catalogEntry;
            Title = catalogEntry.Name;

            Initialize();

            _log.Debug(String.Format("Loading plugin {0} from {1}, {2}", CatalogEntry.Name, CatalogEntry.AssemblyPath, CatalogEntry.MainClass));

            var host = _childContainer.Resolve<PluginViewOfHost>();
            host.FatalError += OnFatalError;

            _remoteProcess = _childContainer.Resolve<PluginProcessProxy>();

            _log.Debug("Starting plugin process");
            _remoteProcess.Start();
            new ProcessMonitor(OnProcessExited).Start(_remoteProcess.Process);

            _log.Debug("Calling LoadPlugin()");
            _remoteProcess.LoadPlugin();
        }