public bool Execute(ActionCallingContext actionCallingContext)
        {
            // Sent events to WPF control from base action
            string itemType = string.Empty;
            string action   = string.Empty;
            string key      = string.Empty;

            actionCallingContext.GetParameter("itemtype", ref itemType);
            actionCallingContext.GetParameter("action", ref action);
            actionCallingContext.GetParameter("key", ref key);

            WPFDialogEventManager wpfDialogEventManager = new WPFDialogEventManager();

            switch (action)
            {
            case "SelectItem":
            case "SaveItem":
            case "PreShowTab":
            case "OpenDatabase":
            case "CreateDatabase":
                wpfDialogEventManager.send("XPartsManagementDialog", action, key);
                break;
            }

            return(true);
        }
Exemplo n.º 2
0
    private void SetLanguageGui_Load(object sender, System.EventArgs e)
    {
        string ActionReturnParameterValue = string.Empty;

        // Languagelist
        oCLI.Execute("GetProjectLanguages", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string[] ProjectLanguages = ActionReturnParameterValue.Split(';');

        // VariableLanguage
        oCLI.Execute("GetVariableLanguage", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string VariableLanguage = ActionReturnParameterValue;

        // Add languages
        foreach (string CurrentLanguage in ProjectLanguages)
        {
            if (CurrentLanguage != "")
            {
                ListViewItem liviItem = new ListViewItem();

                // Check if current language
                if (CurrentLanguage.Equals(VariableLanguage))
                {
                    liviItem.Selected = true;
                }

                liviItem.Text = CurrentLanguage;

                // LanguageMapping
                foreach (string line in EplanLanguageList)
                {
                    if (line.StartsWith(CurrentLanguage))
                    {
                        if (line.Split(';').Length > 1)
                        {
                            liviItem.SubItems.Add(line.Split(';')[1]);
                        }
                    }
                }
                liviLanguages.Items.Add(liviItem);
            }
        }

        // Sort & resize
        liviLanguages.Sorting = SortOrder.Ascending;
        liviLanguages.Sort();
    }
Exemplo n.º 3
0
        // Поехали!!!
        public bool Execute(ActionCallingContext oActionCallingContext)
        {
            string objectNames = "";

            oActionCallingContext.GetParameter("objects", ref objectNames);
            // Получим объект текущей строки. Конечно, объектов может быт несколько, но не в этом отчете...
            StorableObject cable = StorableObject.FromStringIdentifier(objectNames);
            // Получим свойство 20237 "Топология: Трасса маршрутизации"
            string sCABLING_PATH = cable.Properties[20237];

            MatchCollection matches      = regex.Matches(sCABLING_PATH);
            String          filteredPath = "";

            var enumerator = matches.GetEnumerator();

            if (enumerator.MoveNext())
            {
                filteredPath = ((Match)enumerator.Current).Value;
                while (enumerator.MoveNext())
                {
                    filteredPath += ";" + (Match)enumerator.Current;
                }
            }

            string[] strings = new string[1];
            strings[0] = filteredPath;
            oActionCallingContext.SetStrings(strings);
            return(true);
        }
        public bool Execute(ActionCallingContext oActionCallingContext)
        {
            String recordName = null;

            oActionCallingContext.GetParameter("recordname", ref recordName);

            SelectionSet selectionSet = new SelectionSet();
            Project      oProject     = selectionSet.GetCurrentProject(true);

            oProject.LockObject();
            List <PlaceHolder> pList = new List <PlaceHolder>();



            foreach (Page page in oProject.Pages)
            {
                foreach (Placement gp in page.AllPlacements)
                {
                    if (gp is PlaceHolder)
                    {
                        pList.Add((PlaceHolder)gp);
                    }
                }
            }
            //System.Windows.Forms.MessageBox.Show(pList.Count.ToString());
            foreach (PlaceHolder plh in pList)
            {
                if (plh.GetRecordNames().Contains(recordName))
                {
                    plh.Remove();
                }
            }
            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        ///This function is called when executing the action.
        /// </summary>
        ///<returns>true, if the action performed successfully</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            string pVal = "no";

            ctx.GetParameter("loadFromLua", ref pVal);
            bool loadFromLua = true;

            if (pVal == "no")
            {
                loadFromLua = false;
            }

            string errStr;

            string projectName = EProjectManager.GetInstance()
                                 .GetCurrentProjectName();

            EProjectManager.GetInstance().CheckProjectName(ref projectName);

            int res = ProjectManager.GetInstance().LoadDescription(out errStr,
                                                                   projectName, loadFromLua);

            if (res > 0)
            {
                MessageBox.Show(errStr, "EPlaner", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }


            return(true);
        }
    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 PrintPagesVoid()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();

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

        Progress oProgress = new Progress("SimpleProgress");
        oProgress.SetAllowCancel(true);
        oProgress.SetAskOnCancel(true);
        oProgress.SetNeededSteps(3);
        oProgress.SetTitle("Drucken");
        oProgress.ShowImmediately();

        foreach (string Page in strPages.Split(';'))
        {
            if (!oProgress.Canceled())
            {
                acc.AddParameter("PAGENAME", Page);
                oCLI.Execute("print", acc);
            }
            else
            {
                break;
            }
        }
        oProgress.EndPart(true);

        return;
    }
    public void Function()
    {
        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;
    }
Exemplo n.º 9
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);
        }
    public void MultilanguageToolExamples_Get_Void()
    {
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        ActionCallingContext acc = new ActionCallingContext();
        string ActionReturnParameterValue = string.Empty;
        string strMessage = string.Empty;

        #region GetProjectLanguages
        oCLI.Execute("GetProjectLanguages", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string[] ProjectLanguages = ActionReturnParameterValue.Split(';');

        foreach (string s in ProjectLanguages)
        {
            strMessage = strMessage + s + "\n";
        }
        MessageBox.Show(strMessage, "GetProjectLanguages");
        strMessage = string.Empty;
        #endregion

        #region GetDisplayLanguages
        oCLI.Execute("GetDisplayLanguages", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string[] DisplayLanguages = ActionReturnParameterValue.Split(';');

        foreach(string s in DisplayLanguages)
        {
            strMessage = strMessage + s + "\n";
        }
        MessageBox.Show(strMessage, "GetDisplayLanguages");
        strMessage = string.Empty;
        #endregion

        #region GetVariableLanguage
        oCLI.Execute("GetVariableLanguage", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string VariableLanguage = ActionReturnParameterValue;
        strMessage = strMessage + VariableLanguage + "\n";
        MessageBox.Show(strMessage, "GetVariableLanguage");
        strMessage = string.Empty;
        #endregion
    }
Exemplo n.º 11
0
    public void MultilanguageToolExamples_Get_Void()
    {
        CommandLineInterpreter oCLI       = new CommandLineInterpreter();
        ActionCallingContext   acc        = new ActionCallingContext();
        string ActionReturnParameterValue = string.Empty;
        string strMessage = string.Empty;

        #region GetProjectLanguages
        oCLI.Execute("GetProjectLanguages", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string[] ProjectLanguages = ActionReturnParameterValue.Split(';');

        foreach (string s in ProjectLanguages)
        {
            strMessage = strMessage + s + "\n";
        }
        MessageBox.Show(strMessage, "GetProjectLanguages");
        strMessage = string.Empty;
        #endregion

        #region GetDisplayLanguages
        oCLI.Execute("GetDisplayLanguages", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string[] DisplayLanguages = ActionReturnParameterValue.Split(';');

        foreach (string s in DisplayLanguages)
        {
            strMessage = strMessage + s + "\n";
        }
        MessageBox.Show(strMessage, "GetDisplayLanguages");
        strMessage = string.Empty;
        #endregion

        #region GetVariableLanguage
        oCLI.Execute("GetVariableLanguage", acc);
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);
        string VariableLanguage = ActionReturnParameterValue;
        strMessage = strMessage + VariableLanguage + "\n";
        MessageBox.Show(strMessage, "GetVariableLanguage");
        strMessage = string.Empty;
        #endregion
    }
Exemplo n.º 12
0
        /// <summary>
        /// Execution of the Action.
        /// </summary>
        /// <returns>True:  Execution of the Action was successful</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            string param1 = null;

            ctx.GetParameter("Param1", ref param1);

            string param2 = null;

            ctx.GetParameter("Param2", ref param2);

            string param3 = null;

            ctx.GetParameter("Param3", ref param3);

            MessageDisplayHelper.Show(string.Format("ActionApiExtWithParameters{3}[Param1: {0}]{3}[Param2: {1}]{3}[Param3: {2}]{3}was called!", param1, param2, param3, Environment.NewLine), "ActionApiExtWithParameters");

            ctx.AddParameter("ReturnParam", "Action ReturnParam!!!");

            return(true);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Execution of the Action.
        /// </summary>
        /// <returns>True:  Execution of the Action was successful</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            string param1 = null;

            ctx.GetParameter("Param1", ref param1);

            string param2 = null;

            ctx.GetParameter("Param2", ref param2);

            string param3 = null;

            ctx.GetParameter("Param3", ref param3);

            MessageBox.Show(string.Format("ActionApiExtWithParameters\n[Param1: {0}], [Param2: {1}], [Param3: {2}]\nwas called!", param1, param2, param3));

            ctx.AddParameter("ReturnParam", "Action ReturnParam!!!");

            return(true);
        }
    private string GetProject()
    {
        // Rückgabe des Projektnammens mit Erweiterung
        string strProject = "";
        ActionCallingContext ProjectContext = new ActionCallingContext();

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

        new CommandLineInterpreter().Execute("selectionset", ProjectContext);
        ProjectContext.GetParameter("PROJECT", ref strProject);
        return(strProject);
    }
    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 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);
    }
        private static string FullProjectPath()
        {
            ActionCallingContext acc = new ActionCallingContext();

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

            string projectPath = string.Empty;

            new CommandLineInterpreter().Execute("selectionset", acc);
            acc.GetParameter("PROJECT", ref projectPath);

            return(projectPath);
        }
Exemplo n.º 19
0
    public void Function()
    {
        string value = string.Empty;

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

        actionCallingContext.AddParameter("name", "Neo");
        cli.Execute("ReturnAction", actionCallingContext);

        actionCallingContext.GetParameter("value", ref value);

        MessageBox.Show(value);
    }
Exemplo n.º 20
0
    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 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);
        }
    }
