Using the UiPath.Activities.API package from the Official feed (https://pkgs.dev.azure.com/uipath/Public.Feeds/_packaging/UiPath-Official/nuget/v3/index.json
), you can set Studio to show activities that match the custom activity's scope at search. For information on how to use the API, see About the Activities SDK.
Therefore, when clicking the icon inside a custom activity the Command Palette offers suggestions of activities which fit the current scope.
Um dies zu erreichen, verwenden Sie die IScopedActivitiesService
-Schnittstelle mit den folgenden Methoden:
SetScopedActivity
: Fügt ein Paar hinzu, das aus einer Scope-Aktivität und einer Aktivität besteht, die für diesen Scope geeignet ist.SetScopedActivities
: Fügt dem angegebenen Scope-Typ eine Liste geeigneter Aktivitätstypen hinzu.
Im Folgenden finden Sie ein Beispiel dafür, wie diese Methoden innerhalb Ihrer benutzerdefinierten Aktivität verwendet werden sollten:
public void Initialize(object argument)
{
try
{
if (!(argument is IWorkflowDesignApi api))
{
return;
}
if (api.HasFeature(DesignFeatureKeys.ScopedActivities))
{
api.ScopedActivitiesService.SetScopedActivities(typeof(FirstScopeActivity), new List<Type>() { typeof(FirstChildActivity), typeof(SecondChildActivity) });
api.ScopedActivitiesService.SetScopedActivity(typeof(SecondScopeActivity), typeof(ThirdChildActivity));
}
}
catch (Exception ex)
{
Trace.TraceError(ex.Message);
}
}
Aktualisiert vor 2 Monaten
Siehe auch
Scoped Activities Reference |