// Send to Excel Implementation public async Task Send2Excel() { IEnumerable <Document_Type> lst = null; using (var ctx = new Document_TypeRepository()) { lst = await ctx.GetDocument_TypeByExpressionNav(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 <Document_TypeExcelLine, List <Document_TypeExcelLine> > { dataToPrint = lst.Select(x => new Document_TypeExcelLine { Type_of_declaration = x.Type_of_declaration, Declaration_gen_procedure_code = x.Declaration_gen_procedure_code }).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 <Document_Type> lst = null; using (var ctx = new Document_TypeRepository()) { lst = await ctx.GetDocument_TypeByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false); } SelectedDocument_Type = new ObservableCollection <Document_Type>(lst); }