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 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 PrintPagesVoid() { CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); string strPages = string.Empty; acc.AddParameter("TYPE", "PAGES"); oCLI.Execute("selectionset", acc); acc.GetParameter("PAGES", ref strPages); Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.SetNeededSteps(3); oProgress.SetTitle("Drucken"); oProgress.ShowImmediately(); foreach (string Page in strPages.Split(';')) { if (!oProgress.Canceled()) { acc.AddParameter("PAGENAME", Page); oCLI.Execute("print", acc); } else { break; } } 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() { Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(true); progress.SetNeededSteps(3); progress.SetTitle("Meine Progressbar"); progress.ShowImmediately(); try { if (!progress.Canceled()) { progress.SetActionText("Step 1"); progress.SetTitle("Titelzeile 1"); progress.Step(1); Thread.Sleep(1000); } if (!progress.Canceled()) { progress.SetActionText("Step 2"); progress.SetTitle("Titelzeile 2"); progress.Step(1); Thread.Sleep(1000); } if (!progress.Canceled()) { progress.SetActionText("Step 3"); progress.SetTitle("Titelzeile 3"); progress.Step(1); Thread.Sleep(1000); } } finally { progress.EndPart(true); } 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 Function() { Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.SetNeededSteps(3); oProgress.SetTitle("My progress bar"); oProgress.ShowImmediately(); if (!oProgress.Canceled()) { oProgress.SetActionText("Step 1"); oProgress.SetTitle("Headline 1"); oProgress.Step(1); Thread.Sleep(1000); } if (!oProgress.Canceled()) { oProgress.SetActionText("Step 2"); oProgress.SetTitle("Headline 2"); oProgress.Step(1); Thread.Sleep(1000); } if (!oProgress.Canceled()) { oProgress.SetActionText("Step 3"); oProgress.SetTitle("Headline 3"); oProgress.Step(1); Thread.Sleep(1000); } oProgress.EndPart(true); return; }
public void Function() { Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.SetNeededSteps(3); oProgress.SetTitle("Meine Progressbar"); oProgress.ShowImmediately(); if (!oProgress.Canceled()) { oProgress.SetActionText("Step 1"); oProgress.SetTitle("Titelzeile 1"); oProgress.Step(1); Thread.Sleep(1000); } if (!oProgress.Canceled()) { oProgress.SetActionText("Step 2"); oProgress.SetTitle("Titelzeile 2"); oProgress.Step(1); Thread.Sleep(1000); } if (!oProgress.Canceled()) { oProgress.SetActionText("Step 3"); oProgress.SetTitle("Titelzeile 3"); oProgress.Step(1); Thread.Sleep(1000); } oProgress.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 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() { 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 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 PrintPagesVoid() { CommandLineInterpreter oCLI = new CommandLineInterpreter(); ActionCallingContext acc = new ActionCallingContext(); string strPages = string.Empty; acc.AddParameter("TYPE", "PAGES"); oCLI.Execute("selectionset", acc); acc.GetParameter("PAGES", ref strPages); Progress oProgress = new Progress("SimpleProgress"); oProgress.SetAllowCancel(true); oProgress.SetAskOnCancel(true); oProgress.SetNeededSteps(3); oProgress.SetTitle("Drucken"); oProgress.ShowImmediately(); foreach (string Page in strPages.Split(';')) { if (!oProgress.Canceled()) { acc.AddParameter("PAGENAME", Page); oCLI.Execute("print", acc); } else { break; } } oProgress.EndPart(true); return; }
private void AddButtonsScripts() { int scriptCount = 0; Progress progress = new Progress("SimpleProgress"); progress.SetAllowCancel(true); progress.SetAskOnCancel(false); progress.SetNeededSteps(_groups.SelectMany(obj => obj).Count() + 1); progress.SetTitle("Meine Progressbar"); progress.ShowImmediately(); try { foreach (var group in _groups) { scriptCount++; string scriptName = group.Key; if (progress.Canceled()) { progress.EndPart(true); return; } if (_createSeparateToolBar) { _toolbarName = "ShopForProcess_" + scriptName; RemoveToolbar(); CreateToolbar(); } // Create buttons var scriptVariants = group.OrderBy(obj => obj.Name); foreach (var scriptObject in scriptVariants) { progress.SetActionText(scriptName + ": " + scriptObject.Name); progress.Step(1); // Standard if (!scriptObject.CustomActions.Any()) { string action = GetCommandline(scriptName, scriptObject.Name); string imagePath = Path.Combine("$(MD_SCRIPTS)", scriptName, "Images", scriptObject.Scriptname + ".bmp"); string toolTip = scriptName + " " + scriptObject.Name; _toolbar.AddButton(_toolbarName, 0, action, imagePath, toolTip); } // Custom action else { foreach (var customAction in scriptObject.CustomActions) { string action = customAction.Split(' ')[0]; string imagePath = Path.Combine("$(MD_SCRIPTS)", scriptName, "Images", action + ".bmp"); string toolTip = scriptName + " " + scriptObject.Name + " " + action; _toolbar.AddButton(_toolbarName, 0, customAction, imagePath, toolTip); } } } // Separator if (!_createSeparateToolBar) { if (!_groups.Last().Equals(group)) { AddSeparator(); } } //#if DEBUG // if (scriptCount == 3) // { // return; // } //#endif } } finally { progress.EndPart(true); } return; }
//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; } }
/// <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); }