ProcessTask<TBusinessObject> Constructor (String, Converter<TBusinessObject, ProcessTaskStartInfo>)
Initializes a new instance of the ProcessTask<TBusinessObject> class with the specified display name and the ProcessTaskStartInfo object that is returned from the specified delegate method.
Namespace: Microsoft.WindowsServerSolutions.Administration.ObjectModel
Assembly: Microsoft.WindowsServerSolutions.Administration.ObjectModel (in Microsoft.WindowsServerSolutions.Administration.ObjectModel.dll)
Syntax
public ProcessTask(
string displayName,
Converter<TBusinessObject, ProcessTaskStartInfo> businessObjectToStartInfo
)
public:
ProcessTask(
String^ displayName,
Converter<TBusinessObject, ProcessTaskStartInfo^>^ businessObjectToStartInfo
)
Public Sub New (
displayName As String,
businessObjectToStartInfo As Converter(Of TBusinessObject, ProcessTaskStartInfo)
)
Parameters
displayName
Type: System.StringThe display name of the task.
businessObjectToStartInfo
Type: System.Converter<TBusinessObject, ProcessTaskStartInfo>A delegate method that is used to convert an instance of a business object to a ProcessTaskStartInfo object.
Exceptions
Exception | Condition |
---|---|
ArgumentException | One or more of the parameters are not valid. |
ArgumentNullException | One or more of the parameters are null. |
Remarks
TBusinessObject represents a business object that encapsulates information and methods that relate to business data or business functionality. The information in the business object is exposed as properties.
After a task has been initialized, it must be added to a TaskCollection to be included in the task pane of the Dashboard.
Examples
The following code example shows how to initialize a ProcessTask<TBusinessObject> with a specified display name and a specified delegate method. The delegate method returns a ProcessTaskStartInfo object that is used to run a program with command-line arguments that include information from the business object:
ProcessTask<BusinessObject> businessTask = null;
businessTask = new ProcessTask<BusinessObject>(
"Ping Computer",
GetProcessTask);
private static ProcessTaskStartInfo GetProcessTask(
BusinessObject businessObj)
{
ProcessTaskStartInfo taskinfo = new ProcessTaskStartInfo();
taskinfo.Arguments = "-t " + businessObj.ComputerName;
taskinfo.FileName = @"C:\Windows\System32\ping.exe";
return taskinfo;
}
See Also
ProcessTask<TBusinessObject> Overload
ProcessTask<TBusinessObject> Class
Microsoft.WindowsServerSolutions.Administration.ObjectModel Namespace
Return to top