// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <EmptyFullCode> lst = null; using (var ctx = new EmptyFullCodeRepository()) { lst = await ctx.GetEmptyFullCodesByExpressionNav(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 <EmptyFullCodeExcelLine, List <EmptyFullCodeExcelLine> > { dataToPrint = lst.Select(x => new EmptyFullCodeExcelLine { EmptyFullCodeName = x.EmptyFullCodeName, EmptyFullDescription = x.EmptyFullDescription }).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 <EmptyFullCode> lst = null; using (var ctx = new EmptyFullCodeRepository()) { lst = await ctx.GetEmptyFullCodesByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedEmptyFullCodes = new ObservableCollection <EmptyFullCode>(lst); }