Harness proD API Help
EPLAN.Harness.API.Plugins Namespace / IHpDPluginTask Interface
Members Example
In This Topic
    IHpDPluginTask Interface
    In This Topic
    Base interface for special type of Harness proD plugin for custom task. Use this task for issues related with the whole EPLAN.Harness.API.Projects.Documents.Designer. Can appears only once in the task view (if the designer met the condition in the IsActive method).
    Syntax
    Remarks

    Use this interface to implement your own plugin tasks for the Tasks panel of EPLAN Harness proD Studio.

    This special type of Harness proD plugins is registered only into the task view control of a designer.

    Each plugin task must have unique EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo.Name. Plugin with the same name as one already loaded won't be loaded (see HStudio logs).

    The EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo.Name of the plugin task must not starts with the character '@'! Such a plugin won't be loaded (see HStudio logs).

    Example
    Example of simple task that checking empty imprints of all rapid wires. On resolve it fills all empty imprints with name of the wire.
    public class EmptyImprintAllRapidWires : IHpDPluginTask
    {
    	public string Name => "Empty imprint - all rapid wires";
    
    	public string Author => "Author";
    
    	public string Description => "Task for filling the imprint property of all rapid wires.";
    
    	public Version Version => new Version(0, 1);
    
    	public bool IsResolvable => true;
    
    	public string Message => "Rapid wire with empty imprint exists.";
    
    	public Stream ImageStream
    	{
    		get
    		{
    			Bitmap bitmap = Resources._16x16_icon;
    			MemoryStream ms = new MemoryStream();
    			bitmap.Save(ms, ImageFormat.Png);
    			return ms;
    		}
    	}
    
    	public void Initialize(Studio api) { }
    
    	public bool IsActive(Studio api, Designer designer)
    	{
    		IEnumerable<IRapidWire> wires = designer.GetAllOccurrences<IRapidWire>();
    		return wires.Any(w => string.IsNullOrWhiteSpace(w.Imprint));
    	}
    
    	public void Resolve(Studio api, Designer designer)
    	{
    		IEnumerable<IRapidWire> wires = designer.GetAllOccurrences<IRapidWire>().Where(w => string.IsNullOrWhiteSpace(w.Imprint));
    		foreach (IRapidWire wire in wires)
    		{
    			wire.Imprint = $"Imprint: {wire.Name}";
    		}
    	}
    
    	public void Terminate() { }
    }
    Public Properties
     NameDescription
     Property Author of this plugin and copyright information. (Inherited from EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo)
     Property Description of this plugin. (Inherited from EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo)
     Property Image to be displayed in button if plugin successfully loaded. (Inherited from EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo)
     PropertyIs this task resolvable? (Inherited from EPLAN.Harness.API.Plugins.Core.IHpDPluginTaskInfo)
     PropertyMessage of the task, shown when this task is active. (Inherited from EPLAN.Harness.API.Plugins.Core.IHpDPluginTaskInfo)
     Property Unique name of this plugin. (Inherited from EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo)
     Property Version of this plugin. (Inherited from EPLAN.Harness.API.Plugins.Core.IPluginDisplayInfo)
    Top
    Public Methods
     NameDescription
     Method Initialization of this plugin.  
     MethodIs the task still active? Return True for showing this task in the task view.  
     MethodMethod that resolves the problem causing this task. After calling this method, the IsActive method should return False.  
     Method Termination of this plugin. (Inherited from EPLAN.Harness.API.Plugins.Core.IHpDPluginTaskInfo)
    Top
    See Also