// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <SubItems> lst = null; using (var ctx = new SubItemsRepository()) { lst = await ctx.GetSubItemsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } if (lst == null || !lst.Any()) { MessageBox.Show("No Data to Send to Excel"); return; } var s = new ExportToExcel <SubItemsExcelLine, List <SubItemsExcelLine> > { dataToPrint = lst.Select(x => new SubItemsExcelLine { ItemNumber = x.ItemNumber, ItemDescription = x.ItemDescription, Quantity = x.Quantity, QtyAllocated = x.QtyAllocated }).ToList() }; using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
public async Task SelectAll() { IEnumerable <SubItems> lst = null; using (var ctx = new SubItemsRepository()) { lst = await ctx.GetSubItemsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedSubItems = new ObservableCollection <SubItems>(lst); }