D2 Lockbox can be a real PITA to install but it surely is even more PITA when it is installed in a VM. Thing is that even if you have a properly installed D2 Lockbox it will stop functioning after each VM reboot.
It took me long hours to notice what is wrong, I was changing the setup, double checking it with the documentation a few times and everything seemed just fine…Funny enough after changing the setup I was doing a reboot – “just in case” 🙂
So, the lesson I have learnt is that VirtualBox VM should not be restarted after Lockbox was configured. It is better to use “VM Pause” otherwise D2.lockbox file will have to be re-generated.
Sometimes it is useful to display some message to the user from the code running on the server side (in D2-Plugin). At the first sight there doesn’t seem to be a way to do this but thanks to Dariusz R. (thanks!) who has decompiled half of D2 code 🙂 we have learned that it is actually possible. And it is also extremely simple:
The trick is to use D2fsExceptionManager.throwD2SilentException(D2fsContext context, String eventName, String messageToPublish) exception with appropriate event name and message, for example:
D2fsExceptionManager.throwD2SilentException(context, "D2_ACTION_DISPLAY_DIALOG", "DIALOG_NAME==VeryImportantDialog!!CHANNEL_EVENT==D2_ACTION_DISPLAY_DIALOG");
That’s all! Try it for yourself.