Example #1
0
        static void Main(string[] args)
        {
            var storagePath = "";

            storage = new StorageRegistry()
            {
                DefaultDrive = new LocalMarketDataDrive(storagePath)
            };
            var securityStorage = storage.GetSecurityStorage();
        }
Example #2
0
		public MainWindow()
		{
			InitializeComponent();

			this.LayoutManager = new LayoutManager(this, ProgrammaticDockSite);
			LayoutManager._layoutFile = Path.Combine(_settingsFolder, "layout.xml");

			ConnectCommand = new DelegateCommand(Connect, CanConnect);
			SettingsCommand = new DelegateCommand(Settings, CanSettings);

			Directory.CreateDirectory(_settingsFolder);

			var storageRegistry = new StorageRegistry {DefaultDrive = new LocalMarketDataDrive(_settingsFolder)};
			var securityStorage = storageRegistry.GetSecurityStorage();

			Connector = new Connector {EntityFactory = new StorageEntityFactory(securityStorage)};
			ConfigManager.RegisterService(new FilterableSecurityProvider(securityStorage));
			ConfigManager.RegisterService<IConnector>(Connector);
			ConfigManager.RegisterService<IMarketDataProvider>(Connector);

			_connectionFile = Path.Combine(_settingsFolder, "connection.xml");

			if (File.Exists(_connectionFile))
				Connector.Adapter.Load(new XmlSerializer<SettingsStorage>().Deserialize(_connectionFile));

			_secView = new SecuritiesView(this) {SecurityGrid = {MarketDataProvider = Connector}};

			Connector.NewSecurities += _secView.SecurityGrid.Securities.AddRange;

			Connector.MarketDepthsChanged += depths =>
			{
				foreach (var depth in depths)
				{
					var ctrl = _depths.TryGetValue(depth.Security);

					if (ctrl != null)
						ctrl.UpdateDepth(depth);
				}
			};
		}
Example #3
0
        public MainWindow()
        {
            InitializeComponent();

            LayoutManager = new LayoutManager(this, ProgrammaticDockSite)
            {
                LayoutFile = Path.Combine(_settingsFolder, "layout.xml")
            };

            ConnectCommand  = new DelegateCommand(Connect, CanConnect);
            SettingsCommand = new DelegateCommand(Settings, CanSettings);

            Directory.CreateDirectory(_settingsFolder);

            var storageRegistry = new StorageRegistry {
                DefaultDrive = new LocalMarketDataDrive(_settingsFolder)
            };

            Connector = new Connector();
            var storageAdapter = new StorageMessageAdapter(Connector.Adapter, new EntityRegistry(), storageRegistry);

            ConfigManager.RegisterService <ISecurityProvider>(new FilterableSecurityProvider(storageRegistry.GetSecurityStorage()));
            ConfigManager.RegisterService <IConnector>(Connector);
            ConfigManager.RegisterService <IMarketDataProvider>(Connector);

            _connectionFile = Path.Combine(_settingsFolder, "connection.xml");

            if (File.Exists(_connectionFile))
            {
                Connector.Adapter.Load(new XmlSerializer <SettingsStorage>().Deserialize(_connectionFile));
            }

            _secView = new SecuritiesView(this)
            {
                SecurityGrid = { MarketDataProvider = Connector }
            };

            Connector.MarketDepthsChanged += depths =>
            {
                foreach (var depth in depths)
                {
                    var ctrl = Depths.TryGetValue(depth.Security);

                    if (ctrl != null)
                    {
                        ctrl.UpdateDepth(depth);
                    }
                }
            };
        }