private void Worker_DoWork(object sender, DoWorkEventArgs e) { IniFile getpath = new IniFile(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Settings.ini")); string path = getpath.IniReadValue("FilePath", "BOM_OUTPUT_LOCATION"); string BOMExcelfulltitle = System.IO.Path.Combine(path, System.IO.Path.GetFileNameWithoutExtension(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name) + "_BOM.xlsx"); //Generate button functionality //Create BOM Excel try { statusText = "Re-populating Drawing Item Numbers... (Task 1 of 6)"; worker.ReportProgress(10); BOM od = new BOM(); od.Generate(ExcelOutput: true); } catch { } statusText = "Generating BOM Spreadsheet... (Task 2 of 6)"; worker.ReportProgress(40); //Create Time Rollup Excel //Create Time Rollup XML statusText = "Generating Time Rollup Spreadsheet... (Task 3 of 6)"; worker.ReportProgress(60); try { timeRollupExcelandXML(); } catch { } statusText = "Generating Time Rollup XML... (Task 4 of 6)"; worker.ReportProgress(70); //Create Drawing PDF with BOM Excel added to Bottom statusText = "Generating Drawing PDF... (Task 5 of 6)"; worker.ReportProgress(80); try { generatePDF(BOMExcelfulltitle);//Adding Excel to PDF is pending } catch { } statusText = "Appending BOM Spreadsheet to PDF... (Task 5 of 6)"; worker.ReportProgress(90); statusText = "All tasks have Completed!"; worker.ReportProgress(100); }
private void implementFn() { IniFile getpath = new IniFile(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Settings.ini")); string path = getpath.IniReadValue("FilePath", "BOM_OUTPUT_LOCATION"); string BOMExcelfulltitle = System.IO.Path.Combine(path, System.IO.Path.GetFileNameWithoutExtension(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name) + "_BOM.xlsx"); //string BOMExcelfulltitle = System.IO.Path.Combine(path, System.IO.Path.GetFileNameWithoutExtension(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name) + "_"+DateTime.Now.ToString("yyyy_MM_dd")+"_XML.xlsx"); //Generate button functionality //Create BOM Excel try { statusText = "Generating Production Drawing…"; lblpbBarContent.Content = statusText; pbBar.Value = (5); DoEventsHandler.DoEvents(); statusText = "Re-populating Drawing Item Numbers... (Task 1 of 6)"; lblpbBarContent.Content = statusText; pbBar.Value = (8); DoEventsHandler.DoEvents(); statusText = "Generating BOM Spreadsheet... (Task 2 of 6)"; lblpbBarContent.Content = statusText; pbBar.Value = 10; DoEventsHandler.DoEvents(); BOM od = new BOM(); od.strBomName = textBoxdesc.Text; od.Generate(ExcelOutput: true); //statusText = "Generating BOM Spreadsheet... (Task 2 of 6)"; //lblpbBarContent.Content = statusText; ////pbBar.Value = (40); //pbBar.Value = pbBar.Value + 10; //DoEventsHandler.DoEvents(); if (od.sheetvalue != null && od.sheetvalue.Count > 0) { String title = ""; foreach (KeyValuePair <string, string> kvp in od.sheetvalue) { if (kvp.Key.Equals("DRG", StringComparison.InvariantCultureIgnoreCase)) { title = kvp.Value; break; } } BOMExcelfulltitle = System.IO.Path.Combine(path, title + "_BOM.xlsx"); } } catch { } //statusText = "Generating BOM Spreadsheet... (Task 2 of 6)"; //lblpbBarContent.Content = statusText; ////pbBar.Value = (40); //pbBar.Value = pbBar.Value + 10; //DoEventsHandler.DoEvents(); statusText = "Generating Time Rollup Spreadsheet... (Task 3 of 6)"; lblpbBarContent.Content = statusText; //pbBar.Value = (60); pbBar.Value = pbBar.Value + 30; DoEventsHandler.DoEvents(); try { timeRollupExcelandXML(); } catch { } statusText = "Generating Time Rollup XML... (Task 4 of 6)"; lblpbBarContent.Content = statusText; //pbBar.Value = (70); pbBar.Value = pbBar.Value + 15; DoEventsHandler.DoEvents(); //Create Drawing PDF with BOM Excel added to Bottom statusText = "Generating Drawing PDF... (Task 5 of 6)"; lblpbBarContent.Content = statusText; pbBar.Value = pbBar.Value + (20); DoEventsHandler.DoEvents(); try { generatePDF(BOMExcelfulltitle);//Adding Excel to PDF is pending } catch { } //statusText = "Appending BOM Spreadsheet to PDF... (Task 6 of 6)"; //lblpbBarContent.Content = statusText; ////pbBar.Value = (90); //pbBar.Value = pbBar.Value + 10; //DoEventsHandler.DoEvents(); statusText = "All tasks have Completed!"; lblpbBarContent.Content = statusText; pbBar.Value = (100); DoEventsHandler.DoEvents(); }