public void PDFAssistent_ausführen() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage", 1); if (bChecked) { string scriptName = @"$(MD_SCRIPTS)\Ausgabe\PDF\PDF Assistent.cs"; scriptName = PathMap.SubstitutePath(scriptName); ExcecuteScripts(scriptName, "0"); // cboAusgabeNach.SelectedIndex = 0; // ReadSettings(); // PDFexport(txtSpeicherort.Text + txtDateiname.Text + @".pdf"); // Close(); } else { //PDFAssistent_Start(); string scriptName = @"$(MD_SCRIPTS)\Ausgabe\PDF\PDF Assistent.cs"; scriptName = PathMap.SubstitutePath(scriptName); ExcecuteScripts(scriptName, "1"); } } }
public void OpenProjectAndSetPartsDbVoid(string PROJECT, string DATABASE) { if (File.Exists(DATABASE)) { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); oSettings.SetStringSetting("USER.PartsManagementGui.Database", DATABASE, 0); MessageBox.Show("Eingestellte Datenbank:\n" + DATABASE, "OpenProjectAndSetPartsDb", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Datenbank nicht gefunden:\n" + DATABASE + "\n\n Es wurde keine Änderung an den Einstellungen vorgenommen.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (File.Exists(PROJECT)) { ActionCallingContext accProjectOpen = new ActionCallingContext(); accProjectOpen.AddParameter("Project", PROJECT); new CommandLineInterpreter().Execute("ProjectOpen", accProjectOpen); } else { MessageBox.Show("Projekt nicht gefunden:\n" + PROJECT, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; }
public void SetStringSettingVoid() { const string SettingPath = "USER.SCRIPTS.SUPLANUS"; Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); // Check if setting exists if (oSettings.ExistSetting(SettingPath)) { oSettings.DeleteSetting(SettingPath); MessageBox.Show("Setting removed.", SettingPath); } // Add setting oSettings.AddStringSetting( SettingPath, new string[] {}, new string[] {}, "My setting from Suplanus", new string[] { @"Default value of test setting" }, ISettings.CreationFlag.Insert ); // Add setting values oSettings.SetStringSetting(SettingPath, "Message 0", 0); oSettings.SetStringSetting(SettingPath, "Message 1", 1); oSettings.SetStringSetting(SettingPath, "Message 2", 2); MessageBox.Show("Setting OK.", SettingPath); // Show setting values string value = oSettings.GetStringSetting(SettingPath, 1); MessageBox.Show("Value of Index " + 1 + ":\n" + value, SettingPath); }
//Check if Assistant should be started public void PDFAssistant_SollStarten() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); // is project in project folder // If ticked then Project has to be in Folder for Assistant, otherwise no Assistant // If not ticked then Assistant if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", 1); string sProjectInFolder = oSettings.GetStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", 0); if (bChecked) { string sProjectFolder = PathMap.SubstitutePath("$(PROJECTPATH)"); sProjectFolder = sProjectFolder.Substring(0, sProjectFolder.LastIndexOf(@"\")); if (!sProjectFolder.EndsWith(@"\")) { sProjectFolder += @"\"; } if (sProjectInFolder == sProjectFolder) //here maybe even expand on all subfolders(InString ?) { PDFAssistant_ausführen(); } else { Close(); } } else { PDFAssistant_ausführen(); } } }
//Prüfen ob Assistent gestartet werden soll public void PDFAssistent_SollStarten() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //Ist Project in Project-Folder //Wenn angekreuzt dann muß Project im Folder sein für Assistent, sonst kein Assistent //Wenn nicht angekreuzt dann Assistent if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", 1); string sProjectInFolder = oSettings.GetStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", 0); if (bChecked) { string sProjectFolder = PathMap.SubstitutePath("$(PROJECTPATH)"); sProjectFolder = sProjectFolder.Substring(0, sProjectFolder.LastIndexOf(@"\")); if (!sProjectFolder.EndsWith(@"\")) { sProjectFolder += @"\"; } if (sProjectInFolder == sProjectFolder) //hier vielleicht noch erweitern auf alle UnterFolder (InString?) { PDFAssistent_To Run(); } else { Close(); } } else { PDFAssistent_To Run(); } } }
public void SetStringSettingVoid() { const string SettingPath = "USER.SCRIPTS.SUPLANUS"; Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); // Check if setting exists if (oSettings.ExistSetting(SettingPath)) { oSettings.DeleteSetting(SettingPath); MessageBox.Show("Setting removed.", SettingPath); } // Add setting oSettings.AddStringSetting( SettingPath, new string[] {}, new string[] {}, "My setting from Suplanus", new string[] {@"Default value of test setting"}, ISettings.CreationFlag.Insert ); // Add setting values oSettings.SetStringSetting(SettingPath, "Message 0", 0); oSettings.SetStringSetting(SettingPath, "Message 1", 1); oSettings.SetStringSetting(SettingPath, "Message 2", 2); MessageBox.Show("Setting OK.", SettingPath); // Show setting values string value = oSettings.GetStringSetting(SettingPath, 1); MessageBox.Show("Value of Index " + 1 + ":\n" + value, SettingPath); }
//Einstellungen speichen private void SettingsWrite() { #if !DEBUG Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (!oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top")) { oSettings.AddNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top", new int[] { }, new Range[] { }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top", this.Top, 0); if (!oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left")) { oSettings.AddNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left", new int[] { }, new Range[] { }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left", this.Left, 0); if (!oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height")) { oSettings.AddNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height", new int[] { }, new Range[] { }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height", this.Height, 0); if (!oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width")) { oSettings.AddNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width", new int[] { }, new Range[] { }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width", this.Width, 0); if (!oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis")) { oSettings.AddBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis", new bool[] { }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis", toolStripMenuHerstellerVerzeichnis.Checked, 0); if (!oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis")) { oSettings.AddBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis", new bool[] { }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis", toolStripMenuArtikelnummerVerzeichnis.Checked, 0); #endif return; }
//Einstellungen einlesen public void ReadSettings() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //ByProjectClose if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose")) { chkByProjectClose.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose", 1); } //ByEplanEnd if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd")) { chkByEplanEnd.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd", 1); } //Ausführen ohne Nachfrage if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage")) { chkOhneNachfrage.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage", 1); } //Einstellungen speichern if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.SaveSettings")) { chkEinstellungSpeichern.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.SaveSettings", 1); } //Datumsstempel if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.DateStamp")) { chkDatumStempel.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.DateStamp", 1); } //Zeitstempel if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.TimeStamp")) { chkZeitStempel.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.TimeStamp", 1); } //Ausgabe Nach if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.AusgabeNach")) { cboAusgabeNach.SelectedIndex = oSettings.GetNumericSetting("USER.SCRIPTS.PDF_Assistent.AusgabeNach", 1); } //Projekt in Ordner if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdner")) { chkIstInProjektOrdner.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdner", 1); } if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdnerName")) { txtProjektGespeichertInOrdner.Text = oSettings.GetStringSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdnerName", 0); } }
//Einstellungen einlesen public void ReadSettings() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //ByProjectClose if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose")) { chkByProjectClose.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", 1); } //ByEplanEnd if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd")) { chkByEplanEnd.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", 1); } //To Run ohne Nachfrage if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage")) { chkOhneNachfrage.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage", 1); } //Save settings if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings")) { chkSaveSettings.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings", 1); } //DateStamp if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.DateStamp")) { chkDatumStempel.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.DateStamp", 1); } //TimeStamp if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp")) { chkTimeStamp.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp", 1); } //Ausgabe Nach if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.AusgabeNach")) { cboAusgabeNach.SelectedIndex = oSettings.GetNumericSetting("USER.SCRIPTS.PDF_Assistant.AusgabeNach", 1); } //Project in Folder if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder")) { chkIstInProjectFolder.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", 1); } if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName")) { txtProjectFiledInFolder.Text = oSettings.GetStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", 0); } }
//Settings read in public void ReadSettings() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //ByProjectClose if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose")) { chkByProjectClose.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", 1); } //ByEplanEnd if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd")) { chkByEplanEnd.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", 1); } //Run without demand if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand")) { chkWithoutDemand.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand", 1); } //Settings Save if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings")) { chkSaveSettings.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings", 1); } //Dates stamp if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.DateStamp")) { chkDateStamp.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.DateStamp", 1); } //TimeStamp if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp")) { chkTimeStamp.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp", 1); } //Issue after if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.EditionAfter")) { cboEditionAfter.SelectedIndex = oSettings.GetNumericSetting("USER.SCRIPTS.PDF_Assistant.EditionAfter", 1); } //Project in Folder if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder")) { chkIstInProjectFolder.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", 1); } if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName")) { txtProjectSavedInFolder.Text = oSettings.GetStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", 0); } }
public void Project_Close_Event() { //Einstellung einlesen Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose", 1); if (bChecked) //Bei ProjectClose ausführen { PDFAssistent_SollStarten(); } } return; }
public void Eplan_End_Event() { //Einstellung einlesen Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", 1); if (bChecked) //Bei EplanEnd To Run { PDFAssistent_SollStarten(); } } return; }
public void Eplan_End_Event() { //Read in setting Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", 1); if (bChecked) //Run at EplanEnd { PDFAssistant_SollStarten(); } } return; }
public void Project_Close_Event() { //Read in setting Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", 1); if (bChecked) //Run at ProjectClose { PDFAssistant_SollStarten(); } } return; }
public void ExcecutePDFonEplanEnd() { if (IsUserInGroup(domainName)) { //Einstellung einlesen Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd", 1); if (bChecked) //Bei EplanEnd ausführen { PDFAssistent_SollStarten(); } } return; } }
//Execute Assistant without dialog directly (execute without request) public void PDFAssistant_ausführen() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand", 1); if (bChecked) { cboEditionAfter.SelectedIndex = 0; ReadSettings(); PDFexport(txtLocation.Text + txtFilename.Text + @".pdf"); Close(); } else { PDFAssistant_Start(); } } }
//Assistent ohne Dialog direkt To Run (Ohne Nachfrage To Run) public void PDFAssistent_To Run() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage")) { bool bChecked = oSettings.GetBoolSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage", 1); if (bChecked) { cboAusgabeNach.SelectedIndex = 0; ReadSettings(); PDFexport(txtSpeicherort.Text + txtDateiname.Text + @".pdf"); Close(); } else { PDFAssistent_Start(); } } }
public void MacroFunction() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (oSettings.ExistSetting("USER.SCRIPTS.OpenProject.PathFolderMacro")) { openFileDialog1.InitialDirectory = oSettings.GetStringSetting("USER.SCRIPTS.OpenProject.PathFolderMacro", 0); } openFileDialog1.Filter = "Eplan Macro Project (*.elk)|*.elk|All files (*.*)|*.*"; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { OpenProject(openFileDialog1.FileName.ToString()); // Kommentar } return; }
/// <summary> /// Change first and second firm font type to selected /// </summary> /// <param name="font">Selected font type</param> private void ChangeFontType(string font) { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); oSettings.SetStringSetting("COMPANY.GedViewer.Fonts", font, 0); oSettings.SetStringSetting("COMPANY.GedViewer.Fonts", font, 1); /*try * { * // Action * string strAction = "compress"; * * // Export a project in pdf format * * ActionManager oAMnr = new ActionManager(); * Eplan.EplApi.ApplicationFramework.Action oAction = oAMnr.FindAction(strAction); * if (oAction != null) * { * // Action properties * ActionCallingContext ctx = new ActionCallingContext(); * * bool bRet = oAction.Execute(ctx); * if (bRet == false) * { * DoWireMarking.DoWireMarking.MassageHandler("Error in Action - gedRedraw"); * } * } * } * catch (Exception) * { * DoWireMarking.DoWireMarking.MassageHandler("Exception in Action - gedRedraw"); * } */ //DoWireMarking.DoWireMarking.MassageHandler($"Font { oSettings.GetStringSetting("COMPANY.GedViewer.Fonts", 0) }"); //oSettings.Dispose(); }
public void SetDefaultFolder() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (!oSettings.ExistSetting("USER.SCRIPTS.OpenProject.PathFolderProject")) { oSettings.AddStringSetting("USER.SCRIPTS.OpenProject.PathFolderProject", new string[] { }, new string[] { }, "test setting", new string[] { "Default value of test setting" }, ISettings.CreationFlag.Insert); } if (!oSettings.ExistSetting("USER.SCRIPTS.OpenProject.PathFolderMacro")) { oSettings.AddStringSetting("USER.SCRIPTS.OpenProject.PathFolderMacro", new string[] { }, new string[] { }, "test setting", new string[] { "Default value of test setting" }, ISettings.CreationFlag.Insert); } MessageBox.Show("You need to select your project base folder."); FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog(); if (folderBrowserDialog1.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog1.SelectedPath)) { oSettings.SetStringSetting("USER.SCRIPTS.OpenProject.PathFolderProject", folderBrowserDialog1.SelectedPath, 0); } //FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog (); if (folderBrowserDialog1.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog1.SelectedPath)) { oSettings.SetStringSetting("USER.SCRIPTS.OpenProject.PathFolderMacro", folderBrowserDialog1.SelectedPath, 0); } return; }
//Einstellungen speichern public void WriteSettings() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //Einstellungen speichern if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.SaveSettings")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.SaveSettings", new bool[] { false }, "SaveSettings Info", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.SaveSettings", chkEinstellungSpeichern.Checked, 1); //1 = Visible = True //Nur Speichern wenn erwünscht if (chkEinstellungSpeichern.Checked) { //PDF bei Projekt schließen if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose", new bool[] { false }, "Datumsstempel speichern", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByProjectClose", chkByProjectClose.Checked, 1); //1 = Visible = True //PDF bei Eplan beenden if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd", new bool[] { false }, "Datumsstempel speichern", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd", chkByEplanEnd.Checked, 1); //1 = Visible = True //Ausgabe Nach if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.AusgabeNach")) { oSettings.AddNumericSetting("USER.SCRIPTS.PDF_Assistent.AusgabeNach", new int[] { 0 }, new Range[] { new Range { FromValue = 0, ToValue = 32768 } }, "Default value of test setting", new int[] { 0 }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.PDF_Assistent.AusgabeNach", cboAusgabeNach.SelectedIndex, 1); //1 = Visible = True oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.ByEplanEnd", chkByEplanEnd.Checked, 1); //1 = Visible = True //Ausführen ohne Nachfrage if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage", new bool[] { false }, "Datumsstempel speichern", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.OhneNachfrage", chkOhneNachfrage.Checked, 1); //1 = Visible = True //Datumsstempel if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.DateStamp")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.DateStamp", new bool[] { false }, "Datumsstempel speichern", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.DateStamp", chkDatumStempel.Checked, 1); //1 = Visible = True //Zeitstempel if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.TimeStamp")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.TimeStamp", new bool[] { false }, "Zeitstempel speichern", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.TimeStamp", chkZeitStempel.Checked, 1); //1 = Visible = True //Projekt in Ordner if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdner")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdner", new bool[] { false }, "Projejt in Ordner speichern", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdner", chkIstInProjektOrdner.Checked, 1); //1 = Visible = True if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdnerName")) { oSettings.AddStringSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdnerName", new string[] { }, new string[] { }, "test setting", new string[] { "Default value of test setting" }, ISettings.CreationFlag.Insert); } oSettings.SetStringSetting("USER.SCRIPTS.PDF_Assistent.ProjectInOrdnerName", txtProjektGespeichertInOrdner.Text, 0); } }
//Ausgabe Nach hat sich geändert private void cboAusgabeNach_SelectedIndexChanged(object sender, EventArgs e) { #if !DEBUG string sProjectFolder = PathMap.SubstitutePath("$(PROJECTPATH)"); string sDateiName = PathMap.SubstitutePath("$(PROJECTNAME)"); #else string sProjectFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); string sDateiName = "TEST"; #endif string sAusgabeFolder = sProjectFolder; switch (cboAusgabeNach.SelectedIndex) { case 0: //in den Project-Folder sAusgabeFolder = sProjectFolder; break; case 1: //Ausgabeverzeichnis aus Einstellungen: PDF-Export #if !DEBUG Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); string sLastSchema = string.Empty; if (oSettings.ExistSetting("USER.PDFExportGUI.SCHEMAS.LastUsed")) { sLastSchema = oSettings.GetStringSetting("USER.PDFExportGUI.SCHEMAS.LastUsed", 0); } if (oSettings.ExistSetting("USER.PDFExportGUI.SCHEMAS.Steinert.Data.TargetPath")) { sAusgabeFolder = oSettings.GetStringSetting("USER.PDFExportGUI.SCHEMAS." + sLastSchema + ".Data.TargetPath", 0); } #endif break; case 2: //in den Folder eine Ebene über dem Project-Folder sAusgabeFolder = sProjectFolder.Substring(0, sProjectFolder.LastIndexOf(@"\")); break; case 3: //in Folder "Eigene Dateien" sAusgabeFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); break; case 4: //auf den Desktop sAusgabeFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); break; case 5: //gleicher Pfad wie Project nur auf anderes Laufwerk sAusgabeFolder = sProjectFolder.Substring(0, sProjectFolder.LastIndexOf(@"\")); //in den Folder eine Ebene über dem Project-Folder sAusgabeFolder = sAusgabeFolder.Replace("C:", "D:"); //Hier anpassen, welche Laufwerksbuchstaben verwendet werden. break; default: MessageBox.Show("Auswahl:default"); break; } //DateStamp hinzufügen if (chkDatumStempel.Checked) { sDateiName += "_" + DateTime.Now.ToString("yyyyMMdd"); } //TimeStamp hinzufügen if (chkTimeStamp.Checked) { sDateiName += "-" + DateTime.Now.ToString("HHmmss");; } //Endet mit \ ? if (!sAusgabeFolder.EndsWith(@"\")) { sAusgabeFolder += @"\"; } txtDateiname.Text = sDateiName; txtSpeicherort.Text = sAusgabeFolder; }
//Settings Save public void WriteSettings() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //Settings Save if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings", new bool[] { false }, "SaveSettings Info", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings", chkSaveSettings.Checked, 1); //1 = Visible = True //Only save if desired if (chkSaveSettings.Checked) { //Close PDF on Project if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", new bool[] { false }, "Dates stamp Save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", chkByProjectClose.Checked, 1); //1 = Visible = True //Exit PDF at Eplan if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", new bool[] { false }, "Dates stamp Save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", chkByEplanEnd.Checked, 1); //1 = Visible = True //Issue after if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.EditionAfter")) { oSettings.AddNumericSetting("USER.SCRIPTS.PDF_Assistant.EditionAfter", new int[] { 0 }, new Range[] { new Range { FromValue = 0, ToValue = 32768 } }, "Default value of test setting", new int[] { 0 }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.PDF_Assistant.EditionAfter", cboEditionAfter.SelectedIndex, 1); //1 = Visible = True oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", chkByEplanEnd.Checked, 1); //1 = Visible = True //Run without demand if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand", new bool[] { false }, "Dates stamp Save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.WithoutDemand", chkWithoutDemand.Checked, 1); //1 = Visible = True //Dates stamp if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.DateStamp")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.DateStamp", new bool[] { false }, "Dates stamp Save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.DateStamp", chkDateStamp.Checked, 1); //1 = Visible = True //TimeStamp if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp", new bool[] { false }, "TimeStamp Save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp", chkTimeStamp.Checked, 1); //1 = Visible = True //Project in Folder if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", new bool[] { false }, "Project in Folder Save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", chkIstInProjectFolder.Checked, 1); //1 = Visible = True if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName")) { oSettings.AddStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", new string[] { }, new string[] { }, "test setting", new string[] { "Default value of test setting" }, ISettings.CreationFlag.Insert); } oSettings.SetStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", txtProjectSavedInFolder.Text, 0); } }
//Issue after has changed private void cboEditionAfter_SelectedIndexChanged(object sender, EventArgs e) { #if !DEBUG string sProjectFolder = PathMap.SubstitutePath("$(PROJECTPATH)"); string sFilename = PathMap.SubstitutePath("$(PROJECTNAME)"); #else string sProjectFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); string sFilename = "TEST"; #endif string sAusgabeFolder = sProjectFolder; switch (cboEditionAfter.SelectedIndex) { case 0: //In the Project-Folder sAusgabeFolder = sProjectFolder; break; case 1: //Output directory of Settings: PDF-Export #if !DEBUG Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); string sLastSchema = string.Empty; if (oSettings.ExistSetting("USER.PDFExportGUI.SCHEMAS.LastUsed")) { sLastSchema = oSettings.GetStringSetting("USER.PDFExportGUI.SCHEMAS.LastUsed", 0); } if (oSettings.ExistSetting("USER.PDFExportGUI.SCHEMAS.Steinert.Data.TargetPath")) { sAusgabeFolder = oSettings.GetStringSetting("USER.PDFExportGUI.SCHEMAS." + sLastSchema + ".Data.TargetPath", 0); } #endif break; case 2: //In the Folder A level about that Project-Folder sAusgabeFolder = sProjectFolder.Substring(0, sProjectFolder.LastIndexOf(@"\")); break; case 3: //in Folder "Own Files" sAusgabeFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); break; case 4: //on the Desktop sAusgabeFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); break; case 5: //save Path as Project only on another drive sAusgabeFolder = sProjectFolder.Substring(0, sProjectFolder.LastIndexOf(@"\")); //In the Folder A level about that Project-Folder sAusgabeFolder = sAusgabeFolder.Replace("C:", "D:"); //Adjust here which drive letters are used. break; default: MessageBox.Show("Selection:default"); break; } //Add dates stamp if (chkDateStamp.Checked) { sFilename += "_" + DateTime.Now.ToString("yyyyMMdd"); } //Add TimeStamp if (chkTimeStamp.Checked) { sFilename += "-" + DateTime.Now.ToString("HHmmss");; } //Ends with \ ? if (!sAusgabeFolder.EndsWith(@"\")) { sAusgabeFolder += @"\"; } txtFilename.Text = sFilename; txtLocation.Text = sAusgabeFolder; }
//Form_Load private void frmDocumentationTool_Load(object sender, System.EventArgs e) { //Position und Größe aus Settings lesen #if !DEBUG Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top")) { this.Top = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top", 0); } if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left")) { this.Left = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left", 0); } if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height")) { this.Height = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height", 0); } if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width")) { this.Width = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width", 0); } if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis")) { this.toolStripMenuHerstellerVerzeichnis.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis", 0); } if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis")) { this.toolStripMenuArtikelnummerVerzeichnis.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis", 0); } #endif //Titelzeile anpassen string sProjekt = string.Empty; #if DEBUG sProjekt = "DEBUG"; #else CommandLineInterpreter cmdLineItp = new CommandLineInterpreter(); ActionCallingContext ProjektContext = new ActionCallingContext(); ProjektContext.AddParameter("TYPE", "PROJECT"); cmdLineItp.Execute("selectionset", ProjektContext); ProjektContext.GetParameter("PROJECT", ref sProjekt); sProjekt = Path.GetFileNameWithoutExtension(sProjekt); //Projektname Pfad und ohne .elk if (sProjekt == string.Empty) { Decider eDecision = new Decider(); EnumDecisionReturn eAnswer = eDecision.Decide(EnumDecisionType.eOkDecision, "Es ist kein Projekt ausgewählt.", "Documentation-Tool", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK); if (eAnswer == EnumDecisionReturn.eOK) { Close(); return; } } #endif Text = Text + " - " + sProjekt; //Button Extras Text festlegen //btnExtras.Text = " Extras ▾"; // ▾ ▼ //Zielverzeichnis vorbelegen #if DEBUG txtZielverzeichnis.Text = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\Test"; #else txtZielverzeichnis.Text = PathMap.SubstitutePath(@"$(DOC)"); #endif // Temporären Dateinamen festlegen #if DEBUG string sTempFile = Path.Combine(Application.StartupPath, "tmp_Projekt_Export.epj"); #else string sTempFile = Path.Combine(PathMap.SubstitutePath(@"$(TMP)"), "tmpDocumentationTool.epj"); #endif //Projekt exportieren #if !DEBUG PXFexport(sTempFile); #endif //PXF Datei einlesen und in Listview schreiben PXFeinlesen(sTempFile); //PXF Datei wieder löschen #if !DEBUG File.Delete(sTempFile); #endif }
//Save settings public void WriteSettings() { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); //Save settings if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings", new bool[] { false }, "SaveSettings Info", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.SaveSettings", chkSaveSettings.Checked, 1); //1 = Visible = True //Save only if desired if (chkSaveSettings.Checked) { //Close PDF on project if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", new bool[] { false }, "Save date stamp", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByProjectClose", chkByProjectClose.Checked, 1); //1 = Visible = True //Exit PDF at Eplan if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", new bool[] { false }, "Save date stamp", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", chkByEplanEnd.Checked, 1); //1 = Visible = True //Edition after if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.AusgabeNach")) { oSettings.AddNumericSetting("USER.SCRIPTS.PDF_Assistant.AusgabeNach", new int[] { 0 }, new Range[] { new Range { FromValue = 0, ToValue = 32768 } }, "Default value of test setting", new int[] { 0 }, ISettings.CreationFlag.Insert); } oSettings.SetNumericSetting("USER.SCRIPTS.PDF_Assistant.AusgabeNach", cboAusgabeNach.SelectedIndex, 1); //1 = Visible = True oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ByEplanEnd", chkByEplanEnd.Checked, 1); //1 = Visible = True //To run without demand if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage", new bool[] { false }, "Save date stamp", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.OhneNachfrage", chkOhneNachfrage.Checked, 1); //1 = Visible = True //DateStamp if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.DateStamp")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.DateStamp", new bool[] { false }, "Save date stamp", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.DateStamp", chkDatumStempel.Checked, 1); //1 = Visible = True //TimeStamp if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp", new bool[] { false }, "TimeStamp ToSave", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.TimeStamp", chkTimeStamp.Checked, 1); //1 = Visible = True //Project in Folder if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder")) { oSettings.AddBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", new bool[] { false }, "Project in folder to save", new bool[] { false }, ISettings.CreationFlag.Insert); } oSettings.SetBoolSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolder", chkIstInProjectFolder.Checked, 1); //1 = Visible = True if (!oSettings.ExistSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName")) { oSettings.AddStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", new string[] { }, new string[] { }, "test setting", new string[] { "Default value of test setting" }, ISettings.CreationFlag.Insert); } oSettings.SetStringSetting("USER.SCRIPTS.PDF_Assistant.ProjectInFolderName", txtProjectFiledInFolder.Text, 0); } }