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); }
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)); }
public Task Initialise <T>(IEnumerable <T> items) { Columns.AddRange(DynamicColumnHelper.GetColumns <T>()); return(Items.AddRangeAsync(DynamicColumnHelper.ConvertToExpando(items))); }