using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Drawing; using Google.Protobuf; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.PMR.Stubs; using Tango.PMR.Diagnostics; using Tango.FSE.Common.Connection; using Tango.FSE.Common.Diagnostics; using Tango.FSE.Procedures; namespace Tango.FSE.Procedures.Examples.SendContinuous { #region Example public class Program { private IProcedureContext _context; public void OnExecute(IProcedureContext context) { //Sends a continuous request by providing the request name, a callback method and comma separated arguments. context.SendContinuous("ProgressRequest", (response) => { //Each response will be provided here... context.WriteLine(response); }, 100, 10); //Sends a continuous request by providing the request name, a callback method, a timeout, and comma separated arguments. context.SendContinuous("progress", (response) => { context.WriteLine(response); }, TimeSpan.FromSeconds(5), 100, 10); //Sends a continuous request by providing the request object, a callback method and a 5 seconds timeout. ProgressRequest request = new ProgressRequest(); request.Amount = 100; request.Delay = 10; context.SendContinuous(request, (response) => { context.WriteLine(response); }, 5); //Sends a continuous request by providing the request object, a defined callback method and a 5 seconds timeout. //We need to store the context globally so the callback method will have access to it. _context = context; context.SendContinuous(request, OnProgressResponse, 5); } private void OnProgressResponse(ProgressResponse response) { _context.WriteLine(response); } } #endregion }