private void AddSecurity_Click(object sender, RoutedEventArgs e)
        {
            _isTooltipVisible = false;

            ((TextBlock)_newSecuritiesTooltip.Content).Foreground = _defaultStorageBrush;
            ((TextBlock)_newSecuritiesTooltip.Content).Text       = _defaultToolTipText;
            _newSecuritiesTooltip.IsOpen = false;

            var window = new SecuritiesWindowEx
            {
                SecurityProvider = ConfigManager.GetService <FilterableSecurityProvider>()
            };

            var selectedSecurities = Securities;

            window.SelectSecurities(selectedSecurities);

            if (!window.ShowModal(this))
            {
                return;
            }

            var toRemove = selectedSecurities.Except(window.SelectedSecurities).ToList();
            var toAdd    = window.SelectedSecurities.Except(selectedSecurities).ToList();

            toRemove.ForEach(ProcessRemoveSecurity);
            toAdd.ForEach(ProcessAddSecurity);

            new ControlChangedCommand(this).Process(this);
        }
Beispiel #2
0
        private void Filter_OnClick(object sender, RoutedEventArgs e)
        {
            var window = new SecuritiesWindowEx
            {
                SecurityProvider = ConfigManager.GetService <ISecurityProvider>()
            };

            var selectedSecurities = Securities;

            window.SelectSecurities(selectedSecurities);

            if (!window.ShowModal(this))
            {
                return;
            }

            var toRemove = selectedSecurities.Except(window.SelectedSecurities).ToArray();
            var toAdd    = window.SelectedSecurities.Except(selectedSecurities).ToArray();

            _securityIds.SyncDo(list =>
            {
                list.Clear();
                list.AddRange(window.SelectedSecurities.Select(s => s.Id));
            });

            toRemove.ForEach(s => new RefuseMarketDataCommand(s, MarketDataTypes.Trades).Process(this));
            toAdd.ForEach(s => new RequestMarketDataCommand(s, MarketDataTypes.Trades).Process(this));

            TradesGrid.Trades.Clear();

            new RequestTradesCommand().Process(this);
            new ControlChangedCommand(this).Process(this);
        }
		private void AddSecurity_Click(object sender, RoutedEventArgs e)
		{
			_isTooltipVisible = false;

			((TextBlock)_newSecuritiesTooltip.Content).Foreground = _defaultStorageBrush;
			((TextBlock)_newSecuritiesTooltip.Content).Text = _defaultToolTipText;
			_newSecuritiesTooltip.IsOpen = false;

			var window = new SecuritiesWindowEx
			{
				SecurityProvider = ConfigManager.GetService<ISecurityProvider>()
			};

			var selectedSecurities = Securities;

			window.SelectSecurities(selectedSecurities);

			if (!window.ShowModal(this))
				return;

			var toRemove = selectedSecurities.Except(window.SelectedSecurities).ToArray();
			var toAdd = window.SelectedSecurities.Except(selectedSecurities).ToArray();

			toRemove.ForEach(ProcessRemoveSecurity);
			toAdd.ForEach(ProcessAddSecurity);

			new ControlChangedCommand(this).Process(this);
		}
		private void Filter_OnClick(object sender, RoutedEventArgs e)
		{
			var window = new SecuritiesWindowEx
			{
				SecurityProvider = ConfigManager.GetService<FilterableSecurityProvider>()
			};

			var selectedSecurities = Securities;

			window.SelectSecurities(selectedSecurities);

			if (!window.ShowModal(this))
				return;

			var toRemove = selectedSecurities.Except(window.SelectedSecurities).ToList();
			var toAdd = window.SelectedSecurities.Except(selectedSecurities).ToList();

			_securityIds.SyncDo(list =>
			{
				list.Clear();
				list.AddRange(window.SelectedSecurities.Select(s => s.Id));
			});

			toRemove.ForEach(s => new RefuseMarketDataCommand(s, MarketDataTypes.Trades).Process(this));
			toAdd.ForEach(s => new RequestMarketDataCommand(s, MarketDataTypes.Trades).Process(this));

			TradesGrid.Trades.Clear();

			new RequestTradesCommand().Process(this);
			new ControlChangedCommand(this).Process(this);
		}