It all depends on the way you design your classes and their integration but given the example above you can use a custom EventArgs or better yet a custom EventHandler.
Don't pass 'e' to the 'LoginButtonClicked' event. Instead use custom event args class containing logged in user data. For that you need to define your event handler a tab bit different though:
event EventHandler<MyEventArgs> LoginButtonClicked;
Then define your event args class:
public class MyEventArgs : EventArgs{
public MyEventArgs(User activeUser) {
ActiveUser = activeUser;
}
public User ActiveUser { get; }
}
Now you can pass a new instance of the new class instead of 'e':
LoginButtonClicked(this, new MyEventArgs(activeUser));
The subscriber of the event can then use e.ActiveUser to access the logged in user info, for example:
myLoginPanel.LoginButtonClicked += (s, e) => { /* do something with e.ActiveUser */ };
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…