コード例 #1
0
ファイル: LibTests.cs プロジェクト: rubit0/vstouchbartools
        public void RootTouchbarToXmlAsStringNotNull()
        {
            //Arrange
            var space   = new SpecialElement(SpecialElement.Space.Small);
            var segRoot = new SegmentedControl("4")
            {
                Seperated = true
            };
            var seg1 = new SegmentElement("seg1", "a,b,c", "Segment BT 1");

            segRoot.ChildElements.Add(seg1);

            var scroll = new ScrollViewControl("X");

            scroll.ChildElements.Add(new ButtonElement("s1", "1,2,3", "Scroll BT1", CustomIcons.GoToIcon));
            scroll.ChildElements.Add(new ButtonElement("s2", "ctrl+f", "Scroll BT2")
            {
                Width = 80, BackgroundColor = "ff0000"
            });
            scroll.ChildElements.Add(new ButtonElement("s3", "ctrl+f", "Scroll BT3")
            {
                Width = 120
            });
            scroll.ChildElements.Add(new ButtonElement("s4", "ctrl+f", "Scroll BT4")
            {
                Width = 80
            });

            var pop = new PopoverControl("Y", "Pop Items", CustomIcons.SurroundIcon);

            pop.ChildElements.Add(new ButtonElement("p2", "ctrl+f", "Pop BT1")
            {
                Width = 80
            });
            pop.PressAndHoldChildElements.Add(new ButtonElement("p1", "1,2,3", "PopHold BT1", CustomIcons.FormatDocIcon));
            var button3 = new ButtonElement("p3", "alt+f1", "PopHold BT2");

            pop.PressAndHoldChildElements.Add(button3);

            var root = new RootTouchbar();

            root.Elements.Add(new ButtonElement("r1", "1,2,3", "Button1", SystemStandardIcons.Play));
            root.Elements.Add(space);
            root.Elements.Add(new ButtonElement("r2", "ctrl+f", "Button2")
            {
                Width = 80
            });
            root.Elements.Add(segRoot);
            root.Elements.Add(scroll);
            root.Elements.Add(pop);

            //Act
            var doc = root.ToXmlAsString();

            //Assert
            Assert.IsNotNull(doc);

            Debug.Write(doc);
        }
コード例 #2
0
        private string BuildDefaultTouchbar()
        {
            var root     = new RootTouchbar();
            var rand     = new Random().Next(1000, 9999);
            var viewsPop = new PopoverControl("viewsPop", rand.ToString());

            viewsPop.ChildElements.AddRange(new []
            {
                new ButtonElement("solutionButton", "ctrl+w,s", "Solution")
                {
                    BackgroundColor = "66ff99"
                },
                new ButtonElement("outputButton", "ctrl+w,o", "Output")
                {
                    BackgroundColor = "66ff99"
                },
                new ButtonElement("errorsButton", "ctrl+w,e", "Errors")
                {
                    BackgroundColor = "66ff99"
                },
                new ButtonElement("teamButton", "ctrl+^,ctrl+m", "Team")
                {
                    BackgroundColor = "66ff99"
                },
                new ButtonElement("tasksButton", "ctrl+w,t", "Tasks")
                {
                    BackgroundColor = "66ff99"
                },
                new ButtonElement("toolboxButton", "ctrl+w,x", "Toolbox")
                {
                    BackgroundColor = "66ff99"
                }
            });
            root.Elements.Add(viewsPop);

            return(root.ToXmlAsString());
        }