开发者

How to detect when a user navigates away from MMC FormView?

开发者 https://www.devze.com 2023-03-24 02:03 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消