/// <summary> /// Stops user strategy execution /// </summary> /// <param name="stopStrategy">Contains info for the strategy to be stoppped</param> private void StopUserStrategy(StopStrategy stopStrategy) { try { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("Attempting to stop user strategy: " + stopStrategy.Key, _type.FullName, "StopUserStrategy"); } StrategyExecutor strategyExecutor; if (_strategiesCollection.TryGetValue(stopStrategy.Key, out strategyExecutor)) { // Stop Execution strategyExecutor.StopStrategy(); } else { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("User strategy: " + stopStrategy.Key + " not found.", _type.FullName, "StopUserStrategy"); } } } catch (Exception exception) { _asyncClassLogger.Error(exception, _type.FullName, "StopUserStrategy"); } }
/// <summary> /// Stops the selected strategy /// </summary> private void StopSelectedStrategy(string key) { try { if (Logger.IsInfoEnabled) { Logger.Info("Stoping the selected strategy: ", _type.FullName, "StopSelectedStrategy"); } // Create new instance to pass to event aggregator StopStrategy stopStrategy = new StopStrategy(key); // Publish event to notfiy listeners EventSystem.Publish <StopStrategy>(stopStrategy); } catch (Exception exception) { Logger.Error(exception, _type.FullName, "StopSelectedStrategy"); } }