//Updaten des angezeigten UserControls, wegräumen des alten public void Update(Template src, EventData e) { var direct = new Dictionary <Type, Action> { { typeof(UcLogin), () => BringElementToFront(UcLogin.Instance) }, { typeof(UcRegister), () => BringElementToFront(UcRegister.Instance) }, { typeof(UcForgotPassword), () => BringElementToFront(UcForgotPassword.Instance) }, { typeof(UcSeries), () => BringElementToFront(UcSeries.Instance) }, { typeof(UcSerie), () => BringElementToFront(UcSerie.Instance) }, { typeof(UcAddSeries), () => BringElementToFront(UcAddSeries.Instance) }, }; @direct[e.Destination.GetType()](); if (e.ShouldDispose) { pnl_root.Controls.Remove(src); var dispose = new Dictionary <Type, Action> { { typeof(UcLogin), () => UcLogin.Reset() }, { typeof(UcRegister), () => UcRegister.Reset() }, { typeof(UcForgotPassword), () => UcForgotPassword.Reset() }, { typeof(UcSeries), () => UcSeries.Reset() }, { typeof(UcSerie), () => UcSerie.Reset() }, { typeof(UcAddSeries), () => UcAddSeries.Reset() }, }; @dispose[src.GetType()](); } }
private void on_series_element_Click(object sender, System.EventArgs e) { UcSerie.Create(Series); Notify(UcSeries.Instance, new EventData(UcSerie.Instance)); }