/// <summary> /// Lazy initialization of the view /// </summary> /// <returns>Actual view</returns> private GenericView GetView() { lock (LockObject) { if (view != null) { return view; } view = new GenericView(); view.Closed += (sender, e) => { if (Closed != null) { Closed(sender, e); } view = null; }; view.Closing += (sender, e) => { if (Closing != null) { Closing(sender, e); } }; return view; } }
public void Close() { GetView().Close(); view = null; }