protected override void LoadSettingsFromEvent(IEvent ev) { int? visitId = ev.UniqueId.KeyValue as int?; if (visitId != null) { ucDefineVisit=new UCDefineVisit(visitId.Value); ucDefineVisit.Dock = DockStyle.Fill; this.Controls.Add(ucDefineVisit); ucDefineVisit.Disposed += (x, y) => this.Close(); this.FormClosed += (x, y) => { ucDefineVisit.Dispose(); OnVisitContextSaved(); }; } else { ucDefineVisit = new UCDefineVisit(); ucDefineVisit.Dock = DockStyle.Fill; this.Controls.Add(ucDefineVisit); ucDefineVisit.Disposed += (x, y) => this.Close(); this.FormClosed += (x, y) => { ucDefineVisit.Dispose(); OnVisitContextSaved(); }; base.LoadSettingsFromEvent(ev); } }
public FormDefineVisit(int visitId) { InitializeComponent(); Methods.SetWindowsIcon(this); ucDefineVisit = new UCDefineVisit(visitId); ucDefineVisit.Dock = DockStyle.Fill; this.Controls.Add(ucDefineVisit); ucDefineVisit.Disposed += (x, y) => { this.Close(); OnVisitContextSaved(); }; }