Exemple #1
0
        /// <summary>
        /// Async function to start writing a report
        /// </summary>
        private async void StartWriteReportAsync()
        {
            var selectedPath = "";
            await Application.Current.Dispatcher.InvokeAsync(() =>
            {
                //Open a folder browser dialog so that the user can chose a target directory for saving the report
                var selected = resultImages.Where(ri => ri.Selected);
                var dialog   = new FolderBrowserDialog();
                var result   = dialog.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return;
                }
                selectedPath = dialog.SelectedPath;
            });

            if (String.IsNullOrEmpty(selectedPath))
            {
                return;
            }
            //Setup and start the generation
            var rw = new ReportWriter(resultImages.Where(ri => ri.Selected).ToList(), selectedPath, CreatorName, ReportName);
            await rw.Generate();
        }