public class ModalDialog : UserControl { public event EventHandler closed; // Dialog Close Event public event ModalEventHandler CompletedCallback; // Call back event
public void Close() { if (closed != null) { closed(this, EventArgs.Empty); } }
public void HandleCallback(ModalEventArgs e) { if (CompletedCallback != null) { CompletedCallback(this, e); } } }
public interface IModalDialogOpener { void ShowModalDialog(ModalDialog dialog); void CloseModalDialog(); } public class ModalEventArgs : EventArgs { public object Result { set; get; } // the result of this modal dialog } public delegate void ModalEventHandler(object sender, ModalEventArgs e);