Open-Systems-Pharmacology/MoBi

Show a warning when an action converts PKSim module to extension module

Closed this issue · 8 comments

Show a warning when an action converts PKSim module to extension module

@PavelBal I initially wrote this check to compare all building block versions against imported versions. Any change in the BB changes its version, therefore any building block change makes this not a PK-Sim module anymore.

Should this assumption be adjusted? Implemented this way, it means that a parameter change changes the module type.

      /// <summary>
      /// Module is a PKSim module if created in PKSim and the module version
      /// matches the version when it was first imported
      /// </summary>
      public bool IsPKSimModule => !string.IsNullOrEmpty(PKSimVersion) && Equals(Version, ModuleImportVersion);

Okay then this is the expected behavior. However, would be nice to have a warning message the first time user changes anything in the module, like "Editing a PK-Sim module will convert it to extention module, do you want to proceed?".

Does the dialog need a cancel option, or is this an informational prompt only?

Yes need a cancel option.

This will be tricky to find a good strategy. The action of changing the building block version number, which is how module types are inferred, is done when the command is already being run.

To intercept all commands before they run will be daunting, there are hundreds, and some are in Core, some are in MoBi.

After some discussion, it seems the best place to start investigating will be during the Run extension method where the context is being used, but the command has not yet started.

@PavelBal change the issue title :)

Why is this a bug @Yuri05 ?

Why is this a bug @Yuri05 ?

it was set as a bug with the previous issue title ("PKSim module is converted to extension module when saved and re-opened")