Example #1
0
        public void Action(string id, string index, out string value)
        {
            string pathTemplate = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
                                               "GetProjectProperty", "GetProjectProperty_Template.xml");
            string pathScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
                                             "GetProjectProperty", "GetProjectProperty_Scheme.xml");

            bool isUserDefinied = string.IsNullOrEmpty(index) || index.ToUpper().Equals("NULL");

            try
            {
                // Set scheme
                const string QUOTE   = "\"";
                string       content = File.ReadAllText(pathTemplate);

                if (isUserDefinied)
                {
                    string isSelectedPropertyUserDef =
                        @"<Setting name=" + QUOTE + "SelectedPropertyIdUserDef" + QUOTE + " type=" + QUOTE + "string" + QUOTE + ">" +
                        "<Val>" + id + "</Val>" +
                        "</Setting>";

                    content = content.Replace("GetProjectProperty_ID_SelectedPropertyId", "0");
                    content = content.Replace("IsSelectedPropertyIdUserDef", isSelectedPropertyUserDef);
                    content = content.Replace("GetProjectProperty_INDEX", "0");
                    content = content.Replace("GetProjectProperty_ID", id);
                }
                else
                {
                    content = content.Replace("GetProjectProperty_ID_SelectedPropertyId", id);
                    content = content.Replace("IsSelectedPropertyIdUserDef", "");
                    content = content.Replace("GetProjectProperty_INDEX", index);
                    content = content.Replace("GetProjectProperty_ID", id);
                }

                File.WriteAllText(pathScheme, content);

                new Settings().ReadSettings(pathScheme);

                string pathOutput = Path.Combine(
                    PathMap.SubstitutePath("$(MD_SCRIPTS)"), "GetProjectProperty",
                    "GetProjectProperty_Output.txt");

                // Export
                ActionCallingContext actionCallingContext = new ActionCallingContext();
                actionCallingContext.AddParameter("configscheme", "GetProjectProperty");
                actionCallingContext.AddParameter("destinationfile", pathOutput);
                actionCallingContext.AddParameter("language", "de_DE");
                new CommandLineInterpreter().Execute("label", actionCallingContext);

                // Read
                value = File.ReadAllLines(pathOutput)[0];
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "GetProjectProperty", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                value = "[Error]";
            }
        }
Example #2
0
        /// <summary>
        /// Execution of the Action.
        /// </summary>
        /// <returns>True:  Execution of the Action was successful</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            string strAction = "ActionApiExtWithParameters";

            ActionManager oAMnr   = new ActionManager();
            Action        oAction = oAMnr.FindAction(strAction);

            if (oAction != null)
            {
                ActionCallingContext callingCtx = new ActionCallingContext();

                callingCtx.AddParameter("Param1", "Action Param1");
                callingCtx.AddParameter("Param2", "Action Param2");
                callingCtx.AddParameter("Param3", "Action Param3");

                bool bRet = oAction.Execute(callingCtx);

                if (bRet)
                {
                    string returnValue = null;
                    callingCtx.GetParameter("ReturnParam", ref returnValue);
                    MessageBox.Show(string.Format("The Action [{0}] ended successfully with returnValue = [{1}]", strAction, returnValue));
                }
                else
                {
                    MessageBox.Show(string.Format("The Action [{0}] ended with errors!", strAction));
                }
            }

            return(true);
        }
