public static void SetStrategy(this StrategyContent control, StrategyContainer strategy) { strategy.BindStrategyToScope(control); control.Strategy = strategy; if (strategy.SessionType == SessionType.Emulation) { control.EmulationService = new EmulationService(strategy); } control.ChildsLoaded += () => { //после загрузки всех дочерних контролов можно запустить инициализацию по истории if (strategy.Security == null || strategy.Portfolio == null) { return; } new ResetStrategyCommand(strategy).Process(control); if (strategy.SessionType == SessionType.Battle && strategy.GetIsAutoStart()) { new StartStrategyCommand(strategy).Process(strategy); } }; }
public static void SetStrategy(this OptimizatorContent control, StrategyContainer strategy) { strategy.BindStrategyToScope(control); control.Strategy = strategy; }