我正在开发几个 System.Activities.CodeActivitys,因为我们的机器人软件的接口是这样定义的。这些由包含所有代码的 dll 的 nuget 包传递。
一个活动将如下所示:
public class ActivityName : System.Activities.CodeActivity
{
[System.ComponentModel.Category("Input"), System.ComponentModel.Description("Parameter description."),
System.ComponentModel.DisplayName("Parameter name"), System.Activities.RequiredArgument]
public System.Activities.InArgument<string> strPath { get; set; }
[System.ComponentModel.Category("Output"), System.ComponentModel.Description("Path validation was successful"),
System.ComponentModel.DisplayName("Path valid")]
public System.Activities.OutArgument<bool> bolValid { get; set; }
protected override void Execute(System.Activities.CodeActivityContext context)
{
if (strPath == null) { throw new System.ArgumentNullException("Error - Path of 'tessdata' is not referenced!"); }
string TessPath = strPath.Get(context);
if (TessPath == string.Empty) { throw new System.ArgumentException("Error - TessPath is empty!"); }
if (!System.IO.Directory.Exists(TessPath)) { throw new System.IO.FileNotFoundException("Error - Directory '" + TessPath + "' not found!"); }
bool SetValid = UiPath.OCR.MyOCR.TesseractOCR.TesseractOCR_Static.DefineTessDataDIR(TessPath);
bolValid.Set(context, SetValid);
}
}
现在我想在visual studio中调试这个功能,但我不知道怎么做。仅仅引用 dll 并编写类似的东西并不容易Namespace.FunctionName.Execute()
我想添加 ac# windows 控制台项目,引用该库并无论如何执行此功能。你能告诉我怎么做吗?
问候,扬