Example #3
0
        public static void Execute(string xmlExportFileName)
        {
            // Scheme of marking export
            string config_scheme = "Маркировка проводов для Partex без обратного адреса XML";
            // Action
            string        strAction = "label";
            ActionManager oAMnr     = new ActionManager();
            Action        oAction   = oAMnr.FindAction(strAction);

            if (oAction != null)
            {
                // Action properties
                ActionCallingContext ctx = new ActionCallingContext();

                ctx.AddParameter("CONFIGSCHEME", config_scheme);
                ctx.AddParameter("LANGUAGE", "??_??");
                ctx.AddParameter("DESTINATIONFILE", @"$(TMP)\" + xmlExportFileName);

                bool bRet = oAction.Execute(ctx);
                if (bRet == false)
                {
                    DoWireMarking.DoWireMarking.MassageHandler(strAction);
                }
            }
            // Debug info
            Debug.WriteLine(@"-----------------");
            Debug.WriteLine(@"-------NEW-------");
            Debug.WriteLine(@"-----------------");
            Debug.WriteLine(@"$(TMP)\" + xmlExportFileName);
        }
Example #4
0
        /// <summary>
        /// Export to pdf with filter "Для печати" and scheme "SIA"
        /// </summary>
        private void ExportToPdf(string projectName)
        {
            // Scheme of marking export
            string exportType     = "PDFPROJECTSCHEME";
            string exportScheme   = "SIA";
            string exportFileName = $"d:\\Work\\PDF\\{ projectName }_{ DateTime.Now.Year }.{ DateTime.Now.Month }.{ DateTime.Now.Day }.pdf";
            // Action
            string strAction = "export";

            // 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();

                ctx.AddParameter("TYPE", exportType);
                ctx.AddParameter("EXPORTSCHEME", exportScheme);
                ctx.AddParameter("EXPORTFILE", exportFileName);
                // ctx.AddParameter("USEPAGEFILTER", "1");

                bool bRet = oAction.Execute(ctx);
                if (bRet == false)
                {
                    DoWireMarking.DoWireMarking.MassageHandler("Error in Action - ExportToPdf");
                }
            }
        }
Example #5
0
        /// <summary>
        /// Export to dwg with filter "Для печати" and scheme "SIA DWG"
        /// </summary>
        private void ExportToDwg()
        {
            // Scheme of marking export
            string exportType = "DWGPROJECT";
            //string exportScheme = "SIA";
            string exportPath = @"d:\Work\DWG\";
            // Action
            string strAction = "export";

            // Export a project in DXF / DWG format
            ActionManager oAMnr = new ActionManager();

            Eplan.EplApi.ApplicationFramework.Action oAction = oAMnr.FindAction(strAction);
            if (oAction != null)
            {
                // Action properties
                ActionCallingContext ctx = new ActionCallingContext();

                ctx.AddParameter("TYPE", exportType);
                // ctx.AddParameter("EXPORTSCHEME", exportScheme);
                ctx.AddParameter("DESTINATIONPATH", exportPath);
                //ctx.AddParameter("USEPAGEFILTER", "1");

                bool bRet = oAction.Execute(ctx);
                if (bRet == false)
                {
                    DoWireMarking.DoWireMarking.MassageHandler("Error in Action - ExportToDwg");

                    DoWireMarking.DoWireMarking.MassageHandler(ctx.ToString());
                    DoWireMarking.DoWireMarking.MassageHandler(ctx.GetParameters().ToString());
                    DoWireMarking.DoWireMarking.MassageHandler(ctx.GetStrings().ToString());
                }
            }
        }
Example #6
0
    public void Function()
    {
        string projectsPath = PathMap.SubstitutePath("$(MD_PROJECTS)");

        OpenFileDialog ofd = new OpenFileDialog();

        ofd.Filter           = "ProjectInfo.xml|ProjectInfo.xml";
        ofd.InitialDirectory = projectsPath;
        ofd.Title            = "Projekteigenschaften auswählen:";
        ofd.ValidateNames    = false;

        if (ofd.ShowDialog() == DialogResult.OK)
        {
            Progress progress = new Progress("SimpleProgress");
            progress.SetAllowCancel(false);
            progress.BeginPart(100, "");
            progress.SetTitle("Projekteigenschaften importieren");
            progress.ShowImmediately();

            CommandLineInterpreter cli = new CommandLineInterpreter();
            ActionCallingContext   acc = new ActionCallingContext();

            acc.AddParameter("TYPE", "READPROJECTINFO");
            acc.AddParameter("FILENAME", ofd.FileName);
            cli.Execute("projectmanagement", acc);

            progress.EndPart(true);

            cli.Execute("XPrjActionPropertiesEdit");
        }

        return;
    }
Example #7
0
    public void MyEventHandlerFunction(IEventParameter iEventParameter)
    {
        try
        {
            EventParameterString oEventParameterString = new EventParameterString(iEventParameter);
            string sProjectname = oEventParameterString.String;

            //Projekt Ordner ermitteln
            var    suffix         = ".elk";
            string sProjectFolder = sProjectname.Substring(0, sProjectname.Length - suffix.Length);
            sProjectFolder = sProjectFolder + ".edb";

            //Wenn Makroprojekt, dann abbrechen
            string sProjectart = string.Empty;
            GetProjectProperty(sProjectFolder, 10902, "de_DE", out sProjectart);
            if (sProjectart == "2")
            {
                return;
            }

            //Einstellungen durchgehen
            Settings oSettings = new Settings();
            for (int i = 1; i <= 5; i++)
            {
                if (i == 2)
                {
                    continue; // Projektgruppe 2 auslassen, da diese für Makroprojekte vorgesehen ist
                }
                string sProjectgroup = oSettings.GetStringSetting(SettingsPath, i);
                if (sProjectgroup == "frei")
                {
                    //Einstellung setzen
                    oSettings.SetStringSetting(SettingsPath, sProjectname, i);

                    //Projekteinstellung der Projektgruppe setzen
                    ActionCallingContext   acctranslate = new ActionCallingContext();
                    CommandLineInterpreter CLItranslate = new CommandLineInterpreter();
                    acctranslate.AddParameter("Project", sProjectname);
                    acctranslate.AddParameter("set", "SettingsMasterDialog.ProjectGroup.ColorMode");
                    acctranslate.AddParameter("value", i.ToString());
                    acctranslate.AddParameter("index", "0");
                    CLItranslate.Execute("XAfActionSettingProject", acctranslate);

                    //Schleife verlassen
                    break;
                }
            }
        }
        catch (InvalidCastException exc)
        {
            new Decider().Decide(EnumDecisionType.eOkDecision,
                                 exc.Message,
                                 "OnPostOpenProject, Fehler",
                                 EnumDecisionReturn.eOK,
                                 EnumDecisionReturn.eOK,
                                 string.Empty,
                                 false,
                                 EnumDecisionIcon.eFATALERROR);
        }
    }
    //Gesamtes Projekt als PXF ausgeben
    public void PXFexport(string sFilename)
    {
        //Progressbar ein
        Progress oProgress = new Progress("SimpleProgress");

        oProgress.SetTitle("Documentation-Tool");
        oProgress.SetActionText("Projektdaten exportieren");
        oProgress.ShowImmediately();
        Application.DoEvents();         // Screen aktualisieren

        ActionCallingContext pxfContext = new ActionCallingContext();

        pxfContext.AddParameter("TYPE", "PXFPROJECT");
        pxfContext.AddParameter("EXPORTFILE", sFilename);
        pxfContext.AddParameter("EXPORTMASTERDATA", "0");         //Stammdaten mit exportieren (Standard = 1(Ja)
        pxfContext.AddParameter("EXPORTCONNECTIONS", "0");        //Verbindungen mit exportieren (Standard = 0(Nein)

        CommandLineInterpreter cmdLineItp = new CommandLineInterpreter();

        cmdLineItp.Execute("export", pxfContext);

        //Progressbar aus
        oProgress.EndPart(true);

        return;
    }
Example #9
0
    private void ExecutePDFExport(string projectFullPath)
    {
        EnumDecisionReturn result = MessageBoxShow(EnumDecisionType.eYesNoDecision, string.Format("Do you want to create PDF for {0}?", projectFullPath), "PDF-Export", EnumDecisionReturn.eYES, EnumDecisionIcon.eQUESTION);

        if (result == EnumDecisionReturn.eYES)
        {
            Progress oProgress = new Progress("SimpleProgress");
            oProgress.SetAllowCancel(true);
            oProgress.SetAskOnCancel(true);
            oProgress.BeginPart(100, "");
            oProgress.ShowImmediately();

            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext   acc  = new ActionCallingContext();

            acc.AddParameter("TYPE", "PDFPROJECTSCHEME");
            acc.AddParameter("PROJECTNAME", projectFullPath);
            acc.AddParameter("EXPORTFILE", string.Format("{0}\\EPLANScript\\{1}_{2}.pdf", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), PathMap.SubstitutePath("$(PROJECTNAME)"), DateTime.Now.ToString("yyMMdd.HHmmssfff")));
            acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value");

            oCLI.Execute("export", acc);

            oProgress.EndPart(true);
        }

        return;
    }
    public void SetSortCodeAction()
    {
        //Use a Command Line Interpreter to call the Action
        CommandLineInterpreter CLI = new CommandLineInterpreter();

        Eplan.EplApi.Base.Settings set = new Eplan.EplApi.Base.Settings();
        if(!set.ExistSetting("USER.SCRIPTS.SORTCODE"))
        {
            bool bOk = set.AddNumericSetting("USER.SCRIPTS.SORTCODE",  new int[] { 0 },
                new Range[] { new Range { FromValue = 0, ToValue = 32768}}, "Sort code setting", new int[] { 0 },
                ISettings.CreationFlag.Insert);
        }

        int index = set.GetNumericSetting("USER.SCRIPTS.SORTCODE", 0);

        ActionCallingContext ctx1 = new ActionCallingContext();
        ctx1.AddParameter("propertyID","20809"); //Sort code
        ctx1.AddParameter("propertyIndex","0");
        ctx1.AddParameter("propertyValue", index.ToString());
        CLI.Execute("XEsSetPropertyAction", ctx1);

        set.SetNumericSetting("USER.SCRIPTS.SORTCODE", ++index, 0);

        return;
    }
        public void Action(string id, string index, out string value)
        {
            string pathTemplate = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
                                               "ScriptSettings", "Library", "GetProjectProperty", "GetProjectProperty_Template.xml");
            string pathScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
                                             "ScriptSettings", "Library", "GetProjectProperty", "GetProjectProperty_Scheme.xml");
            string pathOutput = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
                                             "ScriptSettings", "Library", "GetProjectProperty", "GetProjectProperty_Output.txt");

            try
            {
                // Set scheme
                string content = File.ReadAllText(pathTemplate);
                content = content.Replace("GetProjectProperty_ID", id);
                content = content.Replace("GetProjectProperty_INDEX", index);
                File.WriteAllText(pathScheme, content);
                new Settings().ReadSettings(pathScheme);

                // Export
                ActionCallingContext actionCallingContext = new ActionCallingContext();
                actionCallingContext.AddParameter("configscheme", "GetProjectProperty");
                actionCallingContext.AddParameter("destinationfile", pathOutput);
                actionCallingContext.AddParameter("language", "de_DE");
                new CommandLineInterpreter().Execute("label", actionCallingContext);

                // Read
                value = File.ReadAllLines(pathOutput)[0];
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "GetProjectProperty", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                value = "[Error]";
            }
        }
    //Gesamtes Project als PDF ausgeben
    public void PDFexport(string sZielDatei)
    {
        //Progressbar ein
        Eplan.EplApi.Base.Progress oProgress = new Eplan.EplApi.Base.Progress("SimpleProgress");
        oProgress.ShowImmediately();

        ActionCallingContext pdfContext = new ActionCallingContext();

        pdfContext.AddParameter("type", "PDFPROJECTSCHEME"); //PDFPROJECTSCHEME = Project im PDF-Format exportieren
        //pdfContext.AddParameter("exportscheme", "NAME_SCHEMA"); //verwendetes Schema
        pdfContext.AddParameter("exportfile", sZielDatei);   //Name export.Project, Vorgabewert: Projectname
        pdfContext.AddParameter("exportmodel", "0");         //0 = keine Modelle ausgeben
        pdfContext.AddParameter("blackwhite", "1");          //1 = PDF wird schwarz-weiss
        pdfContext.AddParameter("useprintmargins", "1");     //1 = Druckränder verwenden
        pdfContext.AddParameter("readonlyexport", "2");      //1 = PDF wird schreibgeschützt
        pdfContext.AddParameter("usesimplelink", "1");       //1 = einfache Sprungfunktion
        pdfContext.AddParameter("usezoomlevel", "1");        //Springen in Navigationsseiten
        pdfContext.AddParameter("fastwebview", "1");         //1 = schnelle Web-Anzeige
        pdfContext.AddParameter("zoomlevel", "1");           //wenn USEZOOMLEVEL auf 1 dann hier Zoomstufe in mm

        CommandLineInterpreter cmdLineItp = new CommandLineInterpreter();

        cmdLineItp.Execute("export", pdfContext);

        //'Progressbar aus
        oProgress.EndPart(true);

        return;
    }