Exemplo n.º 22
0
    public void SelectProjectLanguage_Load(object sender, System.EventArgs e)
    {
        // Add all EPLAN languages
        AddLanguages();

        // Choose which language-type
        liviLanguages.SuspendLayout();
        string ActionReturnParameterValue = string.Empty;

        switch (this.Tag.ToString())
        {
        case "Project":
            oCLI.Execute("GetProjectLanguages", acc);
            break;

        case "Display":
            oCLI.Execute("GetDisplayLanguages", acc);
            break;

        default:
            this.Tag = "FALSE";
            this.Close();
            return;
        }
        acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue);

        // Add Languages
        string[] ProjectLanguages = ActionReturnParameterValue.Split(';');
        foreach (string language in ProjectLanguages)
        {
            foreach (string allLanguages in aryLanguages)
            {
                string[] liviValues = allLanguages.Split(';');
                if (liviValues[0].Equals(language))
                {
                    ListViewItem livi = new ListViewItem();
                    livi.Text = liviValues[0];
                    livi.SubItems.Add(liviValues[1]);
                    liviLanguages.Items.Add(livi);
                    break;
                }
            }
        }

        liviLanguages.Select();
        liviLanguages.Items[0].Selected = true;
        liviLanguages.ResumeLayout();
    }
