Could you please provide an example on how to limit the amount of simultaneously running ManagedOperation?
Sasha (Xafari Support)Client
Thanks, we are already researching this issue. It will take some additional time.
Feel free contact us if you need further assistance or have additional questions. Regards, Sasha.
I'm sorry for the delayed answer.
One of the easiest ways to limit the amount of simultaneously running ManagedOperation is following. Let assume you create an instance of ManagedOperation and set the property ProcessCode to some Action that will be executed. In a class that contains this Action you can add private static variables to count currently running operations. See an example below.
public class SumOperation
private static int _maximumOperations = 5;
private static int _runningOperations = 0;
private object _locker = new object();
public SumOperation(XafApplication application)
Application = application;
public void Execute(IManagedOperation operation)
if (_runningOperations >= _maximumOperations)
throw new InvalidOperationException("You cannot start more than 5 SumOperations.");
// Call step 1 method
// Call step 2 method
private void IncRunningOperations()
private void DecRunningOperations()
// We create and run ManagedOperation somewhere else in our code
var sumOperation = new SumOperation(Application);
var process = new ManagedOperation(Application)
Name = "SumOperation",
ProcessCode = sumOperation.Execute,
TotalStep = 2
If you have any further question feel free to ask.
Best regards, Nikolay.
Thanks Nikolay. Your example is clear and works perfectly.