public static void SafeStop(this PrimaryStrategy strategy) { if (strategy?.ProcessState == ProcessStates.Started) { strategy.PrimaryStopping(); } }
private void TryToStopStrategy(string name, PrimaryStrategy strategy) { if (strategy.ProcessState == ProcessStates.Started) { strategy.PrimaryStopping(); } else { _messageManager.ProceedAnswer($"such a strategy cannot be stopped: {name} {strategy.ProcessState}", ConsoleColor.Red, false); } }
private void ContinueOrTimeout(Action methodAfterSuccess) { Task.Run(() => { if (!_eventWaiter.WaitOne(Timeout)) { _strategy.PrimaryStopping(); _strategy.AddErrorLog("(OrderSync) Still have no respond from terminal about order transaction, timeout: " + Timeout); } methodAfterSuccess(); }); }