private void InitializeDataSource() { _storageRegistry = new StorageRegistry(); ConfigManager.RegisterService(_storageRegistry); _entityRegistry = (HydraEntityRegistry)ConfigManager.GetService <IEntityRegistry>(); _entityRegistry.TasksSettings.Recycle = false; ((SecurityList)_entityRegistry.Securities).BulkLoad = true; _dbFile = _entityRegistry.FirstTimeInit(Properties.Resources.StockSharp, db => _entityRegistry.Version = HydraEntityRegistry.LatestVersion); CheckDatabase(); ConfigManager.RegisterService <IExchangeInfoProvider>(new ExchangeInfoProvider(_entityRegistry)); var allSec = _entityRegistry.Securities.GetAllSecurity(); if (allSec != null) { return; } _entityRegistry.Securities.Add(new Security { Id = Core.Extensions.AllSecurityId, Code = "ALL", //Class = task.GetDisplayName(), Name = LocalizedStrings.Str2835, Board = ExchangeBoard.Associated, ExtensionInfo = new Dictionary <object, object>(), }); _entityRegistry.Securities.DelayAction.WaitFlush(); }
public ImportPane() { InitializeComponent(); _settings = new Settings { ColumnSeparator = ",", //RowSeparator = Environment.NewLine, }; SettingsGrid.SelectedObject = _settings; FieldsGrid.ItemsSource = _fields; _worker = new BackgroundWorker { WorkerSupportsCancellation = true, WorkerReportsProgress = true }; _worker.DoWork += OnDoWork; _worker.ProgressChanged += OnProgressChanged; _worker.RunWorkerCompleted += OnRunWorkerCompleted; _entityRegistry = ConfigManager.GetService <HydraEntityRegistry>(); }
public ImportPane() { InitializeComponent(); _settings = new Settings { ColumnSeparator = ",", //RowSeparator = Environment.NewLine, }; SettingsGrid.SelectedObject = _settings; FieldsGrid.ItemsSource = _fields; _worker = new BackgroundWorker { WorkerSupportsCancellation = true, WorkerReportsProgress = true }; _worker.DoWork += OnDoWork; _worker.ProgressChanged += OnProgressChanged; _worker.RunWorkerCompleted += OnRunWorkerCompleted; _entityRegistry = ConfigManager.GetService<HydraEntityRegistry>(); }
private void InitializeDataSource() { _storageRegistry = new StorageRegistry(); ConfigManager.RegisterService(_storageRegistry); _entityRegistry = (HydraEntityRegistry)ConfigManager.GetService<IEntityRegistry>(); _entityRegistry.TasksSettings.Recycle = false; ((SecurityList)_entityRegistry.Securities).BulkLoad = true; var database = (Database)_entityRegistry.Storage; if (database != null) { var conStr = new DbConnectionStringBuilder { ConnectionString = database.ConnectionString }; _dbFile = (string)conStr.Cast<KeyValuePair<string, object>>().ToDictionary(StringComparer.InvariantCultureIgnoreCase).TryGetValue("Data Source"); if (_dbFile != null) { _dbFile = _dbFile.Replace("%Documents%", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); conStr["Data Source"] = _dbFile; database.ConnectionString = conStr.ToString(); _dbFile.CreateDirIfNotExists(); if (!File.Exists(_dbFile)) { Properties.Resources.StockSharp.Save(_dbFile); _entityRegistry.Version = HydraEntityRegistry.LatestVersion; UpdateDatabaseWalMode(); } } } CheckDatabase(); ConfigManager.RegisterService<IExchangeInfoProvider>(new ExchangeInfoProvider(_entityRegistry)); var allSec = _entityRegistry.Securities.ReadById(Core.Extensions.AllSecurityId); if (allSec != null) return; _entityRegistry.Securities.Add(new Security { Id = Core.Extensions.AllSecurityId, Code = "ALL", //Class = task.GetDisplayName(), Name = LocalizedStrings.Str2835, Board = ExchangeBoard.Associated, ExtensionInfo = new Dictionary<object, object>(), }); _entityRegistry.Securities.DelayAction.WaitFlush(); }
private void InitializeDataSource() { _storageRegistry = new StorageRegistry(); ConfigManager.RegisterService(_storageRegistry); _entityRegistry = (HydraEntityRegistry)ConfigManager.GetService <IEntityRegistry>(); _entityRegistry.TasksSettings.Recycle = false; ((SecurityList)_entityRegistry.Securities).BulkLoad = true; var database = (Database)_entityRegistry.Storage; if (database != null) { var conStr = new DbConnectionStringBuilder { ConnectionString = database.ConnectionString }; _dbFile = (string)conStr.Cast <KeyValuePair <string, object> >().ToDictionary(StringComparer.InvariantCultureIgnoreCase).TryGetValue("Data Source"); if (_dbFile != null) { _dbFile = _dbFile.Replace("%Documents%", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); conStr["Data Source"] = _dbFile; database.ConnectionString = conStr.ToString(); _dbFile.CreateDirIfNotExists(); if (!File.Exists(_dbFile)) { Properties.Resources.StockSharp.Save(_dbFile); _entityRegistry.Version = HydraEntityRegistry.LatestVersion; UpdateDatabaseWalMode(); } } } CheckDatabase(); ConfigManager.RegisterService <IExchangeInfoProvider>(new ExchangeInfoProvider(_entityRegistry)); var allSec = _entityRegistry.Securities.GetAllSecurity(); if (allSec != null) { return; } _entityRegistry.Securities.Add(new Security { Id = Core.Extensions.AllSecurityId, Code = "ALL", //Class = task.GetDisplayName(), Name = LocalizedStrings.Str2835, Board = ExchangeBoard.Associated, ExtensionInfo = new Dictionary <object, object>(), }); _entityRegistry.Securities.DelayAction.WaitFlush(); }
private void InitializeDataSource() { _storageRegistry = new StorageRegistry(); ConfigManager.RegisterService(_storageRegistry); _entityRegistry = (HydraEntityRegistry)ConfigManager.GetService<IEntityRegistry>(); _entityRegistry.TasksSettings.Recycle = false; ((SecurityList)_entityRegistry.Securities).BulkLoad = true; _dbFile = _entityRegistry.FirstTimeInit(Properties.Resources.StockSharp, db => _entityRegistry.Version = HydraEntityRegistry.LatestVersion); CheckDatabase(); ConfigManager.RegisterService<IExchangeInfoProvider>(new ExchangeInfoProvider(_entityRegistry)); var allSec = _entityRegistry.Securities.GetAllSecurity(); if (allSec != null) return; _entityRegistry.Securities.Add(new Security { Id = Core.Extensions.AllSecurityId, Code = "ALL", //Class = task.GetDisplayName(), Name = LocalizedStrings.Str2835, Board = ExchangeBoard.Associated, ExtensionInfo = new Dictionary<object, object>(), }); _entityRegistry.Securities.DelayAction.WaitFlush(); }