public MainWindow() { InitializeComponent(); Logger logger = Logger.Instance; //A. Intitalization: Setup Initial componenets MessageHandler = new MessageHandler(); InstrumentManager = new InstrumentManager(); OrderManager = new OrderManager(); ibClient = new EWrapperImpl(); lw = new LogWindow(); dw = new DataWindow(); tw = new Tactics(); logger.Log(string.Format("Logging started at {0}", DateTime.Now)); //B. Dependancy Injection? : Componenet Linkages ibClient.MessageHandler = MessageHandler; MessageHandler.EwarapperImpl = ibClient; MessageHandler.MyMainWindow = this; MessageHandler.Logwindow = lw; MessageHandler.DataWindow = dw; MessageHandler.OrderManager = OrderManager; MessageHandler.InstrumentManager = InstrumentManager; //C. Load External Data ///including connection parameters InstrumentManager.InstrumentsFromCSV(); //D. Start Monitoring MessageHandler.StartMonitoring(); //E. Establish Connections // cbInstruments.DataContext = cm.ActiveContracts; foreach (var instrument in InstrumentManager.ActiveContracts) { cbInstruments.Items.Add(instrument.BBCode); } //Add lists //ObservableCollection<Contract> contractList = new ObservableCollection<Contract>(); //ObservableCollection<Order> orderList = new ObservableCollection<Order>(); //ObservableCollection<Execution> tradeList = new ObservableCollection<Execution>(); //contractList = new ObservableCollection<Contract>(InstrumentManager.ActiveContracts.ToList()); //orderList = new ObservableCollection<Order>(OrderManager.ActiveOrders.ToList()); //tradeList = new ObservableCollection<Execution>(OrderManager.Executions.ToList()); dgOrders.ItemsSource = OrderManager.ActiveOrders.ToList(); dgContracts.ItemsSource = InstrumentManager.ActiveContracts.ToList(); dgTrades.ItemsSource = OrderManager.Executions.ToList(); lw.Show(); dw.Show(); tw.Show(); }