Table of Contents

Class AddInBase

Namespace
BlueByte.SOLIDWORKS.PDMProfessional.SDK
Assembly
BlueByte.SOLIDWORKS.PDMProfessional.SDK.dll

Taskbase class.

public abstract class AddInBase : IEdmAddIn5
Inheritance
AddInBase
Implements
IEdmAddIn5
Inherited Members

Constructors

AddInBase()

Create a new instance of the addIn base class.

public AddInBase()

Fields

Identity

Stores identity of the task add-in.

public Identity Identity

Field Value

Identity

Properties

BeforeCancellationAction

Gets or sets the before cancellation action. Use this to perform any clean up action.

public Action BeforeCancellationAction { get; set; }

Property Value

Action

The before cancellation action.

BeforeYouCrash

Action to execute before task crashes.

public Action<Exception> BeforeYouCrash { get; set; }

Property Value

Action<Exception>

CancellationAndSuspensionLogAction

Gets or sets the cancellation and suspension log action.

public Action<string> CancellationAndSuspensionLogAction { get; set; }

Property Value

Action<string>

The cancellation and suspension log action. Use this action log event before the task gets suspended.

CatchAllUnhandledException

Catch all unhandled exceptions and log them.

public bool CatchAllUnhandledException { get; set; }

Property Value

bool

Container

DI Container.

public Container Container { get; }

Property Value

Container

CurrentPosition

Gets or sets the current position.

public int CurrentPosition { get; set; }

Property Value

int

The current position.

Instance

Task instance.

public IEdmTaskInstance Instance { get; set; }

Property Value

IEdmTaskInstance

IsInitialized

Gets whether or not task is initialized (ie container and logger created).

public bool IsInitialized { get; }

Property Value

bool

LogType

Gets or sets the type of the log.

public Type LogType { get; set; }

Property Value

Type

The type of the log.

Logger

Gets or sets the logger.

public ILogger Logger { get; set; }

Property Value

ILogger

LoggerType

Sets the type of the logger to be used.

public LoggerType_e LoggerType { get; set; }

Property Value

LoggerType_e

Pages

public ITaskPage[] Pages { get; set; }

Property Value

ITaskPage[]

Properties

Properties

public IEdmTaskProperties Properties { get; set; }

Property Value

IEdmTaskProperties

Range

Gets or sets the range.

public int Range { get; set; }

Property Value

int

The range.

Vault

Gets the vault object.

public IEdmVault5 Vault { get; }

Property Value

IEdmVault5

Methods

AddContextMenu(string, string)

Adds a context menu item to PDM.

protected void AddContextMenu(string menuText, string statusBarHelpText)

Parameters

menuText string

Text that will appear in the context menu.

statusBarHelpText string

Text that will appear in the statusbar.

AddDetailTaskPage(ITaskPage)

Adds the detail task page.

protected void AddDetailTaskPage(ITaskPage taskDetailPage)

Parameters

taskDetailPage ITaskPage

The task detail page. Please set the container property before calling this method.

AddTaskSetupPage(ITaskPage)

Add setup page to task. Use CreatePageInstance<T>() to create instance of a page that implements ITaskPage.

protected void AddTaskSetupPage(ITaskPage taskSetupPage)

Parameters

taskSetupPage ITaskPage

AddTaskSetupPages(ITaskPage[])

Add setup pages to task.

protected void AddTaskSetupPages(ITaskPage[] taskSetupPages)

Parameters

taskSetupPages ITaskPage[]

Array of ITaskPage

AttachDebugger()

Attaches the debugger.

public void AttachDebugger()

CheckForCancellationOrSuspension(Action, Action<string>)

Checks for cancellation or suspension.

public virtual void CheckForCancellationOrSuspension(Action beforeCancellationAction, Action<string> cancellationAndSuspensionLogAction)

Parameters

beforeCancellationAction Action

The before cancellation action.

cancellationAndSuspensionLogAction Action<string>

The cancellation and suspension log action.

Exceptions

CancellationException

CreatePageInstance<T>()

public ITaskPage CreatePageInstance<T>() where T : UserControl, ITaskPage

Returns

ITaskPage

Type Parameters

T

CurrentDomain_AssemblyResolve(object, ResolveEventArgs)

public virtual Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)

Parameters

sender object
args ResolveEventArgs

Returns

Assembly

ForEachDatum(ref EdmCmdData[], Action<EdmCmdData>)

Performs an action on affected data while allowing user to cancel or pause task.

public void ForEachDatum(ref EdmCmdData[] affectedData, Action<EdmCmdData> Action)

Parameters

affectedData EdmCmdData[]
Action Action<EdmCmdData>

ForEachFile(ref EdmCmdData[], Action<IEdmFile5, IEdmFolder5>)

Performs an action on affected file while allowing user to cancel or pause task.

public void ForEachFile(ref EdmCmdData[] affectedData, Action<IEdmFile5, IEdmFolder5> Action)

Parameters

affectedData EdmCmdData[]
Action Action<IEdmFile5, IEdmFolder5>

Remarks

This ignore EdmCmdData that are not files.

