Closed PavelBal closed 2 weeks ago
What's there now? Just a notice?
Yes, "The module will be converted".
Now I remember why this is implemented as notice instead of confirmation dialog. It's done during command execution. At a point where backing out is not possible. In most cases you can reverse the command after.
This might require re-evaluating how we have this implemented.
If we are going to do this, I think the only way to prompt the user before the command begins execution is to eliminate the direct running of commands in MoBi use a purpose-built task to prompt/execute all commands.
I believe the task is not as big as it sounds, we can use MoBiContext to execute the task. So most things would probably convert from.
new Command().Run(_context)
to
_context.RunCommand(new Command())
or something like that. Tedious due to the number of instances, but not impossible - way less work than converting PSV/MSV to PV/IC.
Then we can think about how to actually check this. Right now the commands are prompting based on whether the building block version will be updated. This is only done in one or two abstract base commands so it should not be too difficult to get the default existing functionality by checking the inheritance.
@Yuri05 @msevestre What do you guys think about changing this around?
Check this PR for a demo where I just converted one command execution.
https://github.com/Open-Systems-Pharmacology/MoBi/pull/1480/files
Any action that will convert a PK-Sim module to an extension module should not only show a warning, but also have a "yes/no" option.