コード例 #1
0
// Send to Excel Implementation


        public async Task Send2Excel()
        {
            IEnumerable <EntryPreviousItems> lst = null;

            using (var ctx = new EntryPreviousItemsRepository())
            {
                lst = await ctx.GetEntryPreviousItemsByExpressionNav(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 <EntryPreviousItemsExcelLine, List <EntryPreviousItemsExcelLine> >
            {
                dataToPrint = lst.Select(x => new EntryPreviousItemsExcelLine
                {
                }).ToList()
            };

            using (var sta = new StaTaskScheduler(numberOfThreads: 1))
            {
                await Task.Factory.StartNew(s.GenerateReport, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false);
            }
        }
コード例 #2
0
        public async Task SelectAll()
        {
            IEnumerable <EntryPreviousItems> lst = null;

            using (var ctx = new EntryPreviousItemsRepository())
            {
                lst = await ctx.GetEntryPreviousItemsByExpressionNav(vloader.FilterExpression, vloader.NavigationExpression).ConfigureAwait(continueOnCapturedContext: false);
            }
            SelectedEntryPreviousItems = new ObservableCollection <EntryPreviousItems>(lst);
        }