예제 #1
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);
            }
        }
        private void PluginErrorHandler(PluginErrorEventArgs args)
        {
            if (args == null)
            {
                return;
            }
            if (args.Plugin == null)
            {
                return;
            }

            string title   = args.Plugin.Title;
            string message = String.Format("An error occurred in plugin {0}. The plugin tab will be now closed.\r\n{1}\r\n", title, args.Message);

            if (LoadedPlugins.Contains(args.Plugin))
            {
                _errorHandlingService.ShowError(message, args.Exception);
                LoadedPlugins.Remove(args.Plugin);
            }
            else
            {
                _errorHandlingService.LogError(message, args.Exception);
            }

            DisposePlugin(args.Plugin);
        }