//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;
    }
Exemplo n.º 2
0
    //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);
        }
    }
    //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);
        }
    }
//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);
        }
    }