How to detect when a user navigates away from MMC FormView?
I have an MMC snapin (MMC 3.0) with a ScopeNode that adds a Microsoft.ManagementConsole.FormView. This FormView is used to edit a script. If the script contains syntax errors I need to prevent the user from navigating away from the form until the syntax errors are corrected. I can probably add event handlers to my script editor control to detect lost focus or window visibility change, but is there something in MMC that notifies and allows for cancelling the action?
What's the best way to detect开发者_StackOverflow that the user is navigating away from the FormView?
You can detect that the user is navigating away from the FormView
by overriding the OnHide
method:
protected override void OnHide()
{
System.Diagnostics.Debug.WriteLine("Navigated away from FormView.");
}
Unfortunately, you cannot cancel the navigation.
精彩评论