Dictionary <int, int> _sid2s = new Dictionary <int, int>(); // strategy id to index in _strategyitemlist public StrategyGridViewModel() { _globalIdService = ServiceLocator.Current.GetInstance <IGlobalIdService>() as GlobalIdService; _configManagerService = ServiceLocator.Current.GetInstance <IConfigManager>() as ConfigManager; _logger = ServiceLocator.Current.GetInstance <ILoggerFacade>(); _eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); _quotefeedservice = ServiceLocator.Current.GetInstance <IStrategyQuoteFeedService>() as StrategyQuoteFeedService; _quotefeedservice.QuoteFeeViewModel = this; _eventAggregator.GetEvent <InitialPositionEvent>().Subscribe(ClientGotInitialPosition); _eventAggregator.GetEvent <HistBarEvent>().Subscribe(ClientGotHistBar); //_eventaggregator.GetEvent<SendOrderEvent>().Subscribe(ClientGotOrder); _eventAggregator.GetEvent <OrderConfirmationEvent>().Subscribe(ClientGotOrder); _eventAggregator.GetEvent <OrderCancelConfirmationEvent>().Subscribe(ClientGotOrderCancelConfirmation); _eventAggregator.GetEvent <OrderFillEvent>().Subscribe(ClientGotOrderFilled); LoadStrategies(); }
protected override void ConfigureContainer() { base.ConfigureContainer(); //this.RegisterTypeIfMissing(typeof(IModuleTracker), typeof(ModuleTracker), true); string _rootpath = Util.GetRootPath(); ConfigManager _configmanagerservice = ConfigManager.Deserialize(_rootpath + @"\Config\mainsettings.xml"); this.Container.RegisterInstance <IConfigManager>(_configmanagerservice); // register // Set up email // Util.EmailFrom = _configmanagerservice.GmailFrom; // Util.EmailPass = _configmanagerservice.GmailPass; // Util.EmailTo = _configmanagerservice.EmailTo; // _container.RegisterType<IGlobalIdService, GlobalIdService>(new ContainerControlledLifetimeManager()); GlobalIdService _globalidservice = new GlobalIdService(); this.Container.RegisterInstance <IGlobalIdService>(_globalidservice); // Ensure we properly dispose of objects in the container at application exit Application.Current.Exit += (sender, e) => this.Dispose(); }