Example #13
0
        public void SyncAndSave(bool saveDescrSilentMode = true)
        {
            if (currentProject != null && ProjectDataIsLoaded)
            {
                String        strAction = "LoadDescriptionAction";
                ActionManager oAMnr     = new ActionManager();
                Eplan.EplApi.ApplicationFramework.Action oAction =
                    oAMnr.FindAction(strAction);
                ActionCallingContext ctx = new ActionCallingContext();

                if (oAction != null)
                {
                    ctx.AddParameter("loadFromLua", "no");
                    oAction.Execute(ctx);
                }

                strAction = "SaveDescriptionAction";
                oAction   = oAMnr.FindAction(strAction);
                if (oAction != null)
                {
                    ctx.AddParameter("silentMode",
                                     saveDescrSilentMode ? "yes" : "no");
                    oAction.Execute(ctx);
                }
            }
        }
    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 static bool XEsSetPropertyAction(string propId, string index, string value)
        {
            ActionCallingContext XEsSetPropertyActionContext = new ActionCallingContext();

            XEsSetPropertyActionContext.AddParameter("PropertyId", propId);
            XEsSetPropertyActionContext.AddParameter("PropertyIndex", index);
            XEsSetPropertyActionContext.AddParameter("PropertyValue", value);
            return(new CommandLineInterpreter().Execute("XEsSetPropertyAction", XEsSetPropertyActionContext));
        }
