예제 #1
0
        public StateNode QueryLayouts()
        {
            var root = new StateNode("Root");

            root.Children.Clear();

            foreach (var w in Application.Current.Windows.OfType <MainWindow>())
            {
                var bounds = w.RestoreBounds;

                var shellState = new ShellSettings(bounds.Top,
                                                   bounds.Left,
                                                   bounds.Right - bounds.Left,
                                                   bounds.Top - bounds.Bottom,
                                                   w.WindowState);



                var layoutAccessor = w.Layout.Query();
                var layoutNode     = new StateNode(shellState);
                root.Children.Add(layoutNode);

                layoutAccessor.Visit(layoutNode, BranchAccessorVisitor, TabablzControlVisitor);
            }

            return(root);
        }
예제 #2
0
        private static void TabablzControlVisitor(StateNode stateNode, TabablzControl tabablzControl)
        {
            var tabStates = tabablzControl.Items.OfType <ViewContainer>()
                            .Select(item => item.Content).OfType <IPersistentStateProvider>()
                            .Select(provider => provider.CaptureState())
                            .ToList();

            var tabablzNode = new StateNode(tabStates);

            stateNode.Children.Add(tabablzNode);
        }
예제 #3
0
        private static void FloatingItemsVisitor(StateNode layoutNode, LayoutAccessor layoutAccessor)
        {
            var floatingItems     = layoutAccessor.FloatingItems.ToList();
            var floatingItemsNode = new StateNode("Floating Items " + floatingItems.Count);

            foreach (var floatingItemNode in floatingItems.Select(floatingItem => new StateNode
                                                                  (
                                                                      $"Floating Item {floatingItem.X}, {floatingItem.Y} : {floatingItem.ActualWidth}, {floatingItem.ActualHeight}"
                                                                  )))
            {
                floatingItemsNode.Children.Add(floatingItemNode);
            }

            if (floatingItemsNode.Children.Count != 0)
            {
                layoutNode.Children.Add(floatingItemsNode);
            }
        }
예제 #4
0
        private static void BranchAccessorVisitor(StateNode stateNode, BranchAccessor branchAccessor)
        {
            var branchNode = new StateNode(new BranchNode(branchAccessor.Branch.Orientation.ToString()));

            stateNode.Children.Add(branchNode);

            var proportion = branchAccessor.Branch.GetFirstProportion();

            var firstBranchNode = new StateNode(new BranchNode(proportion));

            branchNode.Children.Add(firstBranchNode);
            var secondBranchNode = new StateNode(new BranchNode(1 - proportion));

            branchNode.Children.Add(secondBranchNode);

            branchAccessor
            .Visit(firstBranchNode, BranchItem.First, BranchAccessorVisitor, TabablzControlVisitor)
            .Visit(secondBranchNode, BranchItem.Second, BranchAccessorVisitor, TabablzControlVisitor);
        }
예제 #5
0
        public IEnumerable <StateNode> QueryLayouts()
        {
            _rootNode.Children.Clear();

            foreach (var w in Application.Current.Windows.OfType <MainWindow>())
            {
                var bounds = w.RestoreBounds;

                var shellState = new ShellSettings(bounds.Top,
                                                   bounds.Left,
                                                   bounds.Right - bounds.Left,
                                                   bounds.Top - bounds.Bottom,
                                                   w.WindowState);

                var layoutAccessor = w.Layout.Query();
                var layoutNode     = new StateNode(shellState);
                _rootNode.Children.Add(layoutNode);

                //   FloatingItemsVisitor(layoutNode, layoutAccessor);
                layoutAccessor.Visit(layoutNode, BranchAccessorVisitor, TabablzControlVisitor);
            }

            return(new[] { _rootNode });
        }
예제 #6
0
 public LayoutAnalyser()
 {
     ;
     _rootNode = new StateNode("Application");
 }
예제 #7
0
 public void Write(StateNode rootNode)
 {
     var stack = new Stack <StateNode>();
 }
예제 #8
0
        public IEnumerable<StateNode> QueryLayouts()
        {
            _rootNode.Children.Clear();

            foreach (var w in Application.Current.Windows.OfType<MainWindow>())
            {
                var bounds = w.RestoreBounds;

                var shellState = new ShellSettings(bounds.Top,
                            bounds.Left,
                            bounds.Right- bounds.Left,
                            bounds.Top - bounds.Bottom,
                            w.WindowState);

                var layoutAccessor = w.Layout.Query();
                var layoutNode = new StateNode(shellState);
                _rootNode.Children.Add(layoutNode);

             //   FloatingItemsVisitor(layoutNode, layoutAccessor);
                layoutAccessor.Visit(layoutNode, BranchAccessorVisitor, TabablzControlVisitor);
            }

            return new[] {_rootNode};
        }
예제 #9
0
 public LayoutAnalyser()
 {
     ;
     _rootNode = new StateNode("Application");
 }
예제 #10
0
        private static void TabablzControlVisitor(StateNode stateNode, TabablzControl tabablzControl)
        {
            var tabStates = tabablzControl.Items.OfType<ViewContainer>()
                .Select(item => item.Content).OfType<IPersistentStateProvider>()
                .Select(provider => provider.CaptureState())
                .ToList();

            var tabablzNode = new StateNode(tabStates);
            stateNode.Children.Add(tabablzNode);
        }
예제 #11
0
        private static void FloatingItemsVisitor(StateNode layoutNode, LayoutAccessor layoutAccessor)
        {
            var floatingItems = layoutAccessor.FloatingItems.ToList();
            var floatingItemsNode = new StateNode("Floating Items " + floatingItems.Count);
            foreach (var floatingItemNode in floatingItems.Select(floatingItem => new StateNode
            (
                $"Floating Item {floatingItem.X}, {floatingItem.Y} : {floatingItem.ActualWidth}, {floatingItem.ActualHeight}"
            )))
            {
                floatingItemsNode.Children.Add(floatingItemNode);
            }

            if (floatingItemsNode.Children.Count != 0)
                layoutNode.Children.Add(floatingItemsNode);
        }
예제 #12
0
        private static void BranchAccessorVisitor(StateNode stateNode, BranchAccessor branchAccessor)
        {
            var branchNode = new StateNode( new BranchNode(branchAccessor.Branch.Orientation.ToString()) );
            stateNode.Children.Add(branchNode);

            var proportion = branchAccessor.Branch.GetFirstProportion();

            var firstBranchNode = new StateNode(new BranchNode(proportion));
            branchNode.Children.Add(firstBranchNode);
            var secondBranchNode = new StateNode(new BranchNode(1-proportion));
            branchNode.Children.Add(secondBranchNode);

            branchAccessor
                .Visit(firstBranchNode, BranchItem.First, BranchAccessorVisitor, TabablzControlVisitor)
                .Visit(secondBranchNode, BranchItem.Second, BranchAccessorVisitor, TabablzControlVisitor);
        }