private void mnu_ExportToExcel_Click(object sender, RoutedEventArgs e)
        {
            ExportPicker exportMenu = new ExportPicker();

            exportMenu.ShowDialog();

            if (exportMenu.isAccepted == true)
            {
                ExcelExportResult    = exportMenu.results;
                ExcelExportElements  = exportMenu.elements;
                ExcelExportMaterials = exportMenu.materials;

                //Async Attempt 2:

                if (carboLifeProject != null)
                {
                    carboLifeProject.CalculateProject();

                    //int ProgressToBeupdated = 100;

                    ExcelExportPath = DataExportUtils.GetSaveAsLocation();

                    if (ExcelExportPath != null && ExcelExportPath != "")
                    {
                        BackgroundWorker ExportThread = new BackgroundWorker();
                        ExportThread.WorkerReportsProgress = true;
                        ExportThread.DoWork             += ExportThread_DoWork;
                        ExportThread.ProgressChanged    += ExportThreadProgressChanged;
                        ExportThread.RunWorkerCompleted += ExportThreadCompleted;
                        ExportThread.RunWorkerAsync(new object());
                    }
                    else
                    {
                        MessageBox.Show("The file is open by another process, or cannot be openend, please specify another location");
                    }
                }
            }
        }
Exemple #2
0
 private void btn_Export_Click(object sender, RoutedEventArgs e)
 {
     DataExportUtils.ExportComaringGraphs(CarboLifeProject, projectListToCompareTo);
 }
 private void ExportFile_DoWork(object sender, DoWorkEventArgs e)
 {
     DataExportUtils.ExportToExcel(carboLifeProject, ExcelExportPath, ExcelExportResult, ExcelExportElements, ExcelExportMaterials);
 }