public void Function() { CommandLineInterpreter oCLI = new CommandLineInterpreter(); Progress oProgress = new Progress("EnhancedProgress"); oProgress.SetAllowCancel(false); oProgress.ShowImmediately(); oProgress.BeginPart(33, "Part 1"); oCLI.Execute("generate /TYPE:CONNECTIONS"); oProgress.EndPart(); oProgress.BeginPart(33, "Part 2"); oCLI.Execute("reports"); oProgress.EndPart(); oProgress.BeginPart(33, "Part 3"); oCLI.Execute("compress /FILTERSCHEME:Standard"); oProgress.EndPart(); oProgress.EndPart(true); return; }
public void Function() { string projectPath = PathMap.SubstitutePath("$(PROJECTPATH)"); Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(false); progress.SetNeededSteps(3); progress.SetTitle("Beschriftung"); progress.ShowImmediately(); if (!progress.Canceled()) { progress.BeginPart(50, "Artikelsummenstückliste wird erstellt..."); string fileName = Path.Combine(projectPath, "Artikelsummenstückliste.xlsx"); ActionCallingContext context1 = new ActionCallingContext(); context1.AddParameter("configscheme", "Summarized parts list"); context1.AddParameter("filterscheme", ""); context1.AddParameter("sortscheme", ""); context1.AddParameter("language", "de_DE"); context1.AddParameter("destinationfile", fileName); context1.AddParameter("recrepeat", "1"); context1.AddParameter("taskrepeat", "1"); context1.AddParameter("showoutput", "1"); context1.AddParameter("type", "PROJECT"); new CommandLineInterpreter().Execute("label", context1); progress.EndPart(); } if (!progress.Canceled()) { progress.BeginPart(50, "Betriebsmittelbeschriftung wird erstellt..."); string fileName = Path.Combine(projectPath, "Betriebsmittelliste.xlsx"); ActionCallingContext context2 = new ActionCallingContext(); context2.AddParameter("configscheme", "Device tag list"); context2.AddParameter("filterscheme", ""); context2.AddParameter("sortscheme", ""); context2.AddParameter("language", "de_DE"); context2.AddParameter("destinationfile", fileName); context2.AddParameter("recrepeat", "1"); context2.AddParameter("taskrepeat", "1"); context2.AddParameter("showoutput", "1"); context2.AddParameter("type", "PROJECT"); new CommandLineInterpreter().Execute("label", context2); progress.EndPart(); } progress.EndPart(true); return; }
public void Function() { string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)" + @"\"); Progress progress = new Progress("SimpleProgress"); progress.BeginPart(100, ""); progress.SetAllowCancel(true); if (!progress.Canceled()) { progress.BeginPart(50, "Artikelsummenstückliste wird erstellt..."); ActionCallingContext labellingContext = new ActionCallingContext(); labellingContext.AddParameter("CONFIGSCHEME", "Summarized parts list"); labellingContext.AddParameter("DESTINATIONFILE", strProjectpath + "Artikelsummenstückliste.xls"); labellingContext.AddParameter("FILTERSCHEME", ""); labellingContext.AddParameter("LANGUAGE", "de_DE"); labellingContext.AddParameter("LogMsgActionDone", "true"); labellingContext.AddParameter("SHOWOUTPUT", "1"); labellingContext.AddParameter("RECREPEAT", "1"); labellingContext.AddParameter("SORTSCHEME", ""); labellingContext.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext); progress.EndPart(); } if (!progress.Canceled()) { progress.BeginPart(50, "Betriebsmittelbeschriftung wird erstellt..."); ActionCallingContext labellingContext1 = new ActionCallingContext(); labellingContext1.AddParameter("CONFIGSCHEME", "Device tag list"); labellingContext1.AddParameter("DESTINATIONFILE", strProjectpath + "Betriebsmittelbeschriftung.xls"); labellingContext1.AddParameter("FILTERSCHEME", ""); labellingContext1.AddParameter("LANGUAGE", "de_DE"); labellingContext1.AddParameter("LogMsgActionDone", "true"); labellingContext1.AddParameter("SHOWOUTPUT", "1"); labellingContext1.AddParameter("RECREPEAT", "1"); labellingContext1.AddParameter("SORTSCHEME", ""); labellingContext1.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext1); progress.EndPart(); } progress.EndPart(true); return; }
public void Function() { string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)" + @"\"); Progress progress = new Progress("SimpleProgress"); progress.BeginPart(100, ""); progress.SetAllowCancel(true); if (!progress.Canceled()) { progress.BeginPart(50, "Item summary list is created..."); ActionCallingContext labellingContext = new ActionCallingContext(); labellingContext.AddParameter("CONFIGSCHEME", "Summarized parts list"); labellingContext.AddParameter("DESTINATIONFILE", strProjectpath + "Summarized_parts_list.xls"); labellingContext.AddParameter("FILTERSCHEME", ""); labellingContext.AddParameter("LANGUAGE", "en_US"); labellingContext.AddParameter("LogMsgActionDone", "true"); labellingContext.AddParameter("SHOWOUTPUT", "1"); labellingContext.AddParameter("RECREPEAT", "1"); labellingContext.AddParameter("SORTSCHEME", ""); labellingContext.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext); progress.EndPart(); } if (!progress.Canceled()) { progress.BeginPart(50, "Device label is created..."); ActionCallingContext labellingContext1 = new ActionCallingContext(); labellingContext1.AddParameter("CONFIGSCHEME", "Device tag list"); labellingContext1.AddParameter("DESTINATIONFILE", strProjectpath + "Labeling_equipment.xls"); labellingContext1.AddParameter("FILTERSCHEME", ""); labellingContext1.AddParameter("LANGUAGE", "en_US"); labellingContext1.AddParameter("LogMsgActionDone", "true"); labellingContext1.AddParameter("SHOWOUTPUT", "1"); labellingContext1.AddParameter("RECREPEAT", "1"); labellingContext1.AddParameter("SORTSCHEME", ""); labellingContext1.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext1); progress.EndPart(); } progress.EndPart(true); return; }
public bool Execute(ActionCallingContext oActionCallingContext) { SelectionSet Set = new SelectionSet(); Project CurrentProject = Set.GetCurrentProject(true); string ProjectName = CurrentProject.ProjectName; //DoWireMarking.DoWireMarking.MassageHandler(ProjectName); // Show ProgressBar Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(true); progress.SetTitle("DWG/PDF export"); progress.ShowImmediately(); progress.BeginPart(25.0, "ChangeFontType to GOST Type AU : "); try { ChangeDrawMode(CurrentProject, 2); ChangeFontType("??_??@GOST Type AU;"); progress.EndPart(); progress.BeginPart(25.0, "Export to DWG : "); ExportToDwg(); } catch (Exception ex) { progress.EndPart(true); DoWireMarking.DoWireMarking.ErrorHandler("Export to DWG", ex); return(false); } progress.EndPart(); progress.BeginPart(25.0, "ChangeFontType to GOST type A : "); progress.Step(1); try { ChangeFontType("??_??@GOST type A;"); progress.EndPart(); progress.BeginPart(25.0, "Export to PDF : "); ExportToPdf(ProjectName); ChangeDrawMode(CurrentProject, 3); } catch (Exception ex) { DoWireMarking.DoWireMarking.ErrorHandler("Export to PDF", ex); return(false); } finally { //ChangeFontType(CurrentProject, ""); progress.EndPart(true); } return(true); }
public void Function() { string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)" + @"\"); Progress progress = new Progress("SimpleProgress"); progress.BeginPart(100, ""); progress.SetAllowCancel(true); if (!progress.Canceled()) { progress.BeginPart(50, "Artikelsummenstückliste wird erstellt..."); ActionCallingContext labellingContext = new ActionCallingContext(); labellingContext.AddParameter("CONFIGSCHEME", "Summarized parts list"); labellingContext.AddParameter("DESTINATIONFILE", strProjectpath + "Artikelsummenstückliste.xls"); labellingContext.AddParameter("FILTERSCHEME", ""); labellingContext.AddParameter("LANGUAGE", "de_DE"); labellingContext.AddParameter("LogMsgActionDone", "true"); labellingContext.AddParameter("SHOWOUTPUT", "1"); labellingContext.AddParameter("RECREPEAT", "1"); labellingContext.AddParameter("SORTSCHEME", ""); labellingContext.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext); progress.EndPart(); } if (!progress.Canceled()) { progress.BeginPart(50, "Betriebsmittelbeschriftung wird erstellt..."); ActionCallingContext labellingContext1 = new ActionCallingContext(); labellingContext1.AddParameter("CONFIGSCHEME", "Device tag list"); labellingContext1.AddParameter("DESTINATIONFILE", strProjectpath + "Betriebsmittelbeschriftung.xls"); labellingContext1.AddParameter("FILTERSCHEME", ""); labellingContext1.AddParameter("LANGUAGE", "de_DE"); labellingContext1.AddParameter("LogMsgActionDone", "true"); labellingContext1.AddParameter("SHOWOUTPUT", "1"); labellingContext1.AddParameter("RECREPEAT", "1"); labellingContext1.AddParameter("SORTSCHEME", ""); labellingContext1.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext1); progress.EndPart(); } progress.EndPart(true); return; }
public bool Execute(ActionCallingContext oActionCallingContext) { Progress oProgress = new Progress("Состояние экспорта"); oProgress.SetAllowCancel(true); #region Прогресс бар 1 oProgress.BeginPart(60.0, ""); oProgress.SetActionText("Получение данных из проекта.."); oProgress.SetNeededSteps(1); oProgress.Step(1); #endregion //выбрать текущий проект SelectionSet Set = new SelectionSet(); Project CurrentProject = Set.GetCurrentProject(true); //пути файлов string exportXMLPath = CurrentProject.ProjectDirectoryPath + @"\Temp.xml"; string exportFilePath = CurrentProject.ProjectDirectoryPath + @"\DOC\Спецификация по шкафам.xlsx"; //выгрузка в XML PartsService partsService = new PartsService(); partsService.ExportPartsList(CurrentProject, exportXMLPath, 0); oProgress.EndPart(false); #region Прогресс бар 2 oProgress.BeginPart(25.0, ""); oProgress.SetActionText("Сортировка.."); oProgress.SetNeededSteps(1); oProgress.Step(1); #endregion //загрузка в лист ListOfDevices listOfDevices = new ListOfDevices(); List <Part> devices = listOfDevices.GetAllDevices(exportXMLPath); var partsFiltered = from p in devices where ((p.PartNo != "None") && (p.Quantity != 0) && (p.PartNo != "Шильд")) orderby p.PartNo select p; oProgress.EndPart(false); #region Прогресс бар 3 oProgress.BeginPart(15.0, ""); oProgress.SetActionText("Экспорт в Excel.."); oProgress.SetNeededSteps(1); oProgress.Step(1); #endregion XLSSerializer serializer = new XLSSerializer(); serializer.Serialize(exportFilePath, partsFiltered.ToList()); oProgress.EndPart(true); return(true); }
public void Function() { string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strDestination = strFullProjectname; DialogResult Result = MessageBox.Show( "Soll eine Sicherung für das Projekt\n'" + strProjectname + "'\nerzeugt werden?", "Datensicherung", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (Result == DialogResult.Yes) { string myTime = System.DateTime.Now.ToString("yyyy.MM.dd"); string hour = System.DateTime.Now.Hour.ToString(); string minute = System.DateTime.Now.Minute.ToString(); Progress progress = new Progress("SimpleProgress"); progress.BeginPart(100, ""); progress.SetAllowCancel(true); if (!progress.Canceled()) { progress.BeginPart(33, "Backup"); ActionCallingContext backupContext = new ActionCallingContext(); backupContext.AddParameter("BACKUPMEDIA", "DISK"); backupContext.AddParameter("BACKUPMETHOD", "BACKUP"); backupContext.AddParameter("COMPRESSPRJ", "0"); backupContext.AddParameter("INCLEXTDOCS", "1"); backupContext.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL"); backupContext.AddParameter("INCLIMAGES", "1"); backupContext.AddParameter("LogMsgActionDone", "true"); backupContext.AddParameter("DESTINATIONPATH", strDestination); backupContext.AddParameter("PROJECTNAME", strFullProjectname); backupContext.AddParameter("TYPE", "PROJECT"); backupContext.AddParameter("ARCHIVENAME", strProjectname + "_" + myTime + "_" + hour + "." + minute + "."); new CommandLineInterpreter().Execute("backup", backupContext); progress.EndPart(); } progress.EndPart(true); } return; }
public void Function() { string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strDestination = strFullProjectname; DialogResult Result = MessageBox.Show( "Soll eine Sicherung für das Projekt\n'" + strProjectname + "'\nerzeugt werden?", "Datensicherung", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (Result == DialogResult.Yes) { string myTime = System.DateTime.Now.ToString("yyyy.MM.dd"); string hour = System.DateTime.Now.Hour.ToString(); string minute = System.DateTime.Now.Minute.ToString(); Progress progress = new Progress("SimpleProgress"); progress.BeginPart(100, ""); progress.SetAllowCancel(true); if (!progress.Canceled()) { progress.BeginPart(33, "Backup"); ActionCallingContext backupContext = new ActionCallingContext(); backupContext.AddParameter("BACKUPMEDIA", "DISK"); backupContext.AddParameter("BACKUPMETHOD", "BACKUP"); backupContext.AddParameter("COMPRESSPRJ", "0"); backupContext.AddParameter("INCLEXTDOCS", "1"); backupContext.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL"); backupContext.AddParameter("INCLIMAGES", "1"); backupContext.AddParameter("LogMsgActionDone", "true"); backupContext.AddParameter("DESTINATIONPATH", strDestination); backupContext.AddParameter("PROJECTNAME", strFullProjectname); backupContext.AddParameter("TYPE", "PROJECT"); backupContext.AddParameter("ARCHIVENAME", strProjectname + "_" + myTime + "_" + hour + "." + minute + "."); new CommandLineInterpreter().Execute("backup", backupContext); progress.EndPart(); } progress.EndPart(true); } return; }
public void Function() { string projectsPath = PathMap.SubstitutePath("$(MD_PROJECTS)"); OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "ProjectInfo.xml|ProjectInfo.xml"; ofd.InitialDirectory = projectsPath; ofd.Title = "Projekteigenschaften auswählen:"; ofd.ValidateNames = false; if (ofd.ShowDialog() == DialogResult.OK) { Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(false); progress.BeginPart(100, ""); progress.SetTitle("Projekteigenschaften importieren"); progress.ShowImmediately(); CommandLineInterpreter cli = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("TYPE", "READPROJECTINFO"); acc.AddParameter("FILENAME", ofd.FileName); cli.Execute("projectmanagement", acc); progress.EndPart(true); cli.Execute("XPrjActionPropertiesEdit"); } return; }
private void ExecutePDFExport(string projectFullPath) { EnumDecisionReturn result = MessageBoxShow(EnumDecisionType.eYesNoDecision, string.Format("Do you want to create PDF for {0}?", projectFullPath), "PDF-Export", EnumDecisionReturn.eYES, EnumDecisionIcon.eQUESTION); if (result == EnumDecisionReturn.eYES) { Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.ShowImmediately(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("TYPE", "PDFPROJECTSCHEME"); acc.AddParameter("PROJECTNAME", projectFullPath); acc.AddParameter("EXPORTFILE", string.Format("{0}\\EPLANScript\\{1}_{2}.pdf", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), PathMap.SubstitutePath("$(PROJECTNAME)"), DateTime.Now.ToString("yyMMdd.HHmmssfff"))); acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value"); oCLI.Execute("export", acc); oProgress.EndPart(true); } return; }
public void Function() { string strFullProjectname = PathMap.SubstitutePath("$(P)"); string projectsPath = PathMap.SubstitutePath("$(MD_PROJECTS)"); string projectName = PathMap.SubstitutePath("$(PROJECTNAME)"); string date = DateTime.Now.ToString("yyyy-MM-dd"); string time = DateTime.Now.ToString("HH-mm-ss"); string backupDirectory = Path.Combine(projectsPath, "Backup"); string backupFileName = projectName + "_" + date + "_" + time + ".zw1"; string backupFullFileName = Path.Combine(backupDirectory, backupFileName); if (!Directory.Exists(backupDirectory)) { Directory.CreateDirectory(backupDirectory); } Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(true); progress.BeginPart(100, ""); progress.SetTitle("Backup"); progress.ShowImmediately(); if (!progress.Canceled()) { CommandLineInterpreter cli = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL"); acc.AddParameter("BACKUPMEDIA", "DISK"); acc.AddParameter("BACKUPMETHOD", "BACKUP"); acc.AddParameter("COMPRESSPRJ", "1"); acc.AddParameter("INCLEXTDOCS", "1"); acc.AddParameter("INCLIMAGES", "1"); acc.AddParameter("ARCHIVENAME", backupFileName); acc.AddParameter("DESTINATIONPATH", backupDirectory); acc.AddParameter("TYPE", "PROJECT"); cli.Execute("backup", acc); } progress.EndPart(true); MessageBox.Show( "Backup wurde erfolgreich erstellt:" + Environment.NewLine + backupFullFileName, "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Information ); return; }
public void Function() { string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)"); string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strDate = DateTime.Now.ToString("yyyy-MM-dd"); string strTime = DateTime.Now.ToString("hh-mm-ss"); string strBackupDirectory = strProjectpath + @"\Backup\"; string strBackupFilename = strProjectname + "_Backup_" + strDate + "_" + strTime; if (!System.IO.Directory.Exists(strBackupDirectory)) { System.IO.Directory.CreateDirectory(strBackupDirectory); } Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.SetTitle("Backup"); oProgress.ShowImmediately(); if (!oProgress.Canceled()) { CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("BACKUPMEDIA", "DISK"); acc.AddParameter("ARCHIVENAME", strBackupFilename); acc.AddParameter("BACKUPMETHOD", "BACKUP"); acc.AddParameter("COMPRESSPRJ", "1"); acc.AddParameter("INCLEXTDOCS", "1"); acc.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL"); acc.AddParameter("INCLIMAGES", "1"); acc.AddParameter("LogMsgActionDone", "true"); acc.AddParameter("DESTINATIONPATH", strBackupDirectory); acc.AddParameter("PROJECTNAME", strFullProjectname); acc.AddParameter("TYPE", "PROJECT"); oCLI.Execute("backup", acc); } oProgress.EndPart(true); MessageBox.Show( "Backup was created successfully:\n" + strBackupFilename, "Note", MessageBoxButtons.OK, MessageBoxIcon.Information ); return; }
public void Function() { string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)"); string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strDate = DateTime.Now.ToString("yyyy-MM-dd"); string strTime = DateTime.Now.ToString("hh-mm-ss"); string strBackupDirectory = strProjectpath + @"\Backup\"; string strBackupFilename = strProjectname + "_Backup_" + strDate + "_" + strTime; if (!System.IO.Directory.Exists(strBackupDirectory)) { System.IO.Directory.CreateDirectory(strBackupDirectory); } Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.SetTitle("Backup"); oProgress.ShowImmediately(); if (!oProgress.Canceled()) { CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("BACKUPMEDIA", "DISK"); acc.AddParameter("ARCHIVENAME", strBackupFilename); acc.AddParameter("BACKUPMETHOD", "BACKUP"); acc.AddParameter("COMPRESSPRJ", "1"); acc.AddParameter("INCLEXTDOCS", "1"); acc.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL"); acc.AddParameter("INCLIMAGES", "1"); acc.AddParameter("LogMsgActionDone", "true"); acc.AddParameter("DESTINATIONPATH", strBackupDirectory); acc.AddParameter("PROJECTNAME", strFullProjectname); acc.AddParameter("TYPE", "PROJECT"); oCLI.Execute("backup", acc); } oProgress.EndPart(true); MessageBox.Show( "Backup wurde erfolgreich erstellt:\n" + strBackupFilename, "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Information ); return; }
public void PagePdfVoid() { FolderBrowserDialog fbd = new FolderBrowserDialog(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); if (fbd.ShowDialog() != DialogResult.OK) { return; } Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.ShowImmediately(); try { string strPages = string.Empty; acc.AddParameter("TYPE", "PAGES"); oCLI.Execute("selectionset", acc); acc.GetParameter("PAGES", ref strPages); foreach (string CurrentPage in strPages.Split(';')) { if (!oProgress.Canceled()) { acc.AddParameter("TYPE", "PDFPAGESSCHEME"); acc.AddParameter("PAGENAME", CurrentPage); acc.AddParameter("EXPORTFILE", fbd.SelectedPath + @"\" + CurrentPage); acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value"); oCLI.Execute("export", acc); } else { oProgress.EndPart(true); return; } } Process.Start(fbd.SelectedPath); oProgress.EndPart(true); } catch (System.Exception ex) { oProgress.EndPart(true); MessageBox.Show("Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void PagePdfVoid() { FolderBrowserDialog fbd = new FolderBrowserDialog(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); if (fbd.ShowDialog() != DialogResult.OK) { return; } Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.ShowImmediately(); try { string strPages = string.Empty; acc.AddParameter("TYPE", "PAGES"); oCLI.Execute("selectionset", acc); acc.GetParameter("PAGES", ref strPages); foreach (string CurrentPage in strPages.Split(';')) { if (!oProgress.Canceled()) { acc.AddParameter("TYPE", "PDFPAGESSCHEME"); acc.AddParameter("PAGENAME", CurrentPage); acc.AddParameter("EXPORTFILE", fbd.SelectedPath + @"\" + CurrentPage); acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value"); oCLI.Execute("export", acc); } else { oProgress.EndPart(true); return; } } Process.Start(fbd.SelectedPath); oProgress.EndPart(true); } catch (System.Exception ex) { oProgress.EndPart(true); MessageBox.Show("Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Function() { CommandLineInterpreter oCLI = new CommandLineInterpreter(); Progress oProgress = new Progress("EnhancedProgress"); oProgress.SetAllowCancel(false); oProgress.ShowImmediately(); oProgress.BeginPart(33, "Part 1"); oCLI.Execute("generate /TYPE:CONNECTIONS"); oProgress.EndPart(); oProgress.BeginPart(33, "Part 2"); oCLI.Execute("reports"); oProgress.EndPart(); oProgress.BeginPart(33, "Part 3"); oCLI.Execute("compress /FILTERSCHEME:Standard"); oProgress.EndPart(); oProgress.EndPart(true); return; }
public void Function() { string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)" + @"\"); string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); DialogResult Result = MessageBox.Show( "Soll ein PDF für das Projekt\n'" + strProjectname + "'\nerzeugt werden?", "PDF-Export", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (Result == DialogResult.Yes) { Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.ShowImmediately(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("TYPE", "PDFPROJECTSCHEME"); acc.AddParameter("PROJECTNAME", strFullProjectname); acc.AddParameter("EXPORTFILE", strProjectpath + strProjectname); acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value"); oCLI.Execute("export", acc); oProgress.EndPart(true); } return; }
public void Function() { string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strProjectpath = PathMap.SubstitutePath("$(PROJECTPATH)" + @"\"); string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); DialogResult Result = MessageBox.Show( "Soll ein PDF für das Projekt\n'" + strProjectname + "'\nerzeugt werden?", "PDF-Export", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (Result == DialogResult.Yes) { Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.BeginPart(100, ""); oProgress.ShowImmediately(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("TYPE", "PDFPROJECTSCHEME"); acc.AddParameter("PROJECTNAME", strFullProjectname); acc.AddParameter("EXPORTFILE", strProjectpath + strProjectname); acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value"); oCLI.Execute("export", acc); oProgress.EndPart(true); } return; }
public void Function() { string projectPath = PathMap.SubstitutePath("$(PROJECTPATH)"); string projectName = PathMap.SubstitutePath("$(PROJECTNAME)"); DialogResult dialogResult = MessageBox.Show( "Soll ein PDF für das Projekt'" + Environment.NewLine + projectName + "'" + Environment.NewLine + "erzeugt werden?", "PDF-Export", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (dialogResult == DialogResult.Yes) { Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(true); progress.BeginPart(100, ""); progress.ShowImmediately(); CommandLineInterpreter cli = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); string fullFileName = Path.Combine(projectPath, projectName); acc.AddParameter("TYPE", "PDFPROJECTSCHEME"); acc.AddParameter("EXPORTFILE", fullFileName); acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value"); cli.Execute("export", acc); progress.EndPart(true); } return; }
public void Function() { string strProjects = PathMap.SubstitutePath("$(MD_PROJECTS)"); string strFilename = string.Empty; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "ProjectInfo.xml|ProjectInfo.xml"; ofd.InitialDirectory = strProjects; ofd.Title = "Select project properties:"; ofd.ValidateNames = true; if (ofd.ShowDialog() == DialogResult.OK) { strFilename = ofd.FileName; Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(false); oProgress.BeginPart(100, ""); oProgress.SetTitle("Import project properties"); oProgress.ShowImmediately(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext cc = new ActionCallingContext(); cc.AddParameter("TYPE", "READPROJECTINFO"); cc.AddParameter("FILENAME", strFilename); oCLI.Execute("projectmanagement", cc); oProgress.EndPart(true); oCLI.Execute("XPrjActionPropertiesEdit"); } return; }
public void Function() { string strProjects = PathMap.SubstitutePath("$(MD_PROJECTS)"); string strFilename = string.Empty; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "ProjectInfo.xml|ProjectInfo.xml"; ofd.InitialDirectory = strProjects; ofd.Title = "Projekteigenschaften auswählen:"; ofd.ValidateNames = true; if (ofd.ShowDialog() == DialogResult.OK) { strFilename = ofd.FileName; Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(false); oProgress.BeginPart(100, ""); oProgress.SetTitle("Projekteigenschaften importieren"); oProgress.ShowImmediately(); CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext cc = new ActionCallingContext(); cc.AddParameter("TYPE", "READPROJECTINFO"); cc.AddParameter("FILENAME", strFilename); oCLI.Execute("projectmanagement", cc); oProgress.EndPart(true); oCLI.Execute("XPrjActionPropertiesEdit"); } return; }
/// <summary> /// Execute Action /// </summary> /// <param name="oActionCallingContext"></param> /// <returns></returns> public bool Execute(ActionCallingContext oActionCallingContext) { SelectionSet Set = new SelectionSet(); Project CurrentProject = Set.GetCurrentProject(true); string ProjectName = CurrentProject.ProjectName; Debug.WriteLine(ProjectName); string xlsFileName = Path.GetDirectoryName(CurrentProject.ProjectFullName); xlsFileName = Path.Combine(xlsFileName, $"{ DateTime.Now.Year }.{ DateTime.Now.Month }.{ DateTime.Now.Day }_" + Settings.Default.outputFileName); // Show ProgressBar Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(true); progress.SetTitle("Wire mark export"); progress.ShowImmediately(); progress.BeginPart(25.0, "Export label : "); try { // Executing Action "label" ExportXML.Execute(xmlExportFileName); if (progress.Canceled()) { progress.EndPart(true); return(true); } } catch (Exception ex) { ErrorHandler("ExportXML", ex); return(false); } progress.EndPart(); progress.BeginPart(25.0, "Parse XML : "); try { // Getting object from XML ParseXMLWireFile(); if (progress.Canceled()) { progress.EndPart(true); return(true); } } catch (Exception ex) { ErrorHandler("ParseXMLWireFile", ex); return(false); } progress.EndPart(); progress.BeginPart(10.0, "Write data to Excel : " + xlsFileName); try { // Export to excel // Creating *.xls file ExportToExcel.Execute(listOfLines, xlsFileName, progress); if (progress.Canceled()) { progress.EndPart(true); return(true); } } catch (Exception ex) { ErrorHandler("ExportToExcel.Execute", ex); return(false); } finally { progress.EndPart(true); } return(true); }
public void PDFPerLocationAction(string rootFolder) { /* This script loads the following scheme files from the $(MD_SCHEME) folder: * * LB.Mounting_Location_List.xml : Labeling scheme to export project's Sturecture Identifiers. * Relies on the FGfiSO.Mounting_Locations_only.xml labeling filter * FGfiSO.Mounting_Locations_only.xml : Labeling filter scheme to export only the Mounting Location Structure Identifiers * PDs.Mounting_Locations.xml : PDF export scheme. Relies on the PBfiN.Mounting_Locations.xml Page filter * PBfiN.Mounting_Locations.xml: Page filter based on a Mounting Location * * It also uses a "template" for the PBfiN.Mounting_Locations.xml Page filter. * It does string substitution to set a specific Mounting Location as the filter criteria. * After string substitution, the resulting Page filter scheme file is reloaded to set the desired ML * */ CommandLineInterpreter CLI = new CommandLineInterpreter(); ActionCallingContext ctx = new ActionCallingContext(); Settings set = new Settings(); try { //Load the PDF Export scheme. If a scheme with the same name already exists in P8, it will be overwritten. string pathPDFScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCHEME)"), "PDs.Mounting_Locations.xml"); set.ReadSettings(pathPDFScheme); //Load the Page Filter scheme. If a scheme with the same name already exists in P8, it will be overwritten. string pathFilterScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCHEME)"), "FGfiSO.Mounting_Locations_only.xml"); set.ReadSettings(pathFilterScheme); //Load the labeling scheme. If a scheme with the same name already exists in P8, it will be overwritten. string pathLabelingScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCHEME)"), "LB.Mounting_Location_List.xml"); string pathMLOutput = Path.Combine(PathMap.SubstitutePath("$(TMP)"), "AllMountingLocations.txt"); set.ReadSettings(pathLabelingScheme); //Export the project's Mounting Locations to temporary file, one per line ctx.AddParameter("configscheme", "Mounting_Location_List"); ctx.AddParameter("destinationfile", pathMLOutput); ctx.AddParameter("language", "en_US"); CLI.Execute("label", ctx); //Read the Mounting Location file as a List<string> for later iteration List <string> MLs = File.ReadLines(pathMLOutput).ToList(); string pathTemplate = Path.Combine(PathMap.SubstitutePath("$(MD_SCHEME)"), "PBfiN.Mounting_Locations_template.xml"); string pathPageFilterScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCHEME)"), "PBfiN.Mounting_Locations.xml"); //Loop through each Mounting Location in the "label" file foreach (string ML in MLs) { //Init Progress bar using (Progress prg = new Progress("SimpleProgress")) { prg.BeginPart(100, ""); prg.SetTitle("Exporting: " + ML); prg.SetAllowCancel(false); prg.ShowImmediately(); //Read the "template" file, and substitute the real Mounting Location string content = File.ReadAllText(pathTemplate); content = content.Replace("!!MountingLocation!!", ML); //Save the result back to disk, and load the resulting Page Filter scheme File.WriteAllText(pathPageFilterScheme, content); set.ReadSettings(pathPageFilterScheme); //Call the PDF export, using the scheme that makes use of the Page Filter ctx = new ActionCallingContext(); ctx.AddParameter("TYPE", "PDFPROJECTSCHEME"); ctx.AddParameter("EXPORTSCHEME", "Mounting_Locations"); ctx.AddParameter("EXPORTFILE", Path.Combine(rootFolder, ML)); CLI.Execute("export", ctx); prg.EndPart(true); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//Button: Dokumente kopieren private void btnKopieren_Click(object sender, EventArgs e) { //gibt es das Ziel auch? if (!Directory.Exists(txtZielverzeichnis.Text)) { //Hinweis, Ziel gibt es nicht, anlegen? #if DEBUG DialogResult dialogResult = MessageBox.Show("Das Zielverzeichnis [" + txtZielverzeichnis.Text + "] ist nicht auf dem Datenträger vorhanden!\n\nSoll dieses nun angelegt werden?", "Documentation-Tool", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialogResult == DialogResult.Yes) { Directory.CreateDirectory(txtZielverzeichnis.Text); } else if (dialogResult == DialogResult.No) { return; } #else Decider decider = new Decider(); EnumDecisionReturn decision = decider.Decide( EnumDecisionType.eYesNoDecision, // type "Das Zielverzeichnis [" + txtZielverzeichnis.Text + "] ist nicht auf dem Datenträger vorhanden!\n\nSoll dieses nun angelegt werden?", "Documentation-Tool", EnumDecisionReturn.eYES, // selected Answer EnumDecisionReturn.eYES); // Answer if quite-mode on if (decision == EnumDecisionReturn.eYES) { Directory.CreateDirectory(txtZielverzeichnis.Text); } else if (decision == EnumDecisionReturn.eNO) { return; } #endif } //Es gibt dasZiel if (Directory.Exists(txtZielverzeichnis.Text)) { ListView.CheckedListViewItemCollection checkedItems = listView.CheckedItems; #if !DEBUG Progress oProgress = new Progress("SimpleProgress"); oProgress.ShowImmediately(); oProgress.SetAllowCancel(true); oProgress.SetTitle("Documentation-Tool"); int nActionsPercent = 100 / checkedItems.Count; #endif foreach (ListViewItem item in checkedItems) { #if !DEBUG if (!oProgress.Canceled()) { oProgress.BeginPart(nActionsPercent, "Kopiere: " + item.Text); #endif string sTargetPath = txtZielverzeichnis.Text; //Hersteller-Verzeichnis hinzufügen if (toolStripMenuHerstellerVerzeichnis.Checked) { try { string sTemp = item.SubItems[2].Text; sTemp = RemoveIlegaleCharackter(sTemp); //Verzeichnisnamen von ungültigen Zeichen bereinigen sTargetPath = Path.Combine(sTargetPath, sTemp); if (!Directory.Exists(sTargetPath)) //Verzeichnis anlegen wenn noch nicht vorhanden { Directory.CreateDirectory(sTargetPath); } } catch (Exception exc) { String strMessage = exc.Message; MessageBox.Show("Exception: " + strMessage + "\n\n" + sTargetPath, "Documentation-Tool, btnKopieren", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //Artikelnummer-Verzeichnis hinzufügen if (toolStripMenuArtikelnummerVerzeichnis.Checked) { try { string sTemp = item.SubItems[3].Text; sTemp = RemoveIlegaleCharackter(sTemp); //Verzeichnisnamen von ungültigen Zeichen bereinigen sTargetPath = Path.Combine(sTargetPath, sTemp); if (!Directory.Exists(sTargetPath)) //Verzeichnis anlegen wenn noch nicht vorhanden { Directory.CreateDirectory(sTargetPath); } } catch (Exception exc) { String strMessage = exc.Message; MessageBox.Show("Exception: " + strMessage + "\n\n" + sTargetPath, "Documentation-Tool, btnKopieren", MessageBoxButtons.OK, MessageBoxIcon.Error); } } DocumentCopy(item.Text, sTargetPath); #if !DEBUG oProgress.EndPart(); } #endif } #if !DEBUG oProgress.EndPart(true); #endif Close(); return; } }
//PXF Datei einlesen private void PXFeinlesen(string sFileName) { //Progressbar ein #if !DEBUG Progress oProgress = new Progress("SimpleProgress"); oProgress.SetTitle("Documentation-Tool"); //oProgress.SetActionText("Projektdaten durchsuchen"); oProgress.BeginPart(50, "Projektdaten durchsuchen"); oProgress.ShowImmediately(); #endif //MessageBox.Show("XML.Reader :" + sFileName); ListViewItem objListViewItem = new ListViewItem(); //Wir benötigen einen XmlReader für das Auslesen der XML-Datei XmlTextReader XMLReader = new XmlTextReader(sFileName); //Es folgt das Auslesen der XML-Datei while (XMLReader.Read()) //Es sind noch Daten vorhanden { //Alle Attribute (Name-Wert-Paare) abarbeiten if (XMLReader.AttributeCount > 0) { string sArtikelnummer = string.Empty; string sHersteller = string.Empty; //Es sind noch weitere Attribute vorhanden while (XMLReader.MoveToNextAttribute()) //nächstes { if (XMLReader.Name == "P22001") // Artikel (eingelagert) Artikelnummer) { sArtikelnummer = XMLReader.Value; } if (XMLReader.Name == "P22007") // Artikel (eingelagert) Hersteller) { sHersteller = XMLReader.Value; } if ( XMLReader.Name == "A2082" || // Hyperlink Dokument //XMLReader.Name == "P11058" || // Fremddokument XMLReader.Name == "P22149" || // Artikel (eingelagert) Externes Dokument 1 XMLReader.Name == "P22150" || // Artikel (eingelagert) Externes Dokument 2 XMLReader.Name == "P22151" || // Artikel (eingelagert) Externes Dokument 3 XMLReader.Name == "P22235" || // Artikel (eingelagert) Externes Dokument 4 XMLReader.Name == "P22236" || // Artikel (eingelagert) Externes Dokument 5 XMLReader.Name == "P22237" || // Artikel (eingelagert) Externes Dokument 6 XMLReader.Name == "P22238" || // Artikel (eingelagert) Externes Dokument 7 XMLReader.Name == "P22239" || // Artikel (eingelagert) Externes Dokument 8 XMLReader.Name == "P22240" || // Artikel (eingelagert) Externes Dokument 9 XMLReader.Name == "P22241" || // Artikel (eingelagert) Externes Dokument 10 XMLReader.Name == "P22242" || // Artikel (eingelagert) Externes Dokument 11 XMLReader.Name == "P22243" || // Artikel (eingelagert) Externes Dokument 12 XMLReader.Name == "P22244" || // Artikel (eingelagert) Externes Dokument 13 XMLReader.Name == "P22245" || // Artikel (eingelagert) Externes Dokument 14 XMLReader.Name == "P22246" || // Artikel (eingelagert) Externes Dokument 15 XMLReader.Name == "P22247" || // Artikel (eingelagert) Externes Dokument 16 XMLReader.Name == "P22248" || // Artikel (eingelagert) Externes Dokument 17 XMLReader.Name == "P22249" || // Artikel (eingelagert) Externes Dokument 18 XMLReader.Name == "P22250" || // Artikel (eingelagert) Externes Dokument 19 XMLReader.Name == "P22251" // Artikel (eingelagert) Externes Dokument 20 ) { string[] sValue = XMLReader.Value.Split('\n'); string sDateiname = string.Empty; string sDateiBeschreibung = string.Empty; sDateiname = sValue[0]; //Überprüfen ob Beschreibung vorhanden ist if (sValue.Length == 2) { if (sValue[1] != null && sValue[1] != string.Empty) { sDateiBeschreibung = sValue[1]; #if !DEBUG MultiLangString mlstrDateiBeschreibung = new MultiLangString(); //Nur die deutsche Übersetzung verwenden //String in MultiLanguages wandeln mlstrDateiBeschreibung.SetAsString(sDateiBeschreibung); //Daraus nur die Deutsche übersetzung sDateiBeschreibung = mlstrDateiBeschreibung.GetString(ISOCode.Language.L_de_DE); //Wenn es keine Deutsche gibt, dann die unbestimmte if (sDateiBeschreibung == "") { sDateiBeschreibung = mlstrDateiBeschreibung.GetString(ISOCode.Language.L___); } #endif } } #if !DEBUG sDateiname = PathMap.SubstitutePath(sDateiname); #endif //keine Dokumente die mit HTTP anfangen bearbeiten if (!sDateiname.StartsWith("http")) { objListViewItem = new ListViewItem(); objListViewItem.Name = sDateiname; // Name muß gesetzt werden damit ContainsKey funktioniert objListViewItem.Text = sDateiname; objListViewItem.SubItems.Add(sDateiBeschreibung); //Datei Beschreibung objListViewItem.SubItems.Add(sHersteller); //Hersteller objListViewItem.SubItems.Add(sArtikelnummer); //Artikelnummer objListViewItem.Checked = true; //Prüfen ob Datei vorhanden if (!File.Exists(sDateiname)) { objListViewItem.Checked = false; objListViewItem.ForeColor = System.Drawing.Color.Gray; } //Eintrag in Listview, wenn nicht schon vorhanden if (!listView.Items.ContainsKey(sDateiname)) { listView.Items.Add(objListViewItem); } } } } } } //XMLTextReader schließen XMLReader.Close(); //Spaltenbreite automatisch an Inhaltsbreite anpassen //listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); //Progressbar aus #if !DEBUG oProgress.EndPart(true); #endif return; }