ForEachFile(ref EdmCmdData[], Action<IEdmFile5>)

Performs an action on affected file while allowing user to cancel or pause task.

public void ForEachFile(ref EdmCmdData[] affectedData, Action<IEdmFile5> Action)

Parameters

affectedData EdmCmdData[]
Action Action<IEdmFile5>

Remarks

This ignore EdmCmdData that are not files.

GetAddInInfo(ref EdmAddInInfo, IEdmVault5, IEdmCmdMgr5)

Fires when an add-in is setup.

public virtual void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)

Parameters

poInfo EdmAddInInfo

Info object.

poVault IEdmVault5

Vault object.

poCmdMgr IEdmCmdMgr5

Command manager object.

GetContainer()

Returns the container object.

public Container GetContainer()

Returns

Container

GetSettings<T>()

Deserialize the view model of the TaskPage<T>. Use this method in the EPDM.Interop.epdm.EdmCmdType.EdmCmd_TaskRun and EPDM.Interop.epdm.EdmCmdType.EdmCmd_TaskLaunch to get the settings.

public T GetSettings<T>()

Returns

T

T

Type Parameters

T

Initialize()

Initializes task (Registers types and creates logger).

public virtual void Initialize()

OnCmd(ref EdmCmd, ref EdmCmdData[])

Fires a response to a command that the add-in is hooked too is being trigger.

public virtual void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd

PDM command

ppoData EdmCmdData[]

Affected data

OnLoadAdditionalAssemblies(DirectoryInfo)

Load assemblies that failed loading.

protected virtual void OnLoadAdditionalAssemblies(DirectoryInfo addinDirectory)

Parameters

addinDirectory DirectoryInfo

Directory of the add-in.

OnLoggerOutputSat(string)

Sets the output folder of the logger.

protected virtual void OnLoggerOutputSat(string defaultDirectory)

Parameters

defaultDirectory string

OnLoggerTypeChosen(LoggerType_e)

Sets the type of the logger.

protected virtual void OnLoggerTypeChosen(LoggerType_e defaultType)

Parameters

defaultType LoggerType_e

OnPDMLoggerInitialized()

Called when [PDM logger initialized].

protected virtual void OnPDMLoggerInitialized()

OnRegisterAdditionalTypes(Container)

Registers additional types.

protected virtual void OnRegisterAdditionalTypes(Container container)

Parameters

container Container

OnTaskDetails(ref EdmCmd, ref EdmCmdData[])

Fires when task details are initialized

public virtual void OnTaskDetails(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd

Command

ppoData EdmCmdData[]

Affected documents

OnTaskDialogWindowCreated(IEdmTaskInstance)

Fires when the task dialog window is created. This occurs when you create a new task or edit an existing one.

public virtual void OnTaskDialogWindowCreated(IEdmTaskInstance instance)

Parameters

instance IEdmTaskInstance

OnTaskDialogWindowCreated(IEdmTaskProperties)

Fires when the task dialog window is created. This occurs when you create a new task or edit an existing one.

public virtual void OnTaskDialogWindowCreated(IEdmTaskProperties properties)

Parameters

properties IEdmTaskProperties

OnTaskLaunch(ref EdmCmd, ref EdmCmdData[])

Fires when a task is launched.

public virtual void OnTaskLaunch(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd

Command

ppoData EdmCmdData[]

Affected documents

OnTaskLaunchButton(ref EdmCmd, ref EdmCmdData[])

Fires when user clicks on the launch button.

public virtual void OnTaskLaunchButton(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd

Command

ppoData EdmCmdData[]

Affected documents

OnTaskRun(ref EdmCmd, ref EdmCmdData[])

Fires when task runs on the executing machine.

public virtual void OnTaskRun(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd

Command

ppoData EdmCmdData[]

Affected documents

OnTaskSetup(ref EdmCmd, ref EdmCmdData[])

Fires when task is setup.

public void OnTaskSetup(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd
ppoData EdmCmdData[]

OnTaskSetupButton(ref EdmCmd, ref EdmCmdData[])

Fires when user clicks OK button in the task page.

public virtual void OnTaskSetupButton(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)

Parameters

poCmd EdmCmd

Command

ppoData EdmCmdData[]

Affected documents

OnUnhandledExceptions(bool, Action<Exception>)

Sets how to handle unhandled exceptions

protected virtual void OnUnhandledExceptions(bool catchAllExceptions, Action<Exception> logAction = null)

Parameters

catchAllExceptions bool
logAction Action<Exception>

RegisterTypes()

Fires when the application is initialized. Register types of calling assembly.

protected virtual void RegisterTypes()

SetRange(int, int, string)

Sets the progress range. Should be done only once at the start of the task execution

public virtual void SetRange(int range, int currentPosition, string message = null)

Parameters

range int

Initialized range

currentPosition int

Initial position

message string

message

Remarks

This method also checks for cancellation and suspension requests made by the user.

Exceptions

Exception

UpdateTaskMessage(int, string)

Sets the progress bar position.

public virtual void UpdateTaskMessage(int currentPosition, string message = null)

Parameters

currentPosition int
message string