private void LoadStocksInfo() { IsLoadingStocksInfo = true; Task.Factory.StartNew(() => { var stocksInfos = new TradingSymbolManager().GetSavedStockSymbolInfo(this.CurrentApiClient); return(stocksInfos); }).ContinueWith((res) => { StocksInfoes = new ObservableCollection <SaveStockInfo>(res.Result); IsLoadingStocksInfo = false; }, TaskScheduler.FromCurrentSynchronizationContext()); }
public BuySellSignalConfigurationViewmodel() { LoadAppSetting(); _configuredStocksDictionary = new Dictionary <string, BuySellOnSignalSymbolConfig>(); EditGlobalProfitCommand = new DelegateCommand(EditGlobalProfitCommandExecute); CancelGlobalProfitCommand = new DelegateCommand(CancelGlobalProfitCommandExecute); ApplyGlobalProfitCommand = new DelegateCommand(ApplyGlobalProfitCommandExecute, ApplyGlobalProfitCommandCanExecute); SetGlobalProfitLossCommand = new DelegateCommand(SetGlobalProfitLossCommandExecute); MaxProfitEditCommand = new DelegateCommand(MaxProfitEditCommandExecute); MaxLossEditCommand = new DelegateCommand(MaxProfitLossCommandExecute); AddCommand = new DelegateCommand(AddCommandExecute, AddCommandCanExecute); SquareOffCommand = new DelegateCommand(SquareOffCommandExecute); StartCommand = new DelegateCommand(StartCommandExecute); _tradingSymbolManager = new TradingSymbolManager(); Exchanges = _tradingSymbolManager.GetExchanges().ToList(); Events.PositionUpdateEvent += Events_PositionUpdateEvent; Events.StatusChangedEvent += Events_StatusChangedEvent; Events.InactiveStockPNLChanged += Events_InactiveStockPNLChanged; LoadReversalConfigSetting(); this.PropertyChanged += BuySellSignalConfigurationViewmodel_PropertyChanged; Events.TargetStopLossChangeEvent += Events_TargetStopLossChangeEvent; Events.StockLTPChangedEvent += Events_StockLTPChangedEvent; StartTime = DateTime.Now.TimeOfDay; }