Skip to content

Commit

Permalink
update all activities to use newer version of uipath shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
goatrocks committed May 19, 2022
1 parent 257f38e commit 09f20b7
Show file tree
Hide file tree
Showing 65 changed files with 418 additions and 455 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,26 @@ public void Register()
builder.AddCustomAttributes(typeof(IndicoScope), new DesignerAttribute(typeof(IndicoScopeDesigner)));
builder.AddCustomAttributes(typeof(IndicoScope), new HelpKeywordAttribute(""));

//builder.AddCustomAttributes(typeof(ListDatasets), new DesignerAttribute(typeof(ListDatasetsDesigner)));
//builder.AddCustomAttributes(typeof(ListDatasets), new HelpKeywordAttribute(""));
builder.AddCustomAttributes(typeof(ListDatasets), new DesignerAttribute(typeof(ListDatasetsDesigner)));
builder.AddCustomAttributes(typeof(ListDatasets), new HelpKeywordAttribute(""));

//builder.AddCustomAttributes(typeof(DocumentExtraction), new DesignerAttribute(typeof(DocumentExtractionDesigner)));
//builder.AddCustomAttributes(typeof(DocumentExtraction), new HelpKeywordAttribute(""));
builder.AddCustomAttributes(typeof(DocumentExtraction), new DesignerAttribute(typeof(DocumentExtractionDesigner)));
builder.AddCustomAttributes(typeof(DocumentExtraction), new HelpKeywordAttribute(""));

//builder.AddCustomAttributes(typeof(ListWorkflows), new DesignerAttribute(typeof(ListWorkflowsDesigner)));
//builder.AddCustomAttributes(typeof(ListWorkflows), new HelpKeywordAttribute(""));
builder.AddCustomAttributes(typeof(ListWorkflows), new DesignerAttribute(typeof(ListWorkflowsDesigner)));
builder.AddCustomAttributes(typeof(ListWorkflows), new HelpKeywordAttribute(""));

//builder.AddCustomAttributes(typeof(WorkflowSubmission), new DesignerAttribute(typeof(WorkflowSubmissionDesigner)));
//builder.AddCustomAttributes(typeof(WorkflowSubmission), new HelpKeywordAttribute(""));
builder.AddCustomAttributes(typeof(WorkflowSubmission), new DesignerAttribute(typeof(WorkflowSubmissionDesigner)));
builder.AddCustomAttributes(typeof(WorkflowSubmission), new HelpKeywordAttribute(""));

//builder.AddCustomAttributes(typeof(SubmissionResult), new DesignerAttribute(typeof(SubmissionResultDesigner)));
//builder.AddCustomAttributes(typeof(SubmissionResult), new HelpKeywordAttribute(""));
builder.AddCustomAttributes(typeof(SubmissionResult), new DesignerAttribute(typeof(SubmissionResultDesigner)));
builder.AddCustomAttributes(typeof(SubmissionResult), new HelpKeywordAttribute(""));

builder.AddCustomAttributes(typeof(ListSubmissions), new DesignerAttribute(typeof(ListSubmissionsDesigner)));
builder.AddCustomAttributes(typeof(ListSubmissions), new HelpKeywordAttribute(""));

//builder.AddCustomAttributes(typeof(SubmitReview), new DesignerAttribute(typeof(SubmitReviewDesigner)));
//builder.AddCustomAttributes(typeof(SubmitReview), new HelpKeywordAttribute(""));
//builder.AddCustomAttributes(typeof(ListWithTimeout), categoryAttribute);
//builder.AddCustomAttributes(typeof(ListWithTimeout), new DesignerAttribute(typeof(ListWithTimeoutDesigner)));
//builder.AddCustomAttributes(typeof(ListWithTimeout), new HelpKeywordAttribute(""));

builder.AddCustomAttributes(typeof(SubmitReview), new DesignerAttribute(typeof(SubmitReviewDesigner)));
builder.AddCustomAttributes(typeof(SubmitReview), new HelpKeywordAttribute(""));

MetadataStore.AddAttributeTable(builder.CreateTable());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sa="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:p="clr-namespace:Indico.RPAActivities.Activities.Design.Properties"
xmlns:sharedres="clr-namespace:UiPath.Shared.Localization"
xmlns:sharedres="clr-namespace:Indico.UiPath.Shared.Localization"
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">


