Common.Activity 1.1.6509.914

dotnet add package Common.Activity --version 1.1.6509.914                
NuGet\Install-Package Common.Activity -Version 1.1.6509.914                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Common.Activity" Version="1.1.6509.914" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Common.Activity --version 1.1.6509.914                
#r "nuget: Common.Activity, 1.1.6509.914"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Common.Activity as a Cake Addin
#addin nuget:?package=Common.Activity&version=1.1.6509.914

// Install Common.Activity as a Cake Tool
#tool nuget:?package=Common.Activity&version=1.1.6509.914                

About

A library for easy logging through form in Activity !

Advantages

With this library, you can organize your program more structured.

And you can use this library to realize some functions like workflows.

Usage

Install

Through cli:

dotnet add package Common.Activity

Import namespace

using Common.Activity;

Use

var activity = new Activity()
    {
        Id = 1,
        Name = "Activity_Calculate",
        Author = "Author",
        IconKind = null,
        Title = null,
        Category = null,
    }
    .Open("samples")
    .Assign("samples", "samples")
    .Assign("samples", "computer")
    .RemoveAssign("samples", "samples")
    .Label("samples", "running")
    .AppendTask(
        new ActivityTask()
            {
                Action = controller =>
                {
                    controller.LogContents(0, $"1 + 0 = {1 + 0}");
                    controller.Result = 1 + 0;
                    controller.Progress = new Progress(ProgressType.Tasks)
                    {
                        Value = new Tuple<int, int>(1, 1)
                    };
                },
            }
            .AppendTask(
                new ActivityTask()
                {
                    Action = controller =>
                    {
                        controller.LogContents(0, $"1 + 1 = {1 + 1}");
                        controller.Result = 1 + 1;
                        controller.Progress = new Progress(ProgressType.Tasks)
                        {
                            Value = new Tuple<int, int>(1, 1)
                        };
                    }
                }
            )
            .AppendTask(
                new ActivityTask()
                {
                    Action = controller =>
                    {
                        controller.LogContents(0, $"1 + 2 = {1 + 2}");
                        controller.Result = 1 + 2;
                        controller.Progress = new Progress(ProgressType.Tasks)
                        {
                            Value = new Tuple<int, int>(1, 1)
                        };
                    }
                }
            )
    )
    .ExecuteAllTasks();

If you use JsonSerializer in System.Text.Json to serialize activity,

var options = new JsonSerializerOptions()
{
    WriteIndented = true,
    IncludeFields = true,
};

Console.WriteLine(
    JsonSerializer.Serialize(activity, options)
);

the output would be like:

{
  "Id": 1,
  "Name": "Activity_Calculate",
  "Author": "Samples",
  "Title": null,
  "Category": null,
  "IconKind": null,
  "Assigners": [
    "computer"
  ],
  "Labels": [
    "running"
  ],
  "Tasks": [
    {
      "Name": null,
      "Progress": {
        "Value": {
          "Item1": 1,
          "Item2": 1
        }
      },
      "IsLoopTask": false,
      "SubTasks": [
        {
          "Name": null,
          "Progress": {
            "Value": {
              "Item1": 1,
              "Item2": 1
            }
          },
          "IsLoopTask": false,
          "SubTasks": [],
          "Contents": {
            "0": "1 \u002B 1 = 2"
          },
          "Warnings": {},
          "Errors": {},
          "Status": 3,
          "Result": 2
        },
        {
          "Name": null,
          "Progress": {
            "Value": {
              "Item1": 1,
              "Item2": 1
            }
          },
          "IsLoopTask": false,
          "SubTasks": [],
          "Contents": {
            "0": "1 \u002B 2 = 3"
          },
          "Warnings": {},
          "Errors": {},
          "Status": 3,
          "Result": 3
        }
      ],
      "Contents": {
        "0": "1 \u002B 0 = 1"
      },
      "Warnings": {},
      "Errors": {},
      "Status": 3,
      "Result": 1
    }
  ],
  "Operations": {
    "OpenAndCloseOperations": [
      {
        "Subject": "samples",
        "ExecuteTime": "2023-05-12T13:52:29.8833534Z",
        "Operation": 0
      }
    ],
    "AssignersRelatedOperations": [
      {
        "Subject": "samples",
        "ExecuteTime": "2023-05-12T13:52:29.8842917Z",
        "Operation": 0,
        "Targets": [
          "samples"
        ]
      },
      {
        "Subject": "samples",
        "ExecuteTime": "2023-05-12T13:52:29.8846075Z",
        "Operation": 0,
        "Targets": [
          "computer"
        ]
      },
      {
        "Subject": "samples",
        "ExecuteTime": "2023-05-12T13:52:29.8849135Z",
        "Operation": 1,
        "Targets": [
          "samples"
        ]
      }
    ],
    "LabelsRelatedOperations": [
      {
        "Subject": "samples",
        "ExecuteTime": "2023-05-12T13:52:29.8854133Z",
        "Operation": 0,
        "Targets": [
          "running"
        ]
      }
    ]
  },
  "Status": 1
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.6509.914 280 5/12/2023
1.1.6509.898 162 5/12/2023
1.1.6509.896 157 5/12/2023
1.0.6429.985 275 2/21/2023
1.0.6429.967 256 2/21/2023
1.0.6417.838 274 2/9/2023
1.0.6417.831 291 2/9/2023
1.0.6417.821 301 2/9/2023
1.0.6406.288 323 1/29/2023
1.0.6397.971 338 1/20/2023
1.0.6346.961 489 11/30/2022
1.0.0 365 11/30/2022