[CONNECT .NET] MdlApplicationClass

The MicroStationAPI provides mdlSystem_getMdlAppClass/mdlSystem_setMdlAppClass that inform how the app was loaded (USER, DGNAPP, etc) in one of the MdlApplicationClass enum values.

I can't see a .NET equivalent in the MstnPlatformNET.

Parents
  • Hi Jon Summers,

    this information "might" be passed to an AddIn as shown in the code sample below. It is not well tested and probably not documented, so try it and let us know :-)

    Tom


    namespace Xyz
    {
        [Bentley.MstnPlatformNET.AddIn(MdlTaskID = "xyz")]
        internal sealed class App : Bentley.MstnPlatformNET.AddIn
        {
            private App(System.IntPtr mdlDesc) : base(mdlDesc)
            {}
    
            protected override int Run(string[] commandLine)
            {
                switch (commandLine[1])
                {
                    case "COMMANDREQUESTED":
                        // AddIn loaded by keyin from ribbon
                        break;
                        
                    case "USER":
                        // AddIn loaded from (start script) keyin; "mdl silentload xyz"
                        break;
                        
                    case "FIRSTDGNFILE":
                        // AddIn loaded as MS_DGNAPPS
                        break;
                        
                    default:
                        // there may be other
                        break;
                }
                return 0;
            }
        }
    }

  • commandLine[]

    this information "might" be passed to an AddIn

    When an AddIn is loaded, whatever the language used to create it, MicroStation passes at least two arguments that are received by the commandLine string array.

    The first argument (commandLine[0]) is the AddIn name.

    It is probably not documented

    The command-line argument values used to be documented, many years ago, in the days of MDL.  Like much of the infrastructure of MicroStation development, they have dropped out of the documentation.

    try it and let us know

    I have tried it.  Who is 'we'? Your bio is empty.

    MdlApplicationClass

    But that isn't my question, which is about MdlApplicationClass.  If the Bentley C++ developers introduced that enum, and the functions to get/set its value, they presumably had a reason that isn't satisfied by examining the commandLine.  Why can't it be echoed in .NET?

     
    Regards, Jon Summers
    LA Solutions

  • I have tried it.  Who is 'we'? Your bio is empty.

    I meant "we" as us, the readers of this post.

    But that isn't my question, which is about MdlApplicationClass.

    Yes, you are right. Another non-equivalent might be the enum MdlApplicationType returned by the Bentley.MstnPlatformNET.AddIn.ApplicationType property.

    Tom

    Answer Verified By: Jon Summers 

Reply Children