예제 #1
0
 private void GetData()
 {
     BusyViewModel.ActiveAsync(string.Format("... Loading {0} ...", _ticker))
     .Then(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
     .Then(() => _service.GetDataAsync(_ticker, DateTime.Now.AddMonths(-1), DateTime.Now), Scheduler.Task.TPL)
     .Then(data => Items.AddRangeAsync(data), Scheduler.Dispatcher.TPL)
     .LogException(Log)
     .CatchAndHandle(x => StandardDialog.Error("Error", "Problem getting chart data"), Scheduler.Task.TPL)
     .Finally(BusyViewModel.InActive, Scheduler.Task.TPL);
 }
예제 #2
0
 private Task RefreshQuotesAsync()
 {
     return(_service.GetQuotesAsync()
            .Do(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
            .Then(quotes =>
     {
         var items = quotes.Select(x => new QuoteBlotterItemViewModel
         {
             Id = x.Id,
             Instrument = x.InstrumentName,
             CreatedBy = x.CreatedBy,
             CreatedOn = x.CreatedOn,
             ModifiedBy = x.ModifiedBy,
             ModifiedOn = x.ModifiedOn
         });
         return Items.AddRangeAsync(items);
     }, Scheduler.Dispatcher.TPL)
            .LogException(Log));
 }
예제 #3
0
        public Task Initialise <T>(IEnumerable <T> items)
        {
            Columns.AddRange(DynamicColumnHelper.GetColumns <T>());

            return(Items.AddRangeAsync(DynamicColumnHelper.ConvertToExpando(items)));
        }