Example #16
0
        public static void ImportPrjSettings(string projectname, string settingsFile)
        {
            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext   acc  = new ActionCallingContext();

            acc.AddParameter("XMLFile", settingsFile);
            acc.AddParameter("Project", projectname);
            oCLI.Execute("XSettingsImport", acc);
        }
        public static bool Edit(string page, string x, string y)
        {
            ActionCallingContext editContext = new ActionCallingContext();

            editContext.AddParameter("PAGENAME", page);
            editContext.AddParameter("X", x);
            editContext.AddParameter("Y", y);
            return(new CommandLineInterpreter().Execute("edit", editContext));
        }
        /// <summary>
        /// The action XAfActionSettingProject is only available in version 2.3 and higher
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="value"></param>
        private void SetProjectSetting(string setting, string value)
        {
            CommandLineInterpreter interpreter = new CommandLineInterpreter();
            ActionCallingContext   XAfActionSettingProjectContext = new ActionCallingContext();

            XAfActionSettingProjectContext.AddParameter("set", setting);
            XAfActionSettingProjectContext.AddParameter("value", value);
            interpreter.Execute("XAfActionSettingProject", XAfActionSettingProjectContext);
        }
Example #19
0
        /// <summary>
        /// Erstellt ein neues Projekt anhand einer Projekt-Exportdatei
        /// </summary>
        /// <param name="epjFilePath">Absoluter Dateipfad zur Exportdateil "C:\..\*.epj"</param>
        /// <param name="targetProject">Absoluter Dateipfad zum Zielprojekt "C:\..\*.elk"</param>
        public static void ImportProjectEPJ(string epjFilePath, string targetProject)
        {
            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext   acc  = new ActionCallingContext();

            acc.AddParameter("TYPE", "PXFPROJECT");
            acc.AddParameter("IMPORTFILE", epjFilePath);
            acc.AddParameter("PROJECTNAME", targetProject);
            oCLI.Execute("IMPORT", acc);
        }
Example #20
0
        private void InsertMacro(string macroFilePath)
        {
            ActionCallingContext XGedStartInteractionActionContext = new ActionCallingContext();

            XGedStartInteractionActionContext.AddParameter("Name", "XMIaInsertMacro");
            XGedStartInteractionActionContext.AddParameter("filename", macroFilePath);
            XGedStartInteractionActionContext.AddParameter("variant", "0");
            XGedStartInteractionActionContext.AddParameter("RepresentationType", "1");
            new CommandLineInterpreter().Execute("XGedStartInteractionAction", XGedStartInteractionActionContext);
        }
