Exemplo n.º 1
0
 public FindSymbolViewModel(
     IDispatcherHelper dispatcherHelper,
     IQueueProcessor queueProcessor,
     IFindSymbolService findSymbolService,
     OrdersListViewModel ordersListViewModel)
     : base(dispatcherHelper, queueProcessor)
 {
     _findSymbolService      = findSymbolService;
     OrdersListViewModel     = ordersListViewModel;
     Symbol.PropertyChanged += OnSymbolPropertyChanged;
 }
Exemplo n.º 2
0
        public MainViewModel(
            IDispatcherHelper dispatcherHelper,
            IConnectionService connectionService,
            IOrderCalculationService orderCalculationService,
            PositionsViewModel positionsViewModel,
            SettingsViewModel settingsViewModel,
            OrdersListViewModel ordersListViewModel,
            IRiskCalculationService riskCalculationService,
            ITradeRecordingService tradeRecordingService)
            : base(dispatcherHelper)
        {
            _connectionService                  = connectionService;
            OrdersListViewModel                 = ordersListViewModel;
            _riskCalculationService             = riskCalculationService;
            _tradeRecordingService              = tradeRecordingService;
            PositionsViewModel                  = positionsViewModel;
            _settingsViewModel                  = settingsViewModel;
            _settingsViewModel.PropertyChanged += OnSettingsViewModelPropertyChanged;
            _orderCalculationService            = orderCalculationService;

            Messenger.Default.Register <ConnectionChangedMessage>(this, HandleConnectionChangedMessage);
            Messenger.Default.Register <DetailsPanelClosedMessage>(this, HandleDetailsPanelClosed);
            Messenger.Default.Register <OrderStatusChangedMessage>(this, OrderStatusChangedMessage.Tokens.Main, HandleOrderStatusChangedMessage);

            _connectionService.ClientError += HandleClientError;
            SetConnectionStatus();
            CreateMenuItems();

            // Load settings on a different thread as it's slow and so that we can show the main window straight away
            Task.Run(() => _settingsViewModel.LoadSettingsAsync())
            .ContinueWith(t =>
            {
                HandleLoadSettingsTaskResult(t);
            })
            .ConfigureAwait(false);
        }