/// <summary> /// Displays the required constructor parameter names for the selected strategy /// </summary> /// <param name="strategyConstructorInfo">Contains details of selected strategy constructor</param> private void DisplayConstructorParameterNames(StrategyConstructorInfo strategyConstructorInfo) { try { if (Logger.IsDebugEnabled) { Logger.Debug("Displaying constructor details." + strategyConstructorInfo.ParameterInfo, _type.FullName, "DisplayConstructorParameterNames"); } // Save Selected strategy Type (class which implements TradeHubStrategy.cs) _strategyType = strategyConstructorInfo.StrategyType; // Save loaded Constructor parameters info _parmatersInfo = strategyConstructorInfo.ParameterInfo; // Get View to display details var context = ContextRegistry.GetContext(); _constructorView = context.GetObject("ConstructorView") as ConstructorView; if (_constructorView != null) { // Set List View Header values _constructorView.SetGridColumnHeader(strategyConstructorInfo.ParameterInfo); // Display Details _constructorView.Show(); } } catch (Exception exception) { Logger.Error(exception, _type.FullName, "DisplayConstructorParameterNames"); } }
/// <summary> /// Loads user strategy and extracts constructor parameters /// </summary> private void LoadUserStrategy(LoadStrategy loadStrategy) { try { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("Trying to load user defined strategy from: " + loadStrategy.StrategyAssembly.FullName.Substring(0, loadStrategy.StrategyAssembly.FullName.IndexOf(",", System.StringComparison.Ordinal)), _type.FullName, "LoadUserStrategy"); } var strategyDetails = LoadCustomStrategy.GetConstructorDetails(loadStrategy.StrategyAssembly); if (strategyDetails != null) { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("Successfully loaded custom strategy: " + strategyDetails.Item1.Name, _type.Name, "LoadUserStrategy"); } // Create new Strategy Constructor Info object StrategyConstructorInfo strategyConstructorInfo = new StrategyConstructorInfo( strategyDetails.Item2, strategyDetails.Item1); // Publish Event to Notify Listener. EventSystem.Publish <StrategyConstructorInfo>(strategyConstructorInfo); } } catch (Exception exception) { _asyncClassLogger.Error(exception, _type.FullName, "LoadUserStrategy"); } }