Example #21
0
        /// <summary>
        /// Calls the Eplan Interaction for placing macros
        /// </summary>
        /// <param name="macroFilePath">Absolute filepath with extension</param>
        /// <param name="repType">Representationtype of macro as enum or int</param>
        /// <param name="variant">Variant of macro as enum or int</param>
        private void InsertMacro(string macroFilePath, RepresentationType repType, Variant variant)
        {
            ActionCallingContext XGedStartInteractionActionContext = new ActionCallingContext();

            XGedStartInteractionActionContext.AddParameter("Name", "XMIaInsertMacro");
            XGedStartInteractionActionContext.AddParameter("filename", macroFilePath);
            XGedStartInteractionActionContext.AddParameter("variant", Convert.ToInt16(variant).ToString());
            XGedStartInteractionActionContext.AddParameter("RepresentationType", Convert.ToInt16(repType).ToString());
            new CommandLineInterpreter().Execute("XGedStartInteractionAction", XGedStartInteractionActionContext);
        }
        /// <summary>
        /// Sets the variant of the selected macrobox
        /// </summary>
        /// <param name="variant">0-15 = A-P</param>
        private void SetMacroboxVariant(int variant)
        {
            CommandLineInterpreter interpreter = new CommandLineInterpreter();
            ActionCallingContext   XEsSetPropertyActionContext = new ActionCallingContext();

            XEsSetPropertyActionContext.AddParameter("PropertyId", "23008");
            XEsSetPropertyActionContext.AddParameter("PropertyIndex", "0");
            XEsSetPropertyActionContext.AddParameter("PropertyValue", variant.ToString());
            interpreter.Execute("XEsSetPropertyAction", XEsSetPropertyActionContext);
        }
    public void XAfActionSettingProject_Start()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext   oACC = new ActionCallingContext();

        oACC.AddParameter("set", "TRANSLATEGUI.TRANSLATE_LANGUAGES");
        oACC.AddParameter("value", "de_DE;en_EN;zh_CN;");

        oCLI.Execute("XAfActionSettingProject", oACC);
        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(int SET)
    {
        try
        {
            string strScripts =
                PathMap.SubstitutePath("$(MD_SCRIPTS)" + @"\");
            string strProject = PathMap.SubstitutePath("$(P)");
            string strMessage = string.Empty;

            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext acc = new ActionCallingContext();
            acc.AddParameter("Project", strProject);

            switch (SET)
            {
                case 1:
                    strMessage = "[Wie gezeichnet]";
                    acc.AddParameter("XMLFile", strScripts + @"1.xml");
                    break;

                case 2:
                    strMessage = "[Als Punkt]";
                    acc.AddParameter("XMLFile", strScripts + @"2.xml");
                    break;

                case 3:
                    strMessage = "[Mit Zielfestlegung]";
                    acc.AddParameter("XMLFile", strScripts + @"3.xml");
                    break;

                default:
                    MessageBox.Show("Parameter nicht bekannt",
                        "Fehler", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
            }

            oCLI.Execute("XSettingsImport", acc);

            MessageBox.Show("Einstellungen wurden importiert.\n"
                + strMessage, "Information",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information);

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Fehler",
                MessageBoxButtons.OK,
                MessageBoxIcon.Error);
        }

        return;
    }
Example #26
0
        private string GetProjectPropertyAction(string id, string index)
        {
            string value = null;
            ActionCallingContext actionCallingContext = new ActionCallingContext();

            actionCallingContext.AddParameter("id", id);
            actionCallingContext.AddParameter("index", index);
            new CommandLineInterpreter().Execute("GetProjectProperty", actionCallingContext);
            actionCallingContext.GetParameter("value", ref value);
            return(value);
        }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext   acc  = new ActionCallingContext();

        acc.AddParameter("TYPE", "DXFPAGE");
        acc.AddParameter("IMPORTFILE", @"C:\DXF\Smile.dxf");

        oCLI.Execute("import", acc);

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("TYPE", "DXFPAGE");
        acc.AddParameter("IMPORTFILE", @"C:\DXF\Smile.dxf");

        oCLI.Execute("import", acc);

        return;
    }
    public void Function()
    {
        string projectPath = PathMap.SubstitutePath("$(PROJECTPATH)");

        Progress progress = new Progress("SimpleProgress");

        progress.SetAllowCancel(true);
        progress.SetAskOnCancel(false);
        progress.SetNeededSteps(3);
        progress.SetTitle("Beschriftung");
        progress.ShowImmediately();

        if (!progress.Canceled())
        {
            progress.BeginPart(50, "Artikelsummenstückliste wird erstellt...");

            string fileName = Path.Combine(projectPath, "Artikelsummenstückliste.xlsx");

            ActionCallingContext context1 = new ActionCallingContext();
            context1.AddParameter("configscheme", "Summarized parts list");
            context1.AddParameter("filterscheme", "");
            context1.AddParameter("sortscheme", "");
            context1.AddParameter("language", "de_DE");
            context1.AddParameter("destinationfile", fileName);
            context1.AddParameter("recrepeat", "1");
            context1.AddParameter("taskrepeat", "1");
            context1.AddParameter("showoutput", "1");
            context1.AddParameter("type", "PROJECT");
            new CommandLineInterpreter().Execute("label", context1);

            progress.EndPart();
        }

        if (!progress.Canceled())
        {
            progress.BeginPart(50, "Betriebsmittelbeschriftung wird erstellt...");

            string fileName = Path.Combine(projectPath, "Betriebsmittelliste.xlsx");

            ActionCallingContext context2 = new ActionCallingContext();
            context2.AddParameter("configscheme", "Device tag list");
            context2.AddParameter("filterscheme", "");
            context2.AddParameter("sortscheme", "");
            context2.AddParameter("language", "de_DE");
            context2.AddParameter("destinationfile", fileName);
            context2.AddParameter("recrepeat", "1");
            context2.AddParameter("taskrepeat", "1");
            context2.AddParameter("showoutput", "1");
            context2.AddParameter("type", "PROJECT");
            new CommandLineInterpreter().Execute("label", context2);

            progress.EndPart();
        }

        progress.EndPart(true);

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("Name", "XGedIaFormatText");
        acc.AddParameter("height", "20");

        oCLI.Execute("XGedStartInteractionAction", acc);

        return;
    }
Example #31
0
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext   acc  = new ActionCallingContext();

        acc.AddParameter("Name", "XGedIaFormatText");
        acc.AddParameter("height", "20");

        oCLI.Execute("XGedStartInteractionAction", acc);

        return;
    }
