Beispiel #1
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);
                    }
                }
            };
        }
Beispiel #2
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);
				}
			};
		}