Harness proD API Help
EPLAN.Harness.API.Plugins Namespace / IHpDPluginOccTask Interface
Members Example
In This Topic
    IHpDPluginOccTask Interface
    In This Topic
    Base interface for special type of Harness proD plugin for custom task. Use this task for issues related with a single EPLAN.Harness.API.Occurrences.Interfaces.I3DOccurrence. Can appears mutiple times in the task view (for each occurrence that 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 non-resolvable task that checking empty imprint of a rapid wire. The task will show multiple times - for each rapid wire with empty imprint in the scene.
    public class EmptyImprintRapidWire : IHpDPluginOccTask
    {
    	public string Name => "Empty imprint - rapid wire";
    
    	public string Author => "Author";
    
    	public string Description => "Task that checking empty imprint property of a rapid wire.";
    
    	public Version Version => new Version(0, 1);
    
    	public bool IsResolvable => false;
    
    	public string Message => "Rapid wire has empty imprint.";
    
    	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, I3DOccurrence occurrence, out string message)
    	{
    		// All tasks uses the default Message.
    		message = null;
    		
    		if (occurrence is IRapidWire rapidWire)
    		{
    			return string.IsNullOrWhiteSpace(rapidWire.Imprint);
    		}
    
    		return false;
    	}
    
    	public void Resolve(Studio api, I3DOccurrence occurrence) { }
    
    	public void Terminate() { }
    }
    Example of simple resolvable task that checking empty imprint of a rapid wire. On resolve it fill the Imprint property with the occurrence name.
    public class FillEmptyImprintRapidWire : IHpDPluginOccTask
    {
    	public string Name => "Fill empty imprint - rapid wire";
    
    	public string Author => "Author";
    
    	public string Description => "Task that resolving empty imprint property of a rapid wire.";
    
    	public Version Version => new Version(0, 1);
    
    	public bool IsResolvable => true;
    
    	public string Message => "Rapid wire has empty imprint.";
    
    	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, I3DOccurrence occurrence, out string message)
    	{
    		// Customized message for each task.
    		message = $"Rapid wire '{occurrence.Name}' has empty imprint.";
    
    		if (occurrence is IRapidWire rapidWire)
    		{
    			return string.IsNullOrWhiteSpace(rapidWire.Imprint);
    		}
    
    		return false;
    	}
    
    	public void Resolve(Studio api, I3DOccurrence occurrence)
    	{
    		if (occurrence is IRapidWire rapidWire)
    		{
    			rapidWire.Imprint = occurrence.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 for occurrence? 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