Example #32
0
    public void Function(int SET)
    {
        try
        {
            string strScripts =
                PathMap.SubstitutePath("$(MD_SCRIPTS)" + @"\");
            string strProject = PathMap.SubstitutePath("$(P)");
            string strMessage = string.Empty;

            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext   acc  = new ActionCallingContext();
            acc.AddParameter("Project", strProject);

            switch (SET)
            {
            case 1:
                strMessage = "[Wie gezeichnet]";
                acc.AddParameter("XMLFile", strScripts + @"1.xml");
                break;

            case 2:
                strMessage = "[Als Punkt]";
                acc.AddParameter("XMLFile", strScripts + @"2.xml");
                break;

            case 3:
                strMessage = "[Mit Zielfestlegung]";
                acc.AddParameter("XMLFile", strScripts + @"3.xml");
                break;

            default:
                MessageBox.Show("Parameter nicht bekannt",
                                "Fehler", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            oCLI.Execute("XSettingsImport", acc);

            MessageBox.Show("Einstellungen wurden importiert.\n"
                            + strMessage, "Information",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Fehler",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
        }

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext   acc  = new ActionCallingContext();

        acc.AddParameter("PAGENAME", "=+/1");
        acc.AddParameter("DEVICENAME", "=+-1K1");
        acc.AddParameter("FORMAT", "XDLTxtImporterExporter");

        oCLI.Execute("edit", acc);

        return;
    }
        private string ExportCurrentProject()
        {
            //TODO: Show progress
            string projectPath = PathMap.SubstitutePath("$(P)");
            string exportFile  = projectPath + "\\XML\\Export.epj";
            ActionCallingContext exportContext = new ActionCallingContext();

            exportContext.AddParameter("TYPE", "PXFPROJECT");
            exportContext.AddParameter("PROJECTNAME", projectPath);
            exportContext.AddParameter("EXPORTFILE", exportFile);
            new CommandLineInterpreter().Execute("export", exportContext);
            return(exportFile);
        }
    public void Execute()
    {
        CommandLineInterpreter oCLI       = new CommandLineInterpreter();
        ActionCallingContext   acc        = new ActionCallingContext();
        string ActionReturnParameterValue = string.Empty;

        acc.AddParameter("Language", "Project"); // parameters: "Project" or "Display"
        acc.AddParameter("DialogName", "MyDialogName");
        oCLI.Execute("SelectLanguage", acc);
        acc.GetParameter("Language", ref ActionReturnParameterValue);

        MessageBox.Show("Language from SelectLanguage:\n\n---> " + ActionReturnParameterValue);
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("PAGENAME", "=+/1");
        acc.AddParameter("DEVICENAME", "=+-1K1");
        acc.AddParameter("FORMAT", "XDLTxtImporterExporter");

        oCLI.Execute("edit", acc);

        return;
    }
    public void Execute()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();
        string ActionReturnParameterValue = string.Empty;

        acc.AddParameter("Language", "Project"); // parameters: "Project" or "Display"
        acc.AddParameter("DialogName", "MyDialogName");
        oCLI.Execute("SelectLanguage", acc);
        acc.GetParameter("Language", ref ActionReturnParameterValue);

        MessageBox.Show("Language from SelectLanguage:\n\n---> " + ActionReturnParameterValue);
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("CONFIGSCHEME", "Standard");
        acc.AddParameter("FILTERSCHEME", "Allpolig");

        oCLI.Execute("compress", acc);

        MessageBox.Show("Action ausgeführt.");

        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 PagePdfVoid()
    {
        FolderBrowserDialog fbd = new FolderBrowserDialog();
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        if (fbd.ShowDialog() != DialogResult.OK)
        {
            return;
        }

        Progress oProgress = new Progress("SimpleProgress");
        oProgress.SetAllowCancel(true);
        oProgress.SetAskOnCancel(true);
        oProgress.BeginPart(100, "");
        oProgress.ShowImmediately();

        try
        {
            string strPages = string.Empty;
            acc.AddParameter("TYPE", "PAGES");
            oCLI.Execute("selectionset", acc);
            acc.GetParameter("PAGES", ref strPages);

            foreach (string CurrentPage in strPages.Split(';'))
            {
                if (!oProgress.Canceled())
                {
                    acc.AddParameter("TYPE", "PDFPAGESSCHEME");
                    acc.AddParameter("PAGENAME", CurrentPage);
                    acc.AddParameter("EXPORTFILE", fbd.SelectedPath + @"\" + CurrentPage);
                    acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value");
                    oCLI.Execute("export", acc);
                }
                else
                {
                    oProgress.EndPart(true);
                    return;
                }
            }
            Process.Start(fbd.SelectedPath);
            oProgress.EndPart(true);
        }
        catch (System.Exception ex)
        {
            oProgress.EndPart(true);
            MessageBox.Show("Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("Project", @"C:\Projekte\Beispielprojekt.elk");
        acc.AddParameter("Action", "reports");
        acc.AddParameter("NOCLOSE", "1");

        oCLI.Execute("ProjectAction", acc);

        MessageBox.Show("Action ausgeführt.");

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("PropertyId", "10013");
        acc.AddParameter("PropertyIndex", "0");
        acc.AddParameter("PropertyValue", "23542");

        oCLI.Execute("XEsSetProjectPropertyAction", acc);

        MessageBox.Show("Action ausgeführt.");

        return;
    }
    public void Function()
    {
        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);

        string[] strPagesCount = strPages.Split(';');
        int intPagesCount = strPagesCount.Length;

        string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)");

        MessageBox.Show("Anzahl markierter Seiten:\n"
            + "►►► " + intPagesCount.ToString() + " ◄◄◄",
            "Markierte Seiten [" + strProjectname + "]",
            MessageBoxButtons.OK,
            MessageBoxIcon.Information);

        return;
    }
    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 Function()
    {
        string strProjectpath =
            PathMap.SubstitutePath("$(PROJECTPATH)") + @"\";

        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("TYPE", "EXPORT");
        acc.AddParameter("EXPORTFILE", strProjectpath + "Partlist.txt");
        acc.AddParameter("FORMAT", "XPalCSVConverter");

        oCLI.Execute("partslist", acc);

        MessageBox.Show("Action ausgeführt.");

        return;
    }
    public void InsertPageMacroVoid()
    {
        string strFilename = @"C:\test.emp";

        ActionCallingContext oAcc = new ActionCallingContext();
        CommandLineInterpreter oCLI = new CommandLineInterpreter();

        oAcc.AddParameter("filename", strFilename);
        oCLI.Execute("XMInsertPageMacro", oAcc);
    }
    public void Function()
    {
        string strFullProjectname =
        PathMap.SubstitutePath("$(P)");
        string strProjectpath =
            PathMap.SubstitutePath("$(PROJECTPATH)" + @"\");
        string strProjectname =
            PathMap.SubstitutePath("$(PROJECTNAME)");

        DialogResult Result = MessageBox.Show(
            "Soll ein PDF für das Projekt\n'"
            + strProjectname +
            "'\nerzeugt werden?",
            "PDF-Export",
            MessageBoxButtons.YesNo,
            MessageBoxIcon.Question
            );

        if (Result == DialogResult.Yes)
        {
            Progress oProgress = new Progress("SimpleProgress");
            oProgress.SetAllowCancel(true);
            oProgress.SetAskOnCancel(true);
            oProgress.BeginPart(100, "");
            oProgress.ShowImmediately();

            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext acc = new ActionCallingContext();

            acc.AddParameter("TYPE", "PDFPROJECTSCHEME");
            acc.AddParameter("PROJECTNAME", strFullProjectname);
            acc.AddParameter("EXPORTFILE",
                strProjectpath + strProjectname);
            acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value");

            oCLI.Execute("export", acc);

            oProgress.EndPart(true);
        }

        return;
    }
    public void MultilanguageToolExamples_Set_Void()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        oCLI.Execute("XTrSettingsDlgAction"); // Settings DEFAULT

        #region SetProjectLanguages
        acc.AddParameter("LANGUAGELIST", "de_DE;en_EN;zh_CN;");
        oCLI.Execute("SetProjectLanguages", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        #region ChangeLanguage
        acc.AddParameter("varLANGUAGE","en_EN");
        acc.AddParameter("dispLANGUAGE", "en_EN;zh_CN;");
        oCLI.Execute("ChangeLanguage", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion
    }
    public void ActionFunction()
    {
        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);

        acc.AddParameter("PAGENAME", strPages);

        oCLI.Execute("print", acc);

        //MessageBox.Show("Seite gedruckt");
        return;
    }
    public void Function()
    {
        string strFilename = string.Empty;

        strFilename = CheckFilename("Artikelsummenstückliste.xls");
        if (strFilename != "")
        {
            ActionCallingContext labellingContext =
                new ActionCallingContext();
            labellingContext.AddParameter("CONFIGSCHEME",
                "Summarized parts list");
            labellingContext.AddParameter("DESTINATIONFILE",
                strFilename);
            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);
        }

        strFilename = CheckFilename("Betriebsmittelbeschriftung.xls");
        if (strFilename != "")
        {
            ActionCallingContext labellingContext1 =
                new ActionCallingContext();
            labellingContext1.AddParameter("CONFIGSCHEME",
                "Device tag list");
            labellingContext1.AddParameter("DESTINATIONFILE",
                strFilename);
            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);
        }

        return;
    }
    public void MultilanguageToolExamples_Settings_Void()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        oCLI.Execute("XTrSettingsDlgAction"); // Settings DEFAULT

        // Bei Eingabe übersetzen
        #region SetTranslationOnInput
        acc.AddParameter("ACTIVE", "YES"); // parameters: YES, NO
        oCLI.Execute("SetTranslationOnInput", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        // Groß- / Kleinschreibung beachten
        #region SetMatchCase
        acc.AddParameter("ACTIVE", "YES"); // parameters: YES, NO
        oCLI.Execute("SetMatchCase", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        // Bereits übersetzte Texte verändern
        #region SetChangeTranslatedText
        acc.AddParameter("ACTIVE", "YES"); // parameters: YES, NO
        oCLI.Execute("SetChangeTranslatedText", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        // Manuelle Auswahl bei Mehrfachbedeutungen
        #region SetManualSelectionForMultipleMeanings
        acc.AddParameter("ACTIVE", "YES"); // parameters: YES, NO
        oCLI.Execute("SetManualSelectionForMultipleMeanings", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        // Segment
        #region SetTranslationSegment
        acc.AddParameter("SEGMENT", "ENTIRE ENTRY"); // parameters: WORD, SENTENCE, ENTIRE ENTRY
        oCLI.Execute("SetTranslationSegment", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        // Groß- / Kleinschreibung
        #region SetUpperLowerCase
        acc.AddParameter("TYPE", "ALLUPPERCASE"); // parameters: ACCORDINGTODICTIONARY, ALLUPPERCASE, ALLLOWERCASE, CAPITALIZEFIRSTLETTER
        oCLI.Execute("SetUpperLowerCase", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion

        // Fehlende Übersetzung: Anzeigen
        #region SetShowMissingTranslation
        acc.AddParameter("ACTIVE", "YES"); // parameters: YES, NO
        oCLI.Execute("SetShowMissingTranslation", acc);
        oCLI.Execute("XTrSettingsDlgAction");
        #endregion
    }
    private static void LabellingText(string filename)
    {
        ActionCallingContext acc = new ActionCallingContext();
        acc.AddParameter("CONFIGSCHEME",
            "Zuletzt verwendete EPLAN-Version_Textdatei");
        acc.AddParameter("DESTINATIONFILE", filename);
        acc.AddParameter("FILTERSCHEME", "");
        acc.AddParameter("LANGUAGE", "de_DE");
        acc.AddParameter("LogMsgActionDone", "true");
        acc.AddParameter("SHOWOUTPUT", "0");
        acc.AddParameter("RECREPEAT", "1");
        acc.AddParameter("SORTSCHEME", "");
        acc.AddParameter("TASKREPEAT", "1");
        new CommandLineInterpreter().Execute("label", acc);

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("ScriptFile",
            @"C:\EPLAN Scripting Project\01_Erste_Schritte\01_Start.cs");

        oCLI.Execute("ExecuteScript", acc);

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("TYPE", "CABLES");
        acc.AddParameter("CREATIONSCHEME", "Standard");
        acc.AddParameter("NUMBERINGSCHEME", "Standard");
        acc.AddParameter("AUTOSELECTSCHEME", "Standard");
        acc.AddParameter("REGENERATECONNS", "1");
        acc.AddParameter("KEEPOLDNAMES", "1");
        acc.AddParameter("STARTVALUE", "1");
        acc.AddParameter("STEPVALUE", "1");
        acc.AddParameter("ONLYAUTOCABLES", "1");
        acc.AddParameter("REBUILDALLCONNECTIONS", "1");

        oCLI.Execute("generate", acc);

        MessageBox.Show("Action ausgeführt.");

        return;
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("TYPE", "PROJECT");

        oCLI.Execute("print", acc);

        MessageBox.Show("Action ausgeführt.");

        return;
    }
    public void Function()
    {
        string strProjects =
            PathMap.SubstitutePath("$(MD_PROJECTS)");
        string strFilename = string.Empty;

        OpenFileDialog ofd = new OpenFileDialog();
        ofd.Filter = "ProjectInfo.xml|ProjectInfo.xml";
        ofd.InitialDirectory = strProjects;
        ofd.Title = "Projekteigenschaften auswählen:";
        ofd.ValidateNames = true;

        if (ofd.ShowDialog() == DialogResult.OK)
        {
            strFilename = ofd.FileName;

            Progress oProgress = new Progress("SimpleProgress");
            oProgress.SetAllowCancel(false);
            oProgress.BeginPart(100, "");
            oProgress.SetTitle("Projekteigenschaften importieren");
            oProgress.ShowImmediately();

            CommandLineInterpreter oCLI = new CommandLineInterpreter();
            ActionCallingContext cc = new ActionCallingContext();

            cc.AddParameter("TYPE", "READPROJECTINFO");
            cc.AddParameter("FILENAME", strFilename);
            oCLI.Execute("projectmanagement", cc);

            oProgress.EndPart(true);

            oCLI.Execute("XPrjActionPropertiesEdit");
        }

        return;
    }
    public void LoadScriptsProject()
    {
        string path = PathMap.SubstitutePath("$(MD_SCRIPTS)");
        string message = "";
        int i = 0;

        System.IO.FileInfo[] fi = new System.IO.DirectoryInfo(path).GetFiles("*.cs", SearchOption.AllDirectories);
        System.IO.FileInfo[] fi1 = new System.IO.DirectoryInfo(path).GetFiles("*.vb", SearchOption.AllDirectories);
        foreach(var fileInfo in fi)
        {
            CommandLineInterpreter oCLA = new CommandLineInterpreter();
            ActionCallingContext aca = new ActionCallingContext();
            aca.AddParameter("ScriptFile", fileInfo.FullName);
            oCLA.Execute("RegisterScript", aca);

            if (i > 0);
            {
            message += "\n";
            }
            message += fileInfo.Name;
            i++;
        }
        foreach(var fileInfo in fi1)
        {
            CommandLineInterpreter oCLA = new CommandLineInterpreter();
            ActionCallingContext aca = new ActionCallingContext();
            aca.AddParameter("ScriptFile", fileInfo.FullName);
            oCLA.Execute("RegisterScript", aca);

            if (i > 0);
            {
            message += "\n";
            }
            message += fileInfo.Name;
            i++;
        }
        MessageBox.Show("folgende Scripte wurden erfolgreich geladen:" + "\n" + message, "Geladene Scripte", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    public void Function()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

        acc.AddParameter("TYPE", "PROJECT");
        acc.AddParameter("ARCHIVENAME",
            @"C:\Projekte\Beispielprojekt.zw1");
        acc.AddParameter("PROJECTNAME",
            @"C:\Projekte\Beispielprojekt.elk");
        acc.AddParameter("UNPACKPROJECT", "0");
        acc.AddParameter("MODE", "1");
        acc.AddParameter("NOCLOSE", "1");

        oCLI.Execute("restore", acc);

        MessageBox.Show("Action ausgeführt.");

        return;
    }
    ////////////////////////////////////////////////////////////////////////
    // Button: OK
    ////////////////////////////////////////////////////////////////////////
    public void btn_OK(object sender, System.EventArgs e)
    {
        // Replace Variable
        if (File.Exists(sMacroOut))
        {
            string sReplace = "";
            StreamReader srReplace = new StreamReader(sMacroOut, System.Text.Encoding.Default);
            sReplace = srReplace.ReadToEnd();
            sReplace = sReplace.Replace(@"###V1###", txtV1.Text);
            sReplace = sReplace.Replace(@"###V2###", txtV2.Text);
            sReplace = sReplace.Replace(@"###V3###", txtV3.Text);
            sReplace = sReplace.Replace(@"###V4###", txtV4.Text);
            sReplace = sReplace.Replace(@"###V5###", txtV5.Text);
            srReplace.Close();
            StreamWriter swReplace = new StreamWriter(sTemp);
            swReplace.Write(sReplace);
            swReplace.Close();
        }
        else
        {
            MessageBox.Show("Datei nicht gefunden\n" + sMacroOut);
        }

        // Action
        ActionCallingContext cContext = new ActionCallingContext();
        cContext.AddParameter("Name", "XMIaInsertMacro");
        cContext.AddParameter("filename", sTemp);
        cContext.AddParameter("variant", sVariantOut);
        new CommandLineInterpreter().Execute("XGedStartInteractionAction", cContext);

        Close();
    }
    // Methode: Eplan Action: ProjectOpen
    private void Eplan_OpenProject(string FullProjectPath)
    {
        Cursor.Current = Cursors.WaitCursor;

        ActionCallingContext AccOpen = new ActionCallingContext();
        AccOpen.AddParameter("Project", FullProjectPath);
        new CommandLineInterpreter().Execute("ProjectOpen", AccOpen);

        Cursor.Current = Cursors.Default;
    }