Created
April 14, 2014 07:25
-
-
Save hmcclungiii/10624053 to your computer and use it in GitHub Desktop.
C# Event Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace eventpattern { | |
public delegate void AllPropertiesDetailsParsedEventHandler(object sender, AllPropertiesDetailsParsedEventArgs e); | |
public class AllPropertiesDetailsParsedEventArgs : EventArgs | |
{ | |
} | |
public partial class Controller | |
{ | |
public event AllPropertiesDetailsParsedEventHandler AllPropertiesDetailsParsed; | |
protected internal virtual void OnAllPropertiesDetailsParsed(AllPropertiesDetailsParsedEventArgs e) | |
{ | |
AllPropertiesDetailsParsed(this, e); | |
} | |
} | |
public partial class MainForm : Form | |
{ | |
private Controller controller = null; | |
public MainForm() | |
{ | |
InitializeComponent(); | |
controller = new Controller(); | |
this.controller.AllPropertiesDetailsParsed += new AllPropertiesDetailsParsedEventHandler(this.AllPropertiesDetailsParsed); | |
} | |
private void AllPropertiesDetailsParsed(object sender, AllPropertiesDetailsParsedEventArgs e) | |
{ | |
// Take action here (custom code) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment