Ejemplo n.º 1
0
        //private async Task<IEnumerable<IProductBacklogItem>> ReloadProductBacklogData_1()
        //{
        //    var dates = this.ContextProvider.Date;
        //    this.WaitMessage = string.Format("AlexVB & Kids Presents.{0}Product Backlog Items for{0}[{1:dd MMM};{2:dd MMM}]",
        //        Environment.NewLine, dates.FromDate, dates.ToDate.AddDays(1));
        //    this.IsBusy = true;
        //    try
        //    {
        //        var result = await Task.Run(() =>
        //        {
        //            var items = this.ProductBacklogService
        //                .GetProductBacklogItems(dates.FromDate, dates.ToDate.AddDays(1)).ToList() as IEnumerable<IProductBacklogItem>;
        //            return items;
        //        });
        //        return result;
        //    }
        //    catch (Exception e)
        //    {
        //        // DO error handling here
        //    }
        //    finally
        //    {
        //        this.IsBusy = false;
        //    }
        //    return null;
        //}

        //private void OnBusinessDateChanged_2(IContextProvider provider)
        //{
        //    ReloadProductBacklogData_2();
        //}

        private void ReloadProductBacklogData()
        {
            var dates = this.ContextProvider.Date;

            this.WaitMessage = string.Format("AlexVB & Kids Presents.{0}Product Backlog Items for{0}[{1:dd MMM};{2:dd MMM}]",
                                             Environment.NewLine, dates.FromDate, dates.ToDate.AddDays(1));
            this.IsBusy = true;

            Task.Factory.StartNew(() =>
            {
                var marketData = MarketHistoryProvider.GetHostoricalData(this.Categories.SelectedCategory, dates.FromDate, dates.ToDate);
                return(marketData.ToList());
            }).ContinueWith((result) =>
            {
                if (result.Exception == null)
                {
                    this.BacklogData = result.Result;
                }
                else
                {
                    // do error handling
                }
                IsBusy = false;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
 public List <RegionMarketHistory> GetRegionMarketHistories(int itemLimit)
 {
     return(MarketHistoryProvider.GetMarketHistoryFromWeb(itemLimit));
 }