public void Open(View view) { Browser.Document.Title = view.Title; if (this.view is Layout && view.LayoutType != null) { var layout = (Layout)this.view; var container = layout.FindLayout(view.LayoutType); container.AddView(view); } else { if (this.view != null) { this.view.NotifyViewDetached(); body.Remove(this.view.Content); } var rootView = view.GetRootView(); rootView.NotifyViewAttached(); body.Add(rootView.Content); this.view = rootView; } if (this.view is Layout) { var layout = (Layout)this.view; var sections = view.Sections; layout.LoadSections(sections); // foreach (var section in sections.Values) // { // section.NotifyOnAddedToView(); // } } }
public void Open(View view) { Browser.Document.Title = view.Title; if (View is Layout && view.LayoutType != null) { var layout = (Layout)View; var container = layout.FindLayout(view.LayoutType); container.AddView(view); } else { if (View != null) { View.NotifyViewDetached(); Body.Remove(View.Content); } var rootView = view.GetRootView(); if (rootView.Content == null) throw new Exception($"View must provide a valid 'Content' property: {rootView.GetType().FullName}"); rootView.NotifyViewAttached(); Body.Add(rootView.Content); View = rootView; } if (View is Layout) { var layout = (Layout)View; var sections = view.Sections; layout.LoadSections(sections); // foreach (var section in sections.Values) // { // section.NotifyOnAddedToView(); // } } }