The MicroStationAPI provides mdlSystem_getMdlAppClass/mdlSystem_setMdlAppClass that inform how the app was loaded (USER, DGNAPP, etc) in one of the MdlApplicationClass enum values.
mdlSystem_getMdlAppClass/mdlSystem_setMdlAppClass
MdlApplicationClass
I can't see a .NET equivalent in the MstnPlatformNET.
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; } } }
Tomáš Juřík said: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.
commandLine
The first argument (commandLine[0]) is the AddIn name.
commandLine[0]
Tomáš Juřík said: 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.
Tomáš Juřík said:try it and let us know
I have tried it. Who is 'we'? Your bio is empty.
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?
enum
Regards, Jon Summers LA Solutions
Jon Summers said:I have tried it. Who is 'we'? Your bio is empty.
I meant "we" as us, the readers of this post.
Jon Summers said: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.
Answer Verified By: Jon Summers
Tomáš Juřík said:Another non- equivalent might be the enum MdlApplicationType returned by the Bentley.MstnPlatformNET.AddIn.ApplicationType property
Well-spotted: it provides the same set of values as the C++ enum MdlApplicationClass. But why did they change the name?