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.
Hi Jon Summers,
Is there a specific behavior or goal you are trying to achieve? The .Managed MDL Addin runtime does not support near as many parallel behaviors the Native MDL runtime provides.
Robert Hook said:Is there a specific behavior or goal you are trying to achieve?
An AddIn needs to know how it was started. If started as an MS_DGNAPPS, it must defer certain operations until the DGN file is loaded and its caches filled.
Regards, Jon Summers LA Solutions
Hi Jon Summers,
If you need to determine if the MDL AddIn was loaded as a dgnapp then then you will need to either: call the MDL Native API using the loaded AddIn name, or query MS_DGNAPPS to produce a file list to test if loaded and match against.
If the AddIn (code) is your own I suggest adding your own AddIn Delegates, such as: MstnPlatformNET AddIn.NewDesignFileEventHandler and switching case on: AddIn.NewDesignFileEventArgs.When == AfterDesignFileOpen.
Please let me know if this help resolve the issue, need more information, or if I may have missed something in haste.
Thank you and HTH,Bob
Robert Hook said:If you need to determine if the MDL AddIn was loaded as a dgnapp
The question is about a .NET AddIn.
Robert Hook said:MstnPlatformNET AddIn.NewDesignFileEventHandler
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 :-)
[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)
// AddIn loaded by keyin from ribbon
// AddIn loaded from (start script) keyin; "mdl silentload xyz"
// AddIn loaded as MS_DGNAPPS
// there may be other
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.
The first argument (commandLine) is the AddIn name.
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?
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?