Ejemplo n.º 1
0
        public TransferViewModel(
            ILoggerFacade logger,
            IStatusBar statusBar,
            IRegionManager regionManager,
            IEventAggregator eventAggregator,
            ITradingServiceAsync tradingService,
            Bullsfirst.InterfaceOut.Oms.MarketDataServiceReference.IMarketDataServiceAsync marketDataService,
            UserContext userContext,
            ReferenceData referenceData)
        {
            logger.Log("TransferViewModel.TransferViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _statusBar = statusBar;
            _regionManager = regionManager;
            _eventAggregator = eventAggregator;
            _tradingService = tradingService;
            _marketDataService = marketDataService;
            this.UserContext = userContext;
            this.ReferenceData = referenceData;

            _tradingService.TransferCashCompleted += new EventHandler<AsyncCompletedEventArgs>(TransferCallback);
            _tradingService.TransferSecuritiesCompleted += new EventHandler<AsyncCompletedEventArgs>(TransferCallback);
            _tradingService.AddExternalAccountCompleted += new EventHandler<AddExternalAccountCompletedEventArgs>(AddExternalAccountCallback);
            _marketDataService.GetMarketPriceCompleted +=
                new EventHandler<InterfaceOut.Oms.MarketDataServiceReference.GetMarketPriceCompletedEventArgs>(GetMarketPriceCallback);
            TransferCommand = new DelegateCommand<object>(this.TransferExecute, this.CanTransferExecute);
            AddExternalAccountCommand = new DelegateCommand<object>(this.AddExternalAccountExecute);
            this.PropertyChanged += this.OnPropertyChanged;
            this.ValidateAll();

            SubscribeToEvents();
        }
Ejemplo n.º 2
0
 private void GetMarketPriceCallback(
     object sender,
     Bullsfirst.InterfaceOut.Oms.MarketDataServiceReference.GetMarketPriceCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         _statusBar.ShowMessage(e.Error.Message, Category.Exception, Priority.High);
     }
     else
     {
         _statusBar.Clear();
         LastTrade = new Money
         {
             Amount = e.Result.Price.Amount,
             Currency = e.Result.Price.Currency
         };
     }
 }