<sap:ActivityDesigner.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sa="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:p="clr-namespace:Indico.RPAActivities.Activities.Design.Properties"
xmlns:sharedres="clr-namespace:UiPath.Shared.Localization"
xmlns:sharedres="clr-namespace:Indico.UiPath.Shared.Localization"
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">


<sap:ActivityDesigner.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls" >>
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls" >>

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:converters="clr-namespace:UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:UiPath.Shared.Activities.Design.Controls">
xmlns:converters="clr-namespace:Indico.UiPath.Shared.Activities.Design.Converters"
xmlns:uip="clr-namespace:Indico.UiPath.Shared.Activities.Design.Controls">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UiPath.Shared.Localization
namespace Indico.UiPath.Shared.Localization
{
class SharedResources : Indico.RPAActivities.Activities.Design.Properties.Resources
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,62 @@
using System;
using System.Activities;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Indico.RPAActivities.Activities.Properties;
using IndicoV2.Submissions.Models;
using UiPath.Shared.Activities;
using UiPath.Shared.Activities.Localization;
using UiPath.Shared.Activities.Utilities;
using Indico.UiPath.Shared.Activities;
using Indico.UiPath.Shared.Activities.Localization;
using Indico.UiPath.Shared.Activities.Utilities;

namespace Indico.RPAActivities.Activities.Activities
{
public abstract class IndicoActivityBase<TInput, TOutput> : ContinuableAsyncCodeActivity
{
protected Application Application { get; private set; }

/// <summary>
/// If set, continue executing the remaining activities even if the current activity has failed.
/// </summary>
[LocalizedCategory(nameof(Resources.Common_Category))]
[LocalizedDisplayName(nameof(Resources.ContinueOnError_DisplayName))]
[LocalizedDescription(nameof(Resources.ContinueOnError_Description))]
public override InArgument<bool> ContinueOnError { get; set; }

[LocalizedCategory(nameof(Resources.Common_Category))]
[LocalizedDisplayName(nameof(Resources.Timeout_DisplayName))]
[LocalizedDescription(nameof(Resources.Timeout_Description))]
public InArgument<int> TimeoutMS { get; set; } = 60000;

[LocalizedCategory(nameof(Resources.Common_Category))]
[LocalizedDisplayName(nameof(Resources.ContinueOnError_DisplayName))]
[LocalizedDescription(nameof(Resources.ContinueOnError_Description))]
public override InArgument<bool> ContinueOnError { get; set; }

protected IndicoActivityBase()
{
Constraints.Add(ActivityConstraints.HasParentType<IndicoActivityBase<TInput, TOutput>, IndicoScope>(string.Format(Resources.ValidationScope_Error, Resources.IndicoScope_DisplayName)));

}

protected abstract TInput GetInputs(AsyncCodeActivityContext ctx);

protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
{
var objectContainer = context.GetFromContext<IObjectContainer>(IndicoScope.ParentContainerPropertyTag);
IObjectContainer objectContainer = context.GetFromContext<IObjectContainer>(IndicoScope.ParentContainerPropertyTag);
Application = objectContainer.Get<Application>();

return base.BeginExecute(context, callback, state);

}

protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
{
// Inputs
var timeout = TimeoutMS.Get(context);
int timeout = TimeoutMS.Get(context);

var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
cts.CancelAfter(timeout);

// Set a timeout on the execution
var task = ExecuteWithTimeout(context, cts.Token);
var timer = Task.Delay(timeout, cts.Token);
var completedTask = await Task.WhenAny(task, timer);
Task<TOutput> task = ExecuteWithTimeout(GetInputs(context), cts.Token);
Task timer = Task.Delay(timeout, cts.Token);
Task completedTask = await Task.WhenAny(task, timer);
if (completedTask == task)
{
// Outputs
return (ctx) =>
{
Results(ctx, task.Result);
SetResults(ctx, task.Result);
};
}

Expand All @@ -67,13 +65,8 @@ protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(Asy
throw new TimeoutException(Resources.Timeout_Error);
}


}

protected abstract void Results(AsyncCodeActivityContext context, TOutput result);

protected abstract Task<TOutput> ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default);
protected abstract void SetResults(AsyncCodeActivityContext context, TOutput result);
protected abstract Task<TOutput> ExecuteWithTimeout(TInput inputs, CancellationToken cancellationToken = default);
}
}


Loading

0 comments on commit 09f20b7

Please sign in to comment.