protected virtual void PluginInstanceLoaded(object sender, PluginLoadedEventArgs e) { if (this.Loaded != null) { this.Loaded(this, e); } }
private void OnNewPluginLoaded(object sender, PluginLoadedEventArgs e) { ListViewItem item = new ListViewItem(); if (e.Plugin.Loaded) { item.Text = e.Plugin.Plugin.Name; item.SubItems.Add(e.Plugin.Plugin.Author); } else { item.Text = System.IO.Path.GetFileNameWithoutExtension(e.Plugin.Assembly.Location); item.SubItems.Add(e.Plugin.AssemblyInfo.Author); } //The item is checked if the plugin was given the green light to load item.Checked = e.Plugin.Loaded || (ManagerLibrary.Instance.Settings.PluginApprovals.ContainsKey( e.Plugin.AssemblyInfo.Guid) && ManagerLibrary.Instance. Settings.PluginApprovals[e.Plugin.AssemblyInfo.Guid] ); //Visually display the other metadata associated with the assembly item.ImageIndex = e.Plugin.AssemblyAuthenticode == null ? -1 : 0; item.Group = e.Plugin.LoadingPolicy == PluginLoadingPolicy.Core ? pluginsManager.Groups[0] : pluginsManager.Groups[1]; item.SubItems.Add(e.Plugin.Assembly.GetFileVersion().ToString()); item.SubItems.Add(e.Plugin.Assembly.Location); item.Tag = e.Plugin; pluginsManager.Items.Add(item); }
/// <summary> /// Raises the <see cref="PluginLoaded"/> event. /// </summary> /// <param name="e"> /// The event arguments. /// </param> private void OnPluginLoaded(PluginLoadedEventArgs e) { if (this.PluginLoaded != null) { this.PluginLoaded(this, e); } }
private void Loader_PluginLoaded(object sender, PluginLoadedEventArgs e) { if (OptionUtility.HasConfigurationFile(e.Plugin)) { var proxy = new ConfigurationProxy(() => OptionUtility.GetConfiguration(e.Plugin)); e.Plugin.Context.ApplicationContext.OptionManager.Providers.Add(proxy); } }
public void OnPluginLoaded(object sender, PluginLoadedEventArgs args) { this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { ((SplashScreen)MainWindow).HandleUpdate(args); }, null); //Thread.Sleep(100); }
protected virtual void OnPluginLoaded(PluginLoadedEventArgs e) { if (this.EventsEnabled) { var evnt = this.PluginLoaded; if (evnt != null) { evnt(this, e); } } }
private static void OnPluginProgress(object sender, PluginLoadedEventArgs e) { Platform.CheckForNullReference(e, "e"); #if !MONO SplashScreenManager.SetStatus(e.Message); if (e.PluginAssembly != null) { SplashScreenManager.AddAssemblyIcon(e.PluginAssembly); } #endif }
private void ClientOnPluginLoaded(object sender, PluginLoadedEventArgs e) { var client = (Client)sender; Logger.Info("Plugin {0:D} ({1}) successfully loaded (CI-{2})", e.PluginInfo.Guid, e.PluginInfo.Version, client.Id); lock (_administrationListLock) foreach (var administration in Administrations) { administration.Value.NotifyPluginAvailable(client, e.PluginInfo); } }
public bool LoadPlugin <TPlugin>(FileInfo fileInfo, IPluginLoader <TPlugin> pluginLoader = null, params Type[] sharedTypes) where TPlugin : class, IPlugin { pluginLoader ??= new PluginLoader <TPlugin>(this); TPlugin plugin = (pluginLoader as PluginLoader <TPlugin>)?.Load(fileInfo, sharedTypes); if (plugin == null) { return(false); } ListPlugins.Add(plugin); PluginLoadedEventArgs loadedEventArgs = new PluginLoadedEventArgs(plugin); EventsManager.CallEvent(loadedEventArgs); return(true); }
static void PluginManager_PluginLoaded(object sender, PluginLoadedEventArgs e) { try { //获取插件信息,判断如果是高级插件,则不加载 String currentPluginName = e.Plugin.PluginInfo.Name; if (currentPluginName == "Frame") { //MessageBox.Show("ok"); return; } } catch (Exception ex) { Application.ActiveApplication.Output.Output(ex.Message, InfoType.Exception); Application.ActiveApplication.Output.Output(ex.StackTrace, InfoType.Exception); } }
void pluginManager_OnPluginLoaded(object sender, PluginLoadedEventArgs args) { splashWindow.ShowStatus(string.Format(Properties.Resources.Assembly___0___loaded_, args.AssemblyName), (((double)args.CurrentPluginNumber / (double)args.NumberPluginsFound * 100) / 2)); }
public void HandleUpdate(PluginLoadedEventArgs args) { Text = args.AssemblyName; Value = args.CurrentPluginNumber == 0 ? 0 : ((double)args.CurrentPluginNumber / (double)args.NumberPluginsFound * 100); }
protected virtual void OnPluginLoaded(PluginLoadedEventArgs e) { if (this.EventsEnabled) { var evnt = this.PluginLoaded; if (evnt != null) evnt(this, e); } }
public virtual void Load(string pluginFileName, PluginParameters args) { if (args == null) { args = new PluginParameters(); } AppDomainSetup domainSetup = new AppDomainSetup(); Assembly entryAsm = Assembly.GetEntryAssembly(); AssemblyProductAttribute[] atts = ((AssemblyProductAttribute[])entryAsm.GetCustomAttributes(typeof(AssemblyProductAttribute), false)); string productName = null; if (atts != null) { if (atts.Length > 0) { productName = atts[0].Product; } } if (String.IsNullOrEmpty(productName)) { domainSetup.ApplicationName = Path.GetFileNameWithoutExtension(entryAsm.Location); } else { domainSetup.ApplicationName = productName; } domainSetup.ConfigurationFile = Path.GetFileName(pluginFileName) + ".config"; domainSetup.ApplicationBase = Path.GetDirectoryName(pluginFileName); domainSetup.PrivateBinPath = "bin"; if (this.ShadowCopyEnabled) { domainSetup.ShadowCopyFiles = "true"; domainSetup.ShadowCopyDirectories = domainSetup.ApplicationBase + ";" + Path.Combine(domainSetup.ApplicationBase, "bin"); } PluginLoadingEventArgs loadingArgs = new PluginLoadingEventArgs(pluginFileName, domainSetup); this.OnPluginLoading(loadingArgs); if (!loadingArgs.Cancel) { AppDomain domain = null; domain = AppDomain.CreateDomain(loadingArgs.DomainSetup.ApplicationName, null, loadingArgs.DomainSetup); Type t = this.GetType(); PluginLoaderBase loader = (PluginLoaderBase)domain.CreateInstanceFromAndUnwrap(t.Assembly.Location, t.FullName); loader.AssemblyResolutionPaths = this.AssemblyResolutionPaths; PluginInfo info = loader.OnLoadWrapper(pluginFileName); if (info == null) { AppDomain.Unload(domain); } else { if (loader.IsPluginLoaded) { info.Domain = domain; this._currentInfoList.Add(info); PluginLoadedEventArgs pluginLoadedArgs = new PluginLoadedEventArgs(info); this.OnPluginLoaded(pluginLoadedArgs); PluginBase.ExecutionModes execMode = info.ExecutionMode; bool canExecute = false; if (!this.UseDefaultExecutionValidation) { canExecute = true; } else if (execMode == PluginBase.ExecutionModes.MultiInstance) { canExecute = true; } else if (execMode == PluginBase.ExecutionModes.Exclusive) { if (this._currentInfoList.Count == 1) { canExecute = true; } } else if (execMode == PluginBase.ExecutionModes.Singleton) { if (this.GetLoadedInstances(info.PluginFileName).Count == 1) { canExecute = true; } } else if (execMode == PluginBase.ExecutionModes.Custom) { canExecute = true; } if (canExecute) { info.Parameters = args; PluginExecutingEventArgs exeArgs = new PluginExecutingEventArgs(info); this.OnPluginExecuting(exeArgs); if (exeArgs.Cancel) { this.Unload(info, args, true, exeArgs.CancelReason); } else { info.Loader = loader; Thread pluginThread = new Thread(this.Execute); pluginThread.IsBackground = true; pluginThread.Start(info); } } else { this.Unload(info, args, true, null); } } else { AppDomain.Unload(domain); } } } }
protected virtual void OnCostLineAddNewLoaded(object sender, PluginLoadedEventArgs e) { InitializeCostDataGridView(); }
private void OnAddNewNonStandardPayementLoaded(object sender, PluginLoadedEventArgs e) { lvwPayments.Items.Add(txtName.Text); }
void PluginManager_PluginLoaded(object sender, PluginLoadedEventArgs e) { Platform.Log(LogLevel.Info, e.Message); }
public virtual void Load(string pluginFileName, PluginParameters args) { if (args == null) args = new PluginParameters(); AppDomainSetup domainSetup = new AppDomainSetup(); Assembly entryAsm = Assembly.GetEntryAssembly(); AssemblyProductAttribute[] atts = ((AssemblyProductAttribute[])entryAsm.GetCustomAttributes(typeof(AssemblyProductAttribute), false)); string productName = null; if (atts != null) { if (atts.Length > 0) productName = atts[0].Product; } if (String.IsNullOrEmpty(productName)) domainSetup.ApplicationName = Path.GetFileNameWithoutExtension(entryAsm.Location); else domainSetup.ApplicationName = productName; domainSetup.ConfigurationFile = Path.GetFileName(pluginFileName) + ".config"; domainSetup.ApplicationBase = Path.GetDirectoryName(pluginFileName); domainSetup.PrivateBinPath = "bin"; if (this.ShadowCopyEnabled) { domainSetup.ShadowCopyFiles = "true"; domainSetup.ShadowCopyDirectories = domainSetup.ApplicationBase + ";" + Path.Combine(domainSetup.ApplicationBase, "bin"); } PluginLoadingEventArgs loadingArgs = new PluginLoadingEventArgs(pluginFileName, domainSetup); this.OnPluginLoading(loadingArgs); if (!loadingArgs.Cancel) { AppDomain domain = null; domain = AppDomain.CreateDomain(loadingArgs.DomainSetup.ApplicationName, null, loadingArgs.DomainSetup); Type t = this.GetType(); PluginLoaderBase loader = (PluginLoaderBase)domain.CreateInstanceFromAndUnwrap(t.Assembly.Location, t.FullName); loader.AssemblyResolutionPaths = this.AssemblyResolutionPaths; PluginInfo info = loader.OnLoadWrapper(pluginFileName); if (info == null) AppDomain.Unload(domain); else { if (loader.IsPluginLoaded) { info.Domain = domain; this._currentInfoList.Add(info); PluginLoadedEventArgs pluginLoadedArgs = new PluginLoadedEventArgs(info); this.OnPluginLoaded(pluginLoadedArgs); PluginBase.ExecutionModes execMode = info.ExecutionMode; bool canExecute = false; if (!this.UseDefaultExecutionValidation) canExecute = true; else if (execMode == PluginBase.ExecutionModes.MultiInstance) canExecute = true; else if (execMode == PluginBase.ExecutionModes.Exclusive) { if (this._currentInfoList.Count == 1) canExecute = true; } else if (execMode == PluginBase.ExecutionModes.Singleton) { if (this.GetLoadedInstances(info.PluginFileName).Count == 1) canExecute = true; } else if (execMode == PluginBase.ExecutionModes.Custom) canExecute = true; if (canExecute) { info.Parameters = args; PluginExecutingEventArgs exeArgs = new PluginExecutingEventArgs(info); this.OnPluginExecuting(exeArgs); if (exeArgs.Cancel) this.Unload(info, args, true, exeArgs.CancelReason); else { info.Loader = loader; Thread pluginThread = new Thread(this.Execute); pluginThread.IsBackground = true; pluginThread.Start(info); } } else this.Unload(info, args, true, null); } else AppDomain.Unload(domain); } } }