private Connector MainPanel_OnCreateConnector(string path) { //HistoryPath.Folder = path; var entityRegistry = new CsvEntityRegistry(path); var exchangeInfoProvider = new StorageExchangeInfoProvider(entityRegistry, false); ConfigManager.RegisterService <IExchangeInfoProvider>(exchangeInfoProvider); var storageRegistry = new StorageRegistry(exchangeInfoProvider) { DefaultDrive = new LocalMarketDataDrive(path) }; ConfigManager.RegisterService <IEntityRegistry>(entityRegistry); ConfigManager.RegisterService <IStorageRegistry>(storageRegistry); // ecng.serialization invoke in several places IStorage obj ConfigManager.RegisterService(entityRegistry.Storage); INativeIdStorage nativeIdStorage = new CsvNativeIdStorage(Path.Combine(path, "NativeId")) { DelayAction = entityRegistry.DelayAction }; ConfigManager.RegisterService(nativeIdStorage); var snapshotRegistry = new SnapshotRegistry(Path.Combine(path, "Snapshots")); return(new Connector(entityRegistry.Securities, entityRegistry.PositionStorage, exchangeInfoProvider, storageRegistry, snapshotRegistry, new StorageBuffer())); }
public MainWindow() { InitializeComponent(); Instance = this; Title = Title.Put("Multi connection"); _ordersWindow.MakeHideable(); _myTradesWindow.MakeHideable(); _tradesWindow.MakeHideable(); _securitiesWindow.MakeHideable(); _stopOrdersWindow.MakeHideable(); _portfoliosWindow.MakeHideable(); _orderLogWindow.MakeHideable(); _newsWindow.MakeHideable(); var path = _defaultDataPath.ToFullPath(); _settingsFile = Path.Combine(path, "connection.xml"); var logManager = new LogManager(); logManager.Listeners.Add(new FileLogListener { LogDirectory = Path.Combine(path, "Logs") }); logManager.Listeners.Add(Monitor); HistoryPath.Folder = path; var entityRegistry = new CsvEntityRegistry(path); var storageRegistry = new StorageRegistry { DefaultDrive = new LocalMarketDataDrive(path) }; ConfigManager.RegisterService <IEntityRegistry>(entityRegistry); ConfigManager.RegisterService <IStorageRegistry>(storageRegistry); // ecng.serialization invoke in several places IStorage obj ConfigManager.RegisterService(entityRegistry.Storage); INativeIdStorage nativeIdStorage = new CsvNativeIdStorage(Path.Combine(path, "NativeId")) { DelayAction = entityRegistry.DelayAction }; ConfigManager.RegisterService(nativeIdStorage); var snapshotRegistry = new SnapshotRegistry(Path.Combine(path, "Snapshots")); Connector = new Connector(entityRegistry, storageRegistry, snapshotRegistry); logManager.Sources.Add(Connector); InitConnector(entityRegistry, snapshotRegistry, nativeIdStorage); }