/// <exception cref="ArgumentNullException"> /// <paramref name="environment"/> is null. /// </exception> protected SimplePlugin(NClassEnvironment environment) : base(environment) { menuItem = new ToolStripMenuItem(); menuItem.Text = MenuText; menuItem.ToolTipText = string.Format(Strings.PluginTooltip, Name, Author); menuItem.Click += new EventHandler(menuItem_Click); }
/// <exception cref="ArgumentNullException"> /// <paramref name="environment"/> is null. /// </exception> protected Plugin(NClassEnvironment environment) { if (environment == null) throw new ArgumentNullException("environment"); this.environment = environment; }
private void LoadPlugin(Assembly assembly) { try { foreach (Type type in assembly.GetTypes()) { if (type.IsSubclassOf(typeof(Plugin))) { NClassEnvironment environment = new NClassEnvironment(Workspace.Default, DocumentManager); Plugin plugin = (Plugin)Activator.CreateInstance(type, environment); PlugIns.Add(plugin); } } } catch (Exception ex) { #if DEBUG Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); #endif OnError?.Invoke(this, new NClassEventArgs { Message = assembly.FullName + "\n" + ex.Message }); } }
/// <exception cref="ArgumentNullException"> /// <paramref name="environment"/> is null. /// </exception> protected Plugin(NClassEnvironment environment) { if (environment == null) { throw new ArgumentNullException("environment"); } this.environment = environment; }
/// <summary> /// Constructs a new instance of NETImportPlugin. /// </summary> /// <param name = "environment">An instance of NClassEnvironment.</param> public NETImportPlugin(NClassEnvironment environment) : base(environment) { menuItem = new ToolStripMenuItem { Text = Strings.Menu_Title, ToolTipText = Strings.Menu_ToolTip }; menuItem.Click += menuItem_Click; }
/// <summary> /// Constructs a new instance of PDFExportPlugin. /// </summary> /// <param name="environment">An instance of NClassEnvironment.</param> public PDFExportPlugin(NClassEnvironment environment) : base(environment) { menuItem = new ToolStripMenuItem { Text = Strings.Menu_Title, Image = Resources.Document_pdf_16, ToolTipText = Strings.Menu_ToolTip }; menuItem.Click += menuItem_Click; }
private void LoadPlugin(Assembly assembly) { try { foreach (Type type in assembly.GetTypes( )) { if (type.IsSubclassOf(typeof(Plugin))) { NClassEnvironment environment = new NClassEnvironment(Workspace.Default, docManager); Plugin plugin = ( Plugin )Activator.CreateInstance(type, environment); plugins.Add(plugin); } } } catch (Exception ex) { MessageBox.Show(string.Format(Strings.ErrorCouldNotLoadPlugins, assembly.FullName + "\n" + ex.Message), Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected Plugin(NClassEnvironment environment) { NClassEnvironment = environment ?? throw new ArgumentNullException("environment"); }
private void LoadPlugin(Assembly assembly) { try { foreach (Type type in assembly.GetTypes()) { if (type.IsSubclassOf(typeof(Plugin))) { NClassEnvironment environment = new NClassEnvironment(Workspace.Default, docManager); Plugin plugin = (Plugin) Activator.CreateInstance(type, environment); plugins.Add(plugin); } } } catch (Exception ex) { MessageBox.Show( string.Format(Strings.ErrorCouldNotLoadPlugins, assembly.FullName + "\n" + ex.Message), Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }