CE Update 13: Remove workflow from ribbon before import

During the porting from V8i to CE, we intent to use a specific custom workflow that will take the place of the goold old menu.

This workflow is created and loaded dynamically (it will even change when the user changes DGN).

In order to do so, we build an XML file and import it from within an MDL application.

There are 2 problems:

1)

An eventual existing workflow with the same name is not overwritten but some sort of duplication is created. We could call ribbon customizations revertall first, but that deletes all customizations and we don't want that. We just want to delete the workflow with that specific name (without the user being asked anything).

2)

The key-in ribbon customizations importecxml opens a dialog asking the user to enter the filename. If I pass the filename within the command, it just asks me if I want to import the xml into Personal.dgnlib and it doesn't add the workflow to the ribbon. We want to import an XML without the user being asked anything.

Any suggestions?

Thanks,

Robert Kock

Parents
  • Hi Robert,

    in my opinion it's about misunderstanding of purpose of "customization XML file" usage (as I understand it).

    Ribbon customization tool provides limited (user level) access to ribbon definition. XML file, exported file serves more for storing the customization as a backup, plus optionally to migrate the customization between the files. But it's not designed to be used as dynamic runtime change tool of the ribbon at a runtime.

    An eventual existing workflow with the same name is not overwritten but some sort of duplication is created.

    I guess exact overwriting definition is allowed only in ribbon definition, described in MicroStationAPI help (which I recommend to you already).

    We want to import an XML without the user being asked anything.

    You are using wrong tool. Ribbon customization is the tool designed to be used by users, not by applications at runtime.

    Any suggestions?

    I wrote it in another discussion already: When you want to change completely ribbon completely dynamically, ribbon NET API is probably the only way to go. The problem is that it's not well documented, so it can be a bit adventurous (personally I think it's doable).

    As a workaround, even when I think it's quite dirty, is to modify ribbon xml definition at runtime (do not confuse this file with customization EC xml file). It requires to be very precise to do not break exact XML format (plus XSD definition), but as far as I remember, when ribbon is reloaded (which is huge and quite expensive operation), xml file(s) is reloaded and current content is used.

    And as third, because you have still not provided any proof it's not possible, can be fully standard way to define a set of ribbon customizations (in ribbon xml) and to control it's visibility using expressions and show/hide conditions.

    With regards,

      Jan

Reply
  • Hi Robert,

    in my opinion it's about misunderstanding of purpose of "customization XML file" usage (as I understand it).

    Ribbon customization tool provides limited (user level) access to ribbon definition. XML file, exported file serves more for storing the customization as a backup, plus optionally to migrate the customization between the files. But it's not designed to be used as dynamic runtime change tool of the ribbon at a runtime.

    An eventual existing workflow with the same name is not overwritten but some sort of duplication is created.

    I guess exact overwriting definition is allowed only in ribbon definition, described in MicroStationAPI help (which I recommend to you already).

    We want to import an XML without the user being asked anything.

    You are using wrong tool. Ribbon customization is the tool designed to be used by users, not by applications at runtime.

    Any suggestions?

    I wrote it in another discussion already: When you want to change completely ribbon completely dynamically, ribbon NET API is probably the only way to go. The problem is that it's not well documented, so it can be a bit adventurous (personally I think it's doable).

    As a workaround, even when I think it's quite dirty, is to modify ribbon xml definition at runtime (do not confuse this file with customization EC xml file). It requires to be very precise to do not break exact XML format (plus XSD definition), but as far as I remember, when ribbon is reloaded (which is huge and quite expensive operation), xml file(s) is reloaded and current content is used.

    And as third, because you have still not provided any proof it's not possible, can be fully standard way to define a set of ribbon customizations (in ribbon xml) and to control it's visibility using expressions and show/hide conditions.

    With regards,

      Jan

Children
No Data