Show feedback of async processes to the ‘current’ user

Uncategorized

Now it is possible to initiate a thread to execute some logic async from script with the possibility to send feedback from the thread. The feedback is displayed to current user. Also, the scriptwriter has an ability to force page reloading by sending special feedback message.

See example:

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using TenForce.Execution.Api2;
using TenForce.Execution.Api2.Objects;
using TenForce.Execution.Framework.Cloning;
using TenForce.Execution.Scripting;
using TenForce.Execution.Scripting.Api2;

namespace TenForce.TestNamespace
{
    public class TestScript : Script<ScriptContext>
    {
        [EntryPoint]
        public void RunCode()
        {
            ScriptingThread.Create(true, Execute).Start();
            ScriptContext.SilentFinish = true;
        }

        public static void Execute()
        {
            for (int i = 0; i < 10; i++)
            {
                FeedbackManager.AddFeedback("Feedback " + i);
                Thread.Sleep(1000);
            }
            FeedbackManager.AddRefreshFeedback();
        }
    }
}