Example #1
0
    private static bool ImportScheme(string schemeName, string SETTINGS_PATH, string sFilename)
    {
        /// <summary>
        /// Import eines Eplan Schemes
        /// </summary>
        /// <remarks>
        /// string schemeName Name des Schematas
        /// string SETTINGS_PATH = wenn unklar Daten aus XML lesen Beispiel für Beschriftung: "USER.Labelling.Config";
        /// string sFilname Verweis auf XML-Datei, Beispiel: @"$(MD_SCRIPTS)\Test\LB.Einbauorte.xml"
        /// </remarks>

        SchemeSetting schemeSetting = new SchemeSetting();

        schemeSetting.Init(SETTINGS_PATH);
        try
        {
            // prüfen ob die das Schema vorhanden ist, import wenn nicht da
            if (schemeSetting.CheckIfSchemeExists(schemeName) == false)
            {
                // testen ob es die XML Datei gibt
                if (FunctionCheckFileExist(sFilename))
                {
                    // import wenn Schema nicht in Eplan und XML-Datei existiert
                    schemeSetting.ImportSchemes(sFilename, false);
                    return(true);
                }
                else
                {
                    MessageBox.Show("XML-Datei fehlt: " + sFilename);
                    return(false);
                }
            }
            return(true);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
            return(false);
        }
    }
Example #2
0
        public bool Action(string actionNavigatorVisible)
        {
            // Objects
            var           commandLineInterpreter = new CommandLineInterpreter();
            SchemeSetting schemeSetting          = new SchemeSetting();
            Settings      settings   = new Settings();
            string        schemePath = "USER.WORKSPACE.NAMED";
            string        schemeName = "dummy";

            // SaveWorkspace
            commandLineInterpreter.Execute("SaveWorkspaceAction /Workspacename:dummy");

            // Parse parameter
            var splitGroups = actionNavigatorVisible.Split('|');

            foreach (var splitGroup in splitGroups)
            {
                // Get values
                var splitNavigators = splitGroup.Split(';');
                if (splitNavigators.Length != 2)
                {
                    MessageBox.Show("Invalid parameter", "ShowNavigators - Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }

                string navigatorName = splitNavigators[0];
                string visibleText   = splitNavigators[1].ToUpper();
                bool   visible       = visibleText == "TRUE" || visibleText == "1";

                // Settings path e.g.: USER.WORKSPACE.NAMED.dummy.Data.Visibility.XMacroPdd
                string settingsPath = schemePath + "." + schemeName + ".Data.Visibility." + navigatorName;

                // Hide & Seek :^)
                if (visible)
                {
                    // Show
                    if (!settings.ExistSetting(settingsPath))
                    {
                        commandLineInterpreter.Execute("GfDialogManagerShow /DialogName:" + navigatorName);
                    }
                }
                else
                {
                    // Hide
                    if (settings.ExistSetting(settingsPath))
                    {
                        commandLineInterpreter.Execute("GfDialogManagerHide /DialogName:" + navigatorName);
                    }
                }
            }

            // RemoveWorkspace
            schemeSetting.Init(schemePath);
            if (schemeSetting.CheckIfSchemeExists(schemeName))
            {
                schemeSetting.RemoveScheme(schemeName);
            }


            return(false);
        }