private void SettingsGet() { if (!oSettings.ExistSetting(SettingPathWindowLocation)) // Create setting { oSettings.AddStringSetting( SettingPathWindowLocation, new string[] {}, new string[] {}, "Location of the form", new string[] {}, ISettings.CreationFlag.Insert ); } else // Get setting { try { this.Location = new Point( Convert.ToInt32(oSettings.GetStringSetting(SettingPathWindowLocation, 0)), Convert.ToInt32(oSettings.GetStringSetting(SettingPathWindowLocation, 1)) ); Refresh(); } catch (System.Exception ex) { //MessageBox.Show(ex.Message); } } }
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(); } } }
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); }
//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(); } } }
//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); } }
//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); } }
//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); } }
private void frmSetSettingExamplePath_Load(object sender, System.EventArgs e) { // Check if setting exists if (!oSettings.ExistSetting(SettingPath)) { // Add setting oSettings.AddStringSetting( SettingPath, new string[] {}, new string[] {}, "FolderBrowseDialog Path", new string[] { @"Default value of test setting" }, ISettings.CreationFlag.Insert ); // Add setting value oSettings.SetStringSetting(SettingPath, Environment.GetFolderPath(Environment.SpecialFolder.Desktop), 0); txtPath.Text = oSettings.GetStringSetting(SettingPath, 0); } else { // Load values txtPath.Text = oSettings.GetStringSetting(SettingPath, 0); } }
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; }
//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; }
//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; }