Example #1
0
        protected override async Task <DocumentView> OnInitializeView()
        {
            var container = new DocumentViewContainer();

            Child1 = new ChildDisposableTestController();
            await Child1.Initialize(new ModelDescriptor());

            var view1 = await Child1.GetDocumentView();

            container.Views.Add(view1);

            Child2 = new ChildDisposableTestController();
            await Child2.Initialize(new ModelDescriptor());

            var view2 = await Child2.GetDocumentView();

            container.Views.Add(view2);

            Attached = new ChildDisposableTestController();
            await Attached.Initialize(new ModelDescriptor());

            var viewAttached = await Attached.GetDocumentView();

            container.AttachedViews.Add(viewAttached);

            return(container);
        }
Example #2
0
        protected override async Task <DocumentView> OnInitializeView()
        {
            var container = new DocumentViewContainer();

            InnerController = new LoadTestController();
            await InnerController.Initialize(null);

            container.Views.Add(await InnerController.GetDocumentView());
            return(container);
        }
        protected override async Task <DocumentView> OnInitializeView()
        {
            var container = new DocumentViewContainer();

            container.SupportedModes = DocumentViewContainerMode.Tabs | DocumentViewContainerMode.HorizontalSplit | DocumentViewContainerMode.VerticalSplit;
            await View1.Initialize(null);

            await View2.Initialize(null);

            container.Views.Add(await View1.GetDocumentView());
            container.Views.Add(await View2.GetDocumentView());
            return(container);
        }
        public void ActiveViewInHierarchy2()
        {
            var root = new DocumentViewContainer()
            {
                Title = "root"
            };

            root.IsRoot = true;
            Assert.IsNull(root.ActiveViewInHierarchy);
            Assert.IsNull(root.ActiveView);

            var attached1 = new DocumentViewContent(c => Task.FromResult <Control> (null))
            {
                Title = "attached1"
            };

            root.AttachedViews.Add(attached1);
            Assert.IsNull(root.ActiveView);
            Assert.IsNull(root.ActiveViewInHierarchy);

            var view1 = new DocumentViewContent(c => Task.FromResult <Control> (null))
            {
                Title = "view1"
            };

            root.Views.Add(view1);
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(view1, root.ActiveViewInHierarchy);
            Assert.AreEqual(view1, view1.ActiveViewInHierarchy);

            attached1.SetActive();
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(attached1, root.ActiveViewInHierarchy);

            root.SetActive();
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(view1, root.ActiveViewInHierarchy);

            var view2 = new DocumentViewContent(c => Task.FromResult <Control> (null))
            {
                Title = "view2"
            };

            root.Views.Add(view2);
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(view1, root.ActiveViewInHierarchy);
            Assert.AreEqual(view2, view2.ActiveViewInHierarchy);

            var container = new DocumentViewContainer();

            root.Views.Add(container);
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(view1, root.ActiveViewInHierarchy);
            Assert.IsNull(container.ActiveViewInHierarchy);

            var subView1 = new DocumentViewContent(c => Task.FromResult <Control> (null))
            {
                Title = "subView1"
            };

            container.Views.Add(subView1);
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(view1, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView1, container.ActiveView);
            Assert.AreEqual(subView1, container.ActiveViewInHierarchy);
            Assert.AreEqual(subView1, subView1.ActiveViewInHierarchy);

            var subView2 = new DocumentViewContent(c => Task.FromResult <Control> (null))
            {
                Title = "subView2"
            };

            container.Views.Add(subView2);
            Assert.AreEqual(view1, root.ActiveView);
            Assert.AreEqual(view1, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView1, container.ActiveView);
            Assert.AreEqual(subView1, container.ActiveViewInHierarchy);
            Assert.AreEqual(subView2, subView2.ActiveViewInHierarchy);

            container.SetActive();
            Assert.AreEqual(container, root.ActiveView);
            Assert.AreEqual(subView1, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView1, container.ActiveViewInHierarchy);

            subView2.SetActive();
            Assert.AreEqual(subView2, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView2, container.ActiveViewInHierarchy);

            view2.SetActive();
            Assert.AreEqual(view2, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView2, container.ActiveViewInHierarchy);

            subView1.SetActive();
            Assert.AreEqual(view2, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView1, container.ActiveViewInHierarchy);

            container.SetActive();
            Assert.AreEqual(subView1, root.ActiveViewInHierarchy);
            Assert.AreEqual(subView1, container.ActiveViewInHierarchy);
        }