// Wrap event invocations inside a protected virtual method protected virtual void OnRaiseOkClicked(CpArgs e) { EventHandler <CpArgs> handler = OkClicked; if (handler != null) { handler(this, e); } }
void PassInfo() { string cpFrom = lb_copy_from.SelectedValue as string; string cpTo = lb_copy_to.SelectedValue as string; CpArgs args = new CpArgs(cpFrom, cpTo); OnRaiseOkClicked(args); }