Exemplo n.º 23
0
        /// <summary>
        /// Execution of the Action.
        /// </summary>
        /// <returns>True:  Execution of the Action was successful</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            string strParamValue = null;

            ctx.GetParameter("Param1", ref strParamValue);

            MessageDisplayHelper.Show(string.Format("Action was called, Param1=[{0}]", strParamValue), "FirstAction");

            // fill parameter "ReturnParam" with value "return value".
            // the caller of this action can extract the parameter by ctx.getParameter("ReturnParam", ...)

            string strReturnValue = "Return Value";

            ctx.AddParameter("ReturnParam", strReturnValue);

            return(true);
        }
Exemplo n.º 24
0
        /// <summary>
        ///This function is called when executing the action.
        /// </summary>
        ///<returns>true, if the action performed successfully</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            try
            {
                string pVal = "no";
                ctx.GetParameter("silentMode", ref pVal);
                bool silentMode = false;
                if (pVal == "yes")
                {
                    silentMode = true;
                }

                if (EProjectManager.GetInstance().GetCurrentPrj() == null)
                {
                    if (!silentMode)
                    {
                        MessageBox.Show("Нет открытого проекта!", "EPlaner",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    var currentThread = System.Threading.Thread.CurrentThread;
                    currentThread.CurrentCulture = StaticHelper.CommonConst
                                                   .CultureWithDotInsteadComma;

                    string projectName = EProjectManager.GetInstance()
                                         .GetCurrentProjectName();
                    EProjectManager.GetInstance()
                    .CheckProjectName(ref projectName);
                    string path = ProjectManager.GetInstance()
                                  .GetPtusaProjectsPath(projectName) + projectName;
                    ProjectManager.GetInstance().SaveAsLua(projectName, path,
                                                           silentMode);

                    SVGStatisticsSaver.Save(path);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(true);
        }
Exemplo n.º 25
0
        public static string GetText(string name, string parameter)
        {
            string value = null;
            ActionCallingContext actionCallingContext = new ActionCallingContext();

            actionCallingContext.AddParameter("name", name);
            actionCallingContext.AddParameter("parameter", parameter);
            new CommandLineInterpreter().Execute("ScriptSettings", actionCallingContext);
            actionCallingContext.GetParameter("setting", ref value);

            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }
            else
            {
                return(value);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Execution of the Action.
        /// </summary>
        /// <returns>True:  Execution of the Action was successful</returns>
        public bool Execute(ActionCallingContext ctx)
        {
            String strParamValue = null;

            ctx.GetParameter("Param1", ref strParamValue);

            // use string parameter ...
            // Add code
            System.Windows.Forms.MessageBox.Show("FirstAction was called!");


            // fill parameter "ReturnParam" with value "return value".
            // the caller of this action can extract the parameter by ctx.getParameter("ReturnParam", ...)
            String strReturnValue = "Return Value";

            ctx.AddParameter("ReturnParam", strReturnValue);

            return(true);
        }
Exemplo n.º 27
0
    public void Function()
    {
        CommandLineInterpreter cli = new CommandLineInterpreter();
        ActionCallingContext   acc = new ActionCallingContext();

        acc.AddParameter("TYPE", "PAGES");
        cli.Execute("selectionset", acc);

        string pagesString = string.Empty;

        acc.GetParameter("PAGES", ref pagesString);

        string[] pages      = pagesString.Split(';');
        int      pagesCount = pages.Length;

        MessageBox.Show("Anzahl markierter Seiten: " + pagesCount);

        return;
    }
Exemplo n.º 28
0
    public void MyFunctionAsAction()
    {
        Decider decider = new Decider();

        decider.Decide(EnumDecisionType.eOkDecision, "MyFunctionAsAction() was called!", "RegisterScriptMenu", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);

        String strAction = "FirstAction";

        ActionManager oAMnr = new ActionManager();

        Eplan.EplApi.ApplicationFramework.Action oAction = oAMnr.FindAction(strAction);

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

            String strParamValue = "Param1 Value";
            ctx.AddParameter("Param1", strParamValue);

            bool bRet = oAction.Execute(ctx);

            if (bRet)
            {
                String strReturnValue = null;
                ctx.GetParameter("ReturnParam", ref strReturnValue);

                decider.Decide(EnumDecisionType.eOkDecision, string.Format("The Action '{0}' ended successfully with Return Value = [{1}]", strAction, strReturnValue), "MyFunctionAsAction", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
            }
            else
            {
                decider.Decide(EnumDecisionType.eOkDecision, "The Action '" + strAction + "' ended with errors!", "MyFunctionAsAction", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
            }
        }
        else
        {
            decider.Decide(EnumDecisionType.eOkDecision, "The Action '" + strAction + "' not found!", "MyFunctionAsAction", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
        }

        decider.Dispose();
        decider = null;

        return;
    }
Exemplo n.º 29
0
    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 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;
    }
Exemplo n.º 31
0
    public void MyFunctionAsAction()
    {
        MessageBox.Show("MyFunctionAsAction() was called!", "RegisterScriptMenu");

        String strAction = "FirstAction";

        ActionManager oAMnr = new ActionManager();

        Eplan.EplApi.ApplicationFramework.Action oAction = oAMnr.FindAction(strAction);

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

            String strParamValue = "Param1 Value";
            ctx.AddParameter("Param1", strParamValue);

            bool bRet = oAction.Execute(ctx);

            if (bRet)
            {
                String strReturnValue = null;
                ctx.GetParameter("ReturnParam", ref strReturnValue);

                MessageBox.Show(string.Format("The Action {0} ended successfully with Return Value = [{1}]", strAction, strReturnValue), "MyFunctionAsAction");
            }
            else
            {
                MessageBox.Show("The Action " + strAction + " ended with errors!", "MyFunctionAsAction");
            }
        }
        else
        {
            MessageBox.Show("The Action " + strAction + " not found!", "MyFunctionAsAction");
        }

        return;
    }
Exemplo n.º 32
0
    public void FunctionCreatePDFAction()
    {
        string sProject = string.Empty;

        ActionCallingContext   oCTX1 = new ActionCallingContext();
        CommandLineInterpreter oCLI1 = new CommandLineInterpreter();

        oCTX1.AddParameter("TYPE", "PROJECT");
        oCLI1.Execute("selectionset", oCTX1);
        oCTX1.GetParameter("PROJECT", ref sProject);

        if (!string.IsNullOrEmpty(sProject))
        {
            MessageBoxShow(string.Format("Project [{0}] selected!", sProject), "CreatePDFAction");
            ExecutePDFExport(sProject);
        }
        else
        {
            MessageBoxShow("No project or several projects selected\nPlease select exactly one project!", "CreatePDFAction", EnumDecisionIcon.eEXCLAMATION);
        }

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

        string strPages = string.Empty;

        acc.AddParameter("TYPE", "PAGES");
        oCLI.Execute("selectionset", acc);
        acc.GetParameter("PAGES", ref strPages);

        Progress oProgress = new Progress("SimpleProgress");

        oProgress.SetAllowCancel(true);
        oProgress.SetAskOnCancel(true);
        oProgress.SetNeededSteps(3);
        oProgress.SetTitle("Drucken");
        oProgress.ShowImmediately();


        foreach (string Page in strPages.Split(';'))
        {
            if (!oProgress.Canceled())
            {
                acc.AddParameter("PAGENAME", Page);
                oCLI.Execute("print", acc);
            }
            else
            {
                break;
            }
        }
        oProgress.EndPart(true);

        return;
    }
    public bool MyMacroBoxName(string EXTENSION, string GETNAMEFROMLEVEL)
    {
        //parameter description:
        //----------------------
        //EXTENSION			...	macroname extionsion (e.g. '.ems')
        //GETNAMEFROMLEVEL	...	get macro name form level code (e.g. 1 = Funktionale Zuordnung, 2 = Anlage, 3 = Aufstellungsort, 4 = Einbauort, 5 = Dokumentenart, 6 = Benutzerdefiniert, P = Seitenname)
        try
        {
            string sPages = string.Empty;
            ActionCallingContext oCTX1 = new ActionCallingContext();
            CommandLineInterpreter oCLI1 = new CommandLineInterpreter();
            oCTX1.AddParameter("TYPE", "PAGES");
            oCLI1.Execute("selectionset", oCTX1);
            oCTX1.GetParameter("PAGES", ref sPages);
            string[] sarrPages = sPages.Split(';');

            if (sarrPages.Length > 1)
            {
                MessageBox.Show("Mehr als eine Seite markiert.\nAktion nicht möglich...", "Hinweis...");
                return false;
            }

            #region get macroname
            string sPageName = sarrPages[0];
            //ensure unique level codes:
            //Funktionale Zuordnung -> $
            //Aufstellungsort -> %
            sPageName = sPageName.Replace("==", "$").Replace("++", "%");
            //get location from pagename
            string sMacroBoxName = string.Empty;

            //add needed / wanted structures to macroname
            #region generate macroname
            string[] sNeededLevels = GETNAMEFROMLEVEL.Split('|');
            foreach (string sLevel in sNeededLevels)
            {
                switch (sLevel)
                {
                    case "1":
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName += ExtractLevelName(sPageName, "$");
                        }
                        else
                        {
                            sMacroBoxName += "\\" + ExtractLevelName(sPageName, "$");
                        }
                        break;
                    case "2":
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName += ExtractLevelName(sPageName, "=");
                        }
                        else
                        {
                            sMacroBoxName += "\\" + ExtractLevelName(sPageName, "=");
                        }
                        break;
                    case "3":
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "%");
                        }
                        else
                        {
                            sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "%");
                        }
                        break;
                    case "4":
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "+");
                        }
                        else
                        {
                            sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "+");
                        }
                        break;
                    case "5":
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "&");
                        }
                        else
                        {
                            sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "&");
                        }
                        break;
                    case "6":
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "#");
                        }
                        else
                        {
                            sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "#");
                        }
                        break;
                    case "P": //Seitenname
                        if (sMacroBoxName.EndsWith(@"\"))
                        {
                            sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "/");
                        }
                        else
                        {
                            sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "/");
                        }
                        break;
                    default:
                        break;
                }
            }
            #endregion

            //Clean-up macroname
            if (sMacroBoxName.EndsWith(@"\"))
            {
                sMacroBoxName = sMacroBoxName.Remove(sMacroBoxName.Length - 1, 1);
            }
            if (sMacroBoxName.StartsWith(@"\"))
            {
                sMacroBoxName = sMacroBoxName.Substring(1);
            }

            if (sMacroBoxName == string.Empty)
            {
                MessageBox.Show("Es konnte kein Makroname ermittelt werden...", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            sMacroBoxName = sMacroBoxName.Replace(".", @"\") + EXTENSION;
            #endregion

            //set macrobox: macroname
            string quote = "\"";
            CommandLineInterpreter oCLI2 = new CommandLineInterpreter();
            oCLI2.Execute("XEsSetPropertyAction /PropertyId:23001 /PropertyIndex:0 /PropertyValue:" + quote + sMacroBoxName + quote);

            return true;
        }
        catch (System.Exception ex)
        {
            MessageBox.Show(ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return false;
        }
    }
    //Form_Load
    private void frmDocumentationTool_Load(object sender, System.EventArgs e)
    {
        //Position und Größe aus Settings lesen
#if !DEBUG
        Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings();
        if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top"))
        {
            this.Top = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Top", 0);
        }
        if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left"))
        {
            this.Left = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Left", 0);
        }
        if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height"))
        {
            this.Height = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Height", 0);
        }
        if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width"))
        {
            this.Width = oSettings.GetNumericSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.Width", 0);
        }
        if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis"))
        {
            this.toolStripMenuHerstellerVerzeichnis.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuHerstellerVerzeichnis", 0);
        }
        if (oSettings.ExistSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis"))
        {
            this.toolStripMenuArtikelnummerVerzeichnis.Checked = oSettings.GetBoolSetting("USER.SCRIPTS.DOCUMENTATION_TOOL.toolStripMenuArtikelnummerVerzeichnis", 0);
        }
#endif

        //Titelzeile anpassen
        string sProjekt = string.Empty;
#if DEBUG
        sProjekt = "DEBUG";
#else
        CommandLineInterpreter cmdLineItp     = new CommandLineInterpreter();
        ActionCallingContext   ProjektContext = new ActionCallingContext();
        ProjektContext.AddParameter("TYPE", "PROJECT");
        cmdLineItp.Execute("selectionset", ProjektContext);
        ProjektContext.GetParameter("PROJECT", ref sProjekt);
        sProjekt = Path.GetFileNameWithoutExtension(sProjekt);         //Projektname Pfad und ohne .elk
        if (sProjekt == string.Empty)
        {
            Decider            eDecision = new Decider();
            EnumDecisionReturn eAnswer   = eDecision.Decide(EnumDecisionType.eOkDecision, "Es ist kein Projekt ausgewählt.", "Documentation-Tool", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
            if (eAnswer == EnumDecisionReturn.eOK)
            {
                Close();
                return;
            }
        }
#endif
        Text = Text + " - " + sProjekt;

        //Button Extras Text festlegen
        //btnExtras.Text = "            Extras           ▾"; // ▾ ▼

        //Zielverzeichnis vorbelegen
#if DEBUG
        txtZielverzeichnis.Text = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\Test";
#else
        txtZielverzeichnis.Text = PathMap.SubstitutePath(@"$(DOC)");
#endif

        // Temporären Dateinamen festlegen
#if DEBUG
        string sTempFile = Path.Combine(Application.StartupPath, "tmp_Projekt_Export.epj");
#else
        string sTempFile = Path.Combine(PathMap.SubstitutePath(@"$(TMP)"), "tmpDocumentationTool.epj");
#endif

        //Projekt exportieren
#if !DEBUG
        PXFexport(sTempFile);
#endif

        //PXF Datei einlesen und in Listview schreiben
        PXFeinlesen(sTempFile);

        //PXF Datei wieder löschen
#if !DEBUG
        File.Delete(sTempFile);
#endif
    }
Exemplo n.º 36
0
    public bool MyMacroBoxName(string EXTENSION, string GETNAMEFROMLEVEL)
    {
        //parameter description:
        //----------------------
        //EXTENSION			...	macroname extionsion (e.g. '.ems')
        //GETNAMEFROMLEVEL	...	get macro name form level code (e.g. 1 = Funktionale Zuordnung, 2 = Anlage, 3 = Aufstellungsort, 4 = Einbauort, 5 = Dokumentenart, 6 = Benutzerdefiniert, P = Seitenname)
        try
        {
            string sPages = string.Empty;
            ActionCallingContext   oCTX1 = new ActionCallingContext();
            CommandLineInterpreter oCLI1 = new CommandLineInterpreter();
            oCTX1.AddParameter("TYPE", "PAGES");
            oCLI1.Execute("selectionset", oCTX1);
            oCTX1.GetParameter("PAGES", ref sPages);
            string[] sarrPages = sPages.Split(';');

            if (sarrPages.Length > 1)
            {
                MessageBox.Show("Mehr als eine Seite markiert.\nAktion nicht möglich...", "Hinweis...");
                return(false);
            }

            #region get macroname
            string sPageName = sarrPages[0];
            //ensure unique level codes:
            //Funktionale Zuordnung -> $
            //Aufstellungsort -> %
            sPageName = sPageName.Replace("==", "$").Replace("++", "%");
            //get location from pagename
            string sMacroBoxName = string.Empty;

            //add needed / wanted structures to macroname
            #region generate macroname
            string[] sNeededLevels = GETNAMEFROMLEVEL.Split('|');
            foreach (string sLevel in sNeededLevels)
            {
                switch (sLevel)
                {
                case "1":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName += ExtractLevelName(sPageName, "$");
                    }
                    else
                    {
                        sMacroBoxName += "\\" + ExtractLevelName(sPageName, "$");
                    }
                    break;

                case "2":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName += ExtractLevelName(sPageName, "=");
                    }
                    else
                    {
                        sMacroBoxName += "\\" + ExtractLevelName(sPageName, "=");
                    }
                    break;

                case "3":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "%");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "%");
                    }
                    break;

                case "4":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "+");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "+");
                    }
                    break;

                case "5":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "&");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "&");
                    }
                    break;

                case "6":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "#");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "#");
                    }
                    break;

                case "P":                         //Seitenname
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "/");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "/");
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion

            //Clean-up macroname
            if (sMacroBoxName.EndsWith(@"\"))
            {
                sMacroBoxName = sMacroBoxName.Remove(sMacroBoxName.Length - 1, 1);
            }
            if (sMacroBoxName.StartsWith(@"\"))
            {
                sMacroBoxName = sMacroBoxName.Substring(1);
            }

            if (sMacroBoxName == string.Empty)
            {
                MessageBox.Show("Es konnte kein Makroname ermittelt werden...", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            sMacroBoxName = sMacroBoxName.Replace(".", @"\") + EXTENSION;
            #endregion

            //set macrobox: macroname
            string quote = "\"";
            CommandLineInterpreter oCLI2 = new CommandLineInterpreter();
            oCLI2.Execute("XEsSetPropertyAction /PropertyId:23001 /PropertyIndex:0 /PropertyValue:" + quote + sMacroBoxName + quote);

            return(true);
        }
        catch (System.Exception ex)
        {
            MessageBox.Show(ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(false);
        }
    }
    public bool MyMacroBoxName(string EXTENSION, string GETNAMEFROMLEVEL)
    {
        //parameter description:
        //----------------------
        //EXTENSION			...	macroname extionsion (e.g. '.ems')

        // GETNAMEFROMLEVEL ... get macro name form level code (eg 1 = Functional assignment, 2 = Attachment, 3 = Location, 4 = Location, 5 = Document type, 6 = User defined, P = Page name)
        try
        {
            string sPages = string.Empty;
            ActionCallingContext   oCTX1 = new ActionCallingContext();
            CommandLineInterpreter oCLI1 = new CommandLineInterpreter();
            oCTX1.AddParameter("TYPE", "PAGES");
            oCLI1.Execute("selectionset", oCTX1);
            oCTX1.GetParameter("PAGES", ref sPages);
            string[] sarrPages = sPages.Split(';');

            if (sarrPages.Length > 1)
            {
                MessageBox.Show("More than one page marked. \nAction not possible......", "Note...");
                return(false);
            }

            #region get macroname
            string sPageName = sarrPages[0];
            // ensure unique level codes:
            // Functional assignment -> $
            // Site ->%
            sPageName = sPageName.Replace("==", "$").Replace("++", "%");
            //get location from pagename
            string sMacroBoxName = string.Empty;

            //add needed / wanted structures to macroname
            #region generate macroname
            string[] sNeededLevels = GETNAMEFROMLEVEL.Split('|');
            foreach (string sLevel in sNeededLevels)
            {
                switch (sLevel)
                {
                case "1":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName += ExtractLevelName(sPageName, "$");
                    }
                    else
                    {
                        sMacroBoxName += "\\" + ExtractLevelName(sPageName, "$");
                    }
                    break;

                case "2":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName += ExtractLevelName(sPageName, "=");
                    }
                    else
                    {
                        sMacroBoxName += "\\" + ExtractLevelName(sPageName, "=");
                    }
                    break;

                case "3":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "%");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "%");
                    }
                    break;

                case "4":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "+");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "+");
                    }
                    break;

                case "5":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "&");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "&");
                    }
                    break;

                case "6":
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "#");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "#");
                    }
                    break;

                case "P":                         //Page name
                    if (sMacroBoxName.EndsWith(@"\"))
                    {
                        sMacroBoxName = sMacroBoxName + ExtractLevelName(sPageName, "/");
                    }
                    else
                    {
                        sMacroBoxName = sMacroBoxName + "\\" + ExtractLevelName(sPageName, "/");
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion

            //Clean-up macroname
            if (sMacroBoxName.EndsWith(@"\"))
            {
                sMacroBoxName = sMacroBoxName.Remove(sMacroBoxName.Length - 1, 1);
            }
            if (sMacroBoxName.StartsWith(@"\"))
            {
                sMacroBoxName = sMacroBoxName.Substring(1);
            }

            if (sMacroBoxName == string.Empty)
            {
                MessageBox.Show("No macro name could be determined...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            sMacroBoxName = sMacroBoxName.Replace(".", @"\") + EXTENSION;
            #endregion

            //set macrobox: macroname
            string quote = "\"";
            CommandLineInterpreter oCLI2 = new CommandLineInterpreter();
            oCLI2.Execute("XEsSetPropertyAction /PropertyId:23001 /PropertyIndex:0 /PropertyValue:" + quote + sMacroBoxName + quote);

            return(true);
        }
        catch (System.Exception ex)
        {
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(false);
        }
    }