Example #1
0
 public void AddView(View view)
 {
     OnAddView(view);
     subviews.Add(view);
     view.NotifyViewAttached();
 }
Example #2
0
        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();
//                }
            }            
        }
Example #3
0
 protected virtual void OnAddView(View view)
 {
 }
Example #4
0
 public void RemoveView(View view)
 {
     subviews.Remove(view);
     view.NotifyViewDetached();
 }
Example #5
0
 public ViewResult(View view)
 {
     View = view;
 }
Example #6
0
        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();
//                }
            }            
        }
Example #7
0
 protected ViewResult View(View view)
 {
     return new ViewResult(view);
 }