Folks, I am creating a MMC3.0 SnapIn program with C#. There I have some scope nodes and I have FormViewDescription's where I used C# UserControl instances to display some data. And my intent is, user must see and update those data into the UserControl and there is a Save button onto that UserControl which user should press at the end of their editing and I will persist that change then.
Now the problem is, If after making some changes, user closes the SnapIn window, all his changes are gone :( I need to prevent user before closing this window with a dialog that "Save before quiting " (or something like that - you know the standard feature of any editor program). But could not found a way to do so. Any suggestions for me?
Would be appreciated much!
Coincidentally, I have also just created an MMC in much the same manner as you described above but after much searching (and frustration) I could not find any way to cancel the close event. I recommend changing your approach as explained below.
First of all have a look at how most of the MMC's that are already in Windows handle changing settings. Usually if you want to change a setting you select an item in a ListView and right-click 'Properties' to bring up a settings form and make your changes there.
Bringing up a form gives the developer the ability to control the full lifecycle of the form and ensure that settings are saved before it is closed.
So my advice is:
I hope this helps. Good luck!