开发者

Detect when users log out of an application in C#

If the application I'm working on, is there any way to tell when users press the Logout butt开发者_如何学Con?


I'm familiar with the paradigmatic differences between WPF and Winforms, but haven't ever written a line of WPF code, so this may not be applicable, but... The way to accomplish this in WinForms would be to create a method on C (by subclassing C if it's not a class you can modify) and subscribing that method to the Click event on the button during your form's Load event handler.


If form F has a reference to C, the F click handler can call a method on C.

If form F doesn't have a reference to C, expose a LoggedOut event on the first form, and either subscribe to it from C (if C has a reference to F) or use an event aggregator if C neither has a reference to the other.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