Hi Everybody,
I am trying to understand the sample code comes with the Microstation CONNECT Edition SDK (Update 17). The sample project I am looking at is at
<Mocristation SDK Root Folder>\examples\WPF\WPFDemo\
In this project, there is a file WPFDemo.commands.xml containing the setting of all the command words in Microstation key-in tool, and their corresponding functions to be invoked. However, when I look at the code, I don't understand how this XML file is loaded/compiled in to the compiled DLL. Can you tell me how to understand the structure of this project? or any tutorial that can help me to understand it?
Attached is the sample code project. I was able to run it from Visual Studio 2019 (invoked by "devenv" from Developer Shell), and then load into key-in. I am using Microstation CONNECT Edition update 17.
Thank you!
WPFDemo.zip
Hi Sui,
at first (I guess it was discussed already), please follow the best practices and use standard subject format to provide common required information like product in short format.
Sui Huang said:or any tutorial that can help me to understand it?
NET SDK examples are tutorials, setup command table in the same way in your project.
Sui Huang said:Can you tell me how to understand the structure of this project?
Command table must comply with these conditions:
<ItemGroup> <EmbeddedResource Include="AppCommandTable.xml"> <LogicalName>CommandTable.xml</LogicalName> <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup>
Sui Huang said:I don't understand how this XML file is loaded/compiled in to the compiled DLL.
It is done automatically:
When MicroStation is asked to load NET dll:
I recommend to use some NET decompiler (free dnSpy, commercial NET Reflector or any other) and look, how compiled functional SDK example assembly looks lie internally.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Sui Huang
Hi Jan,
Thank you for your suggestion. I updated the title of the post to following the standard.
Inspired by the visual studio project setting you showed, I looked at the property of the command table XML file and find that it is an embedded resource, which means it is included in the compiled DLL file.
I also changed the file name of the table XML file and the solution still compiles. Then the MS CE mdl utility can still load it and then show the command word in the key-in tool. This indicates that MDL utility does not depend on the file name to read the command table.
I will try decompiler if there is a need in the future.
Sui