Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
goatrocks committed May 18, 2022
1 parent 61c5dc3 commit c3b3ccc
Show file tree
Hide file tree
Showing 19 changed files with 568 additions and 301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,30 @@ 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(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(""));


MetadataStore.AddAttributeTable(builder.CreateTable());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<sap:ActivityDesigner x:Class="Indico.RPAActivities.Activities.Design.Designers.ListWithTimeoutDesigner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:activity="clr-namespace:Indico.RPAActivities.Activities.Properties;assembly=Indico.RPAActivities.Activities"
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">

<sap:ActivityDesigner.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\Themes\Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
<sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />
<converters:ActivityIconConverter x:Key="ActivityIconConverter" />
</ResourceDictionary>
</sap:ActivityDesigner.Resources>

<sap:ActivityDesigner.Icon>
<DrawingBrush Stretch="Uniform" Drawing="{Binding Path=ModelItem, Converter={StaticResource ActivityIconConverter}, ConverterParameter=pack://application:\,\,\,/Indico.RPAActivities.Activities.Design;component/themes/icons.xaml}" />
</sap:ActivityDesigner.Icon>

</sap:ActivityDesigner>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Indico.RPAActivities.Activities.Design.Designers
{
/// <summary>
/// Interaction logic for ListWithTimeoutDesigner.xaml
/// </summary>
public partial class ListWithTimeoutDesigner
{
public ListWithTimeoutDesigner()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<None Remove="Designers\IndicoScopeDesigner.xaml" />
<None Remove="Designers\ListDatasetsDesigner.xaml" />
<None Remove="Designers\ListSubmissionsDesigner.xaml" />
<None Remove="Designers\ListWithTimeoutDesigner.xaml" />
<None Remove="Designers\ListWorkflowsDesigner.xaml" />
<None Remove="Designers\SubmissionResultDesigner.xaml" />
<None Remove="Designers\SubmitReviewDesigner.xaml" />
Expand Down Expand Up @@ -106,6 +107,9 @@
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Page>
<Page Include="Designers\ListWithTimeoutDesigner.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</Page>
<Page Include="Designers\ListWorkflowsDesigner.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</Page>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
using System.Activities;
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;

namespace Indico.RPAActivities.Activities.Activities
{
public abstract class IndicoActivityBase<TInput, TOutput> : ContinuableAsyncCodeActivity
public abstract class IndicoActivityBase<TInput, TOutput> : ContinuableAsyncCodeActivity
{
protected Application Application { get; private 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 override void Init(AsyncCodeActivityContext context)
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
{
var objectContainer = context.GetFromContext<IObjectContainer>(IndicoScope.ParentContainerPropertyTag);
Application = objectContainer.Get<Application>();

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

}

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

protected abstract Task<TOutput> ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
using System.Activities;
using System.Threading;
using System.Threading.Tasks;
using Indico.RPAActivities.Activities.Activities;
using Indico.RPAActivities.Activities.Properties;
using UiPath.Shared.Activities.Localization;
using IndicoV2.Ocr.Models;
//using System.Activities;
//using System.Threading;
//using System.Threading.Tasks;
//using Indico.RPAActivities.Activities.Activities;
//using Indico.RPAActivities.Activities.Properties;
//using UiPath.Shared.Activities.Localization;
//using IndicoV2.Ocr.Models;

namespace Indico.RPAActivities.Activities
{
[LocalizedCategory(nameof(Resources.OCRCategory))]
[LocalizedDisplayName(nameof(Resources.DocumentExtraction_DisplayName))]
[LocalizedDescription(nameof(Resources.DocumentExtraction_Description))]
public class DocumentExtraction : IndicoActivityBase<(DocumentExtractionPreset Preset, string Document), string>
{
[LocalizedDisplayName(nameof(Resources.DocumentExtraction_ConfigType_DisplayName))]
[LocalizedDescription(nameof(Resources.DocumentExtraction_ConfigType_Description))]
[LocalizedCategory(nameof(Resources.Input_Category))]
public InArgument<DocumentExtractionPreset> Preset { get; set; } = DocumentExtractionPreset.Standard;
//namespace Indico.RPAActivities.Activities
//{
// [LocalizedCategory(nameof(Resources.OCRCategory))]
// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_DisplayName))]
// [LocalizedDescription(nameof(Resources.DocumentExtraction_Description))]
// public class DocumentExtraction : IndicoActivityBase<(DocumentExtractionPreset Preset, string Document), string>
// {
// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_ConfigType_DisplayName))]
// [LocalizedDescription(nameof(Resources.DocumentExtraction_ConfigType_Description))]
// [LocalizedCategory(nameof(Resources.Input_Category))]
// public InArgument<DocumentExtractionPreset> Preset { get; set; } = DocumentExtractionPreset.Standard;

[LocalizedDisplayName(nameof(Resources.DocumentExtraction_Document_DisplayName))]
[LocalizedDescription(nameof(Resources.DocumentExtraction_Document_Description))]
[LocalizedCategory(nameof(Resources.Input_Category))]
[RequiredArgument]
public InArgument<string> Document { get; set; }
// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_Document_DisplayName))]
// [LocalizedDescription(nameof(Resources.DocumentExtraction_Document_Description))]
// [LocalizedCategory(nameof(Resources.Input_Category))]
// [RequiredArgument]
// public InArgument<string> Document { get; set; }

[LocalizedDisplayName(nameof(Resources.DocumentExtraction_Results_DisplayName))]
[LocalizedDescription(nameof(Resources.DocumentExtraction_Results_Description))]
[LocalizedCategory(nameof(Resources.Output_Category))]
public OutArgument<string> Results { get; set; }
// [LocalizedDisplayName(nameof(Resources.DocumentExtraction_Results_DisplayName))]
// [LocalizedDescription(nameof(Resources.DocumentExtraction_Results_Description))]
// [LocalizedCategory(nameof(Resources.Output_Category))]
// public OutArgument<string> Results { get; set; }

protected override (DocumentExtractionPreset Preset, string Document) GetInputs(AsyncCodeActivityContext ctx) =>
(Preset.Get(ctx), Document.Get(ctx));
// protected override (DocumentExtractionPreset Preset, string Document) GetInputs(AsyncCodeActivityContext ctx) =>
// (Preset.Get(ctx), Document.Get(ctx));

protected override async Task<string> ExecuteAsync((DocumentExtractionPreset Preset, string Document) input, CancellationToken cancellationToken)
=> await Application.ExtractDocument(input.Document, input.Preset, cancellationToken);
// protected override async Task<string> ExecuteAsync((DocumentExtractionPreset Preset, string Document) input, CancellationToken cancellationToken)
// => await Application.ExtractDocument(input.Document, input.Preset, cancellationToken);

protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Results.Set(ctx, output);
}
}
// protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Results.Set(ctx, output);
// }
//}

Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
using System.Activities;
using System.Threading;
using System.Threading.Tasks;
using Indico.RPAActivities.Activities.Activities;
using Newtonsoft.Json.Linq;
using Indico.RPAActivities.Activities.Properties;
using UiPath.Shared.Activities.Localization;
using IndicoV2.Submissions.Models;
using System;
//using System.Activities;
//using System.Threading;
//using System.Threading.Tasks;
//using Indico.RPAActivities.Activities.Activities;
//using Newtonsoft.Json.Linq;
//using Indico.RPAActivities.Activities.Properties;
//using UiPath.Shared.Activities.Localization;
//using IndicoV2.Submissions.Models;
//using System;

namespace Indico.RPAActivities.Activities
{
[LocalizedCategory(nameof(Resources.SubmissionCategory))]
[LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_DisplayName))]
[LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Description))]
public class GenerateSubmissionResult : IndicoActivityBase<int, string>
{
[LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_SubmissionID_DisplayName))]
[LocalizedDescription(nameof(Resources.GenerateSubmissionResult_SubmissionID_Description))]
[LocalizedCategory(nameof(Resources.Input_Category))]
[RequiredArgument]
public InArgument<int> SubmissionID { get; set; }
//namespace Indico.RPAActivities.Activities
//{
// [LocalizedCategory(nameof(Resources.SubmissionCategory))]
// [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_DisplayName))]
// [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Description))]
// public class GenerateSubmissionResult : IndicoActivityBase<int, string>
// {
// [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_SubmissionID_DisplayName))]
// [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_SubmissionID_Description))]
// [LocalizedCategory(nameof(Resources.Input_Category))]
// [RequiredArgument]
// public InArgument<int> SubmissionID { get; set; }

[LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_Result_DisplayName))]
[LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Result_Description))]
[LocalizedCategory(nameof(Resources.Output_Category))]
public OutArgument<string> Result { get; set; }
// [LocalizedDisplayName(nameof(Resources.GenerateSubmissionResult_Result_DisplayName))]
// [LocalizedDescription(nameof(Resources.GenerateSubmissionResult_Result_Description))]
// [LocalizedCategory(nameof(Resources.Output_Category))]
// public OutArgument<string> Result { get; set; }

protected override int GetInputs(AsyncCodeActivityContext ctx) =>
SubmissionID.Get(ctx);
// protected override int GetInputs(AsyncCodeActivityContext ctx) =>
// SubmissionID.Get(ctx);

protected override Task<string> ExecuteAsync(int input, CancellationToken cancellationToken) =>
Application.GenerateSubmissionResult(input, cancellationToken);
// protected override Task<string> ExecuteAsync(int input, CancellationToken cancellationToken) =>
// Application.GenerateSubmissionResult(input, cancellationToken);

protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Result.Set(ctx, output);
}
}
// protected override void SetOutputs(AsyncCodeActivityContext ctx, string output) => Result.Set(ctx, output);
// }
//}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Indico.RPAActivities.Activities
{
[LocalizedCategory(nameof(Resources.RootCategory))]

[LocalizedDisplayName(nameof(Resources.IndicoScope_DisplayName))]
[LocalizedDescription(nameof(Resources.IndicoScope_Description))]
public class IndicoScope : NativeActivity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
using System.Activities;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using Indico.RPAActivities.Activities.Activities;
using Indico.RPAActivities.Activities.Properties;
using UiPath.Shared.Activities.Localization;
using IndicoV2.DataSets.Models;
//using System.Activities;
//using System.Threading;
//using System.Threading.Tasks;
//using System.Collections.Generic;
//using System.Linq;
//using Indico.RPAActivities.Activities.Activities;
//using Indico.RPAActivities.Activities.Properties;
//using UiPath.Shared.Activities.Localization;
//using IndicoV2.DataSets.Models;

namespace Indico.RPAActivities.Activities
{
[LocalizedCategory(nameof(Resources.PreparationCategory))]
[LocalizedDisplayName(nameof(Resources.ListDatasets_DisplayName))]
[LocalizedDescription(nameof(Resources.ListDatasets_Description))]
public class ListDatasets : IndicoActivityBase<bool, List<IDataSetFull>>
{
[LocalizedDisplayName(nameof(Resources.ListDatasets_Datasets_DisplayName))]
[LocalizedDescription(nameof(Resources.ListDatasets_Datasets_Description))]
[LocalizedCategory(nameof(Resources.Output_Category))]
public OutArgument<List<IDataSetFull>> Datasets { get; set; }
//namespace Indico.RPAActivities.Activities
//{
// [LocalizedCategory(nameof(Resources.PreparationCategory))]
// [LocalizedDisplayName(nameof(Resources.ListDatasets_DisplayName))]
// [LocalizedDescription(nameof(Resources.ListDatasets_Description))]
// public class ListDatasets : IndicoActivityBase<bool, List<IDataSetFull>>
// {
// [LocalizedDisplayName(nameof(Resources.ListDatasets_Datasets_DisplayName))]
// [LocalizedDescription(nameof(Resources.ListDatasets_Datasets_Description))]
// [LocalizedCategory(nameof(Resources.Output_Category))]
// public OutArgument<List<IDataSetFull>> Datasets { get; set; }

protected override bool GetInputs(AsyncCodeActivityContext ctx) => true; // no input, using dummy bool
// protected override bool GetInputs(AsyncCodeActivityContext ctx) => true; // no input, using dummy bool

protected override async Task<List<IDataSetFull>> ExecuteAsync(bool input, CancellationToken cancellationToken) =>
(await Application.ListDatasets(cancellationToken)).ToList();
// protected override async Task<List<IDataSetFull>> ExecuteAsync(bool input, CancellationToken cancellationToken) =>
// (await Application.ListDatasets(cancellationToken)).ToList();

protected override void SetOutputs(AsyncCodeActivityContext ctx, List<IDataSetFull> output) =>
Datasets.Set(ctx, output);
}
}
// protected override void SetOutputs(AsyncCodeActivityContext ctx, List<IDataSetFull> output) =>
// Datasets.Set(ctx, output);
// }
//}

Loading

0 comments on commit c3b3ccc

Please sign in to comment.