Пример #1
0
 /// <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);
 }
Пример #2
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="environment"/> is null.
		/// </exception>
		protected Plugin(NClassEnvironment environment)
		{
			if (environment == null)
				throw new ArgumentNullException("environment");

			this.environment = environment;
		}
Пример #3
0
        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
                });
            }
        }
Пример #4
0
		/// <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);
		}
Пример #5
0
        /// <exception cref="ArgumentNullException">
        /// <paramref name="environment"/> is null.
        /// </exception>
        protected Plugin(NClassEnvironment environment)
        {
            if (environment == null)
            {
                throw new ArgumentNullException("environment");
            }

            this.environment = environment;
        }
Пример #6
0
 /// <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;
 }
Пример #7
0
 /// <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;
 }
Пример #8
0
 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);
     }
 }
Пример #9
0
 protected Plugin(NClassEnvironment environment)
 {
     NClassEnvironment = environment ?? throw new ArgumentNullException("environment");
 }
Пример #10
0
		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);
			}
		}