示例#1
0
        private void CreateRadioLabel(Grid grid, int row, string label, Enum e, string inputKey, Func <string, bool> clickHandler)
        {
            var textBlock = new TextBlock
            {
                Text = " " + label + "  "
            };

            grid.AddChild(textBlock, row, 0);

            int idx = 0;

            foreach (string value in Enum.GetNames(e.GetType()))
            {
                var input = new RadioButton
                {
                    IsChecked = idx == 0 ? true : false,
                    Margin    = "0 0 0 0",
                    Text      = value,
                    GroupName = inputKey,
                    Style     = Styles.CreateInputStyle()
                };
                input.Click += evt => clickHandler(value);
                grid.AddChild(input, row, idx + 1);
                idx++;
            }
        }
示例#2
0
        public void When_Grid_Has_One_Colums_And_One_Row_And_No_Size_Spec()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            var c1 = SUT.AddChild(new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(10, 10)
            });
            var c2 = SUT.AddChild(new View {
                Name = "Child02", RequestedDesiredSize = new Windows.Foundation.Size(10, 10)
            });

            SUT.Measure(new Windows.Foundation.Size(20, 20));
            var measuredSize = SUT.DesiredSize;

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 20, 20));

            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 20, 20), c1.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 20, 20), c2.Arranged);

            //Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 20, 20), Windows.Foundation.default(Size));
            Assert.AreEqual(measuredSize, new Windows.Foundation.Size(10, 10));
            Assert.AreEqual(2, SUT.GetChildren().Count());
        }
示例#3
0
        public PersonCellView()
        {
            var layoutIntero = new Grid {
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition {
                        Width = new GridLength(0.3, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.7, GridUnitType.Star)
                    },
                }
            };
            var img = new Image {
            };

            img.Bind(nameof(CellViewModelBase.Thumb));
            layoutIntero.AddChild(img, 0, 0);

            var title = new Label {
            };

            title.Bind(nameof(CellViewModelBase.Title));
            layoutIntero.AddChild(title, 0, 1);

            layoutIntero.Margin = new Thickness(5);

            View = layoutIntero;
        }
示例#4
0
        public void When_Grid_Has_Two_Elements_And_MinWidth_MinHeight_VerticalAlignment_Top_HorizontalAlignment_Center_And_Child_Stretched_And_Centered()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            SUT.MinWidth            = 40;
            SUT.MinHeight           = 40;
            SUT.VerticalAlignment   = VerticalAlignment.Top;
            SUT.HorizontalAlignment = HorizontalAlignment.Center;

            var c1 = SUT.AddChild(new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(20, 20), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch
            });
            var c2 = SUT.AddChild(new View {
                Name = "Child02", RequestedDesiredSize = new Windows.Foundation.Size(20, 20), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
            });

            SUT.Measure(new Windows.Foundation.Size(60, 60));
            var measuredSize = SUT.DesiredSize;

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 60, 60));

            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 40, 40), c1.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(10, 10, 20, 20), c2.Arranged);

            Assert.AreEqual(measuredSize, new Windows.Foundation.Size(40, 40));
            Assert.AreEqual(2, SUT.GetChildren().Count());
        }
示例#5
0
文件: Issue4493.cs 项目: gywerd/CPUI
        protected override void Init()
        {
            // Initialize ui here instead of ctor
            BackgroundColor = Color.Gray;
            var contentGrid = new Grid
            {
                AutomationId      = "IssuePageGrid",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Maroon,
                RowSpacing        = 0,
                RowDefinitions    = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = 20
                    }
                }
            };

            contentGrid.AddChild(new Image()
            {
                Source = "photo.jpg", AutomationId = "IssuePageImage"
            }, 0, 0);
            contentGrid.AddChild(new Label()
            {
                Text = "test message", BackgroundColor = Color.Blue
            }, 0, 1);
            Content = contentGrid;
        }
示例#6
0
		protected override void Init ()
		{
			var rootGrid = new Grid {
				RowDefinitions = new RowDefinitionCollection
														  {
															 new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
															 new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) },
														 },
			};


			_mainContent = new ContentView { Content = new ScrollView { Content = new Label { Text = Description } } };
			rootGrid.AddChild (_mainContent, 0, 0);


			var buttons = new StackLayout { Orientation = StackOrientation.Horizontal };

			var button1A = new Button { Text = "View 1A" };
			button1A.Clicked += (sender, args) => ShowView (_view1A);
			buttons.Children.Add (button1A);

			var button1B = new Button { Text = "View 1B" };
			button1B.Clicked += (sender, args) => ShowView (_view1B);
			buttons.Children.Add (button1B);

			var button2 = new Button { Text = "View 2" };
			button2.Clicked += (sender, args) => ShowView (_view2);
			buttons.Children.Add (button2);

			rootGrid.AddChild (buttons, 0, 1);


			Content = rootGrid;
		}
        public void FillGridWithCardTypes(List <Ship> ships)
        {
            var names = ships.Select(p => p.Name).Distinct().ToList();

            ClickableToRemove = new List <IClickable>();
            gridCards.RemoveChildren();
            int i = 0;

            foreach (var name in names)
            {
                cardCouple couple = new cardCouple();
                Label      lbl    = new Label(coupleWidth, coupleHeight, Game1.self.GraphicsDevice, Gui, Gui.smediumFont, true)
                {
                    Text = name
                };
                Button button = new Button(coupleWidth, coupleHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
                {
                    Text = "Select skin"
                };
                button.clickEventObject += setTexture;
                Clickable.Add(button);
                ClickableToRemove.Add(button);
                couple.lbl    = lbl;
                couple.button = button;
                couples.Add(couple);
                gridCards.AddChild(lbl);
                gridCards.AddChild(button);
                i++;
            }

            gridCards.DrawBackground = false;
            gridCards.UpdateP();
            gridCards.UpdateActive(true);
            layout.Update();
        }
示例#8
0
        protected override void Init()
        {
            this.ControlTemplate = new ControlTemplate(typeof(PresenterWrapper));

            var grid = new Grid()
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(0, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            grid.AddChild(new Label()
            {
                Text          = "Header",
                LineBreakMode = LineBreakMode.WordWrap,
                FontSize      = 24
            }, 0, 0);

            grid.AddChild(new Label()
            {
                Text = "Lorem ipsum dolor sit amet, sed at etiam graecis. Amet dicta utroque in ius, error vituperatoribus vel ex. " +
                       "Cu duo veri aperiam honestatis. Quo sint movet ullamcorper cu, vero vidisse argumentum ne nec, in munere eirmod eum. " +
                       "Persius similique reformidans ex mei, cu quo quot nihil mediocrem.",
                LineBreakMode = LineBreakMode.WordWrap
            }, 0, 1);

            Content = grid;
        }
示例#9
0
        public void When_Three_Colums_One_Auto_Two_Fixed_And_Column_Span_Full()
        {
            using var _ = new AssertionScope();

            var SUT = new Grid()
            {
                Name = "test", Width = 44
            };

            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "18"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "auto"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "18"
            });

            var c1 = SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Size(10, 0)
            }
                .GridPosition(0, 1)
                );
            var c2 = SUT.AddChild(
                new View {
                Name = "Child02", RequestedDesiredSize = new Size(0, 30)
            }
                .GridPosition(0, 1)
                );
            var c3 = SUT.AddChild(
                new View {
                Name = "Child03", RequestedDesiredSize = new Size(24, 8)
            }
                .GridPosition(0, 0)
                .GridColumnSpan(3)
                );

            SUT.Measure(new Size(44, 100));
            var measuredSize = SUT.DesiredSize;

            measuredSize.Should().Be(new Size(44, 30));

            c1.DesiredSize.Should().Be(new Size(10, 0));
            c2.DesiredSize.Should().Be(new Size(0, 30));
            c3.DesiredSize.Should().Be(new Size(24, 8));

            SUT.Arrange(new Rect(0, 0, 44, 20));

            c1.Arranged.Should().Be(new Rect(18, 0, 10, 30));
            c2.Arranged.Should().Be(new Rect(18, 0, 10, 30));
            c3.Arranged.Should().Be(new Rect(0, 0, 46, 30));

            SUT.GetChildren().Should().HaveCount(3);
        }
示例#10
0
        public void When_Three_Rows_One_Auto_Two_Fixed_And_Row_Span_Full()
        {
            using var _ = new AssertionScope();

            var SUT = new Grid()
            {
                Name = "test", Height = 44
            };

            SUT.RowDefinitions.Add(new RowDefinition {
                Height = "18"
            });
            SUT.RowDefinitions.Add(new RowDefinition {
                Height = "auto"
            });
            SUT.RowDefinitions.Add(new RowDefinition {
                Height = "18"
            });

            var c1 = SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Size(0, 10)
            }
                .GridPosition(1, 0)
                );
            var c2 = SUT.AddChild(
                new View {
                Name = "Child02", RequestedDesiredSize = new Size(30, 0)
            }
                .GridPosition(1, 0)
                );
            var c3 = SUT.AddChild(
                new View {
                Name = "Child03", RequestedDesiredSize = new Size(8, 24)
            }
                .GridPosition(0, 0)
                .GridRowSpan(3)
                );

            SUT.Measure(new Size(100, 44));
            var measuredSize = SUT.DesiredSize;

            measuredSize.Should().Be(new Size(30, 44));

            c1.DesiredSize.Should().Be(new Size(0, 10));
            c2.DesiredSize.Should().Be(new Size(30, 0));
            c3.DesiredSize.Should().Be(new Size(8, 24));

            SUT.Arrange(new Rect(0, 0, 20, 44));

            c1.Arranged.Should().Be(new Rect(0, 18, 30, 10));
            c2.Arranged.Should().Be(new Rect(0, 18, 30, 10));
            c3.Arranged.Should().Be(new Rect(0, 0, 30, 46));

            SUT.GetChildren().Should().HaveCount(3);
        }
示例#11
0
        public ContentPage9092()
        {
            var button = new Button()
            {
                Text = "Add +",
                HorizontalOptions = LayoutOptions.Center,
                AutomationId      = "AddButton"
            };

            button.Command = new Command(o =>
            {
                button.Text += " +";
            });

            var stackLayoutWithButton = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Children          =
                {
                    button
                }
            };

            var grid = new Grid()
            {
                RowSpacing     = 0,
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = 30
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Star
                    },
                    new RowDefinition()
                    {
                        Height = 30
                    }
                }
            };

            grid.AddChild(new Grid {
                BackgroundColor = Color.Green
            }, 0, 0);
            grid.AddChild(stackLayoutWithButton, 0, 1);
            grid.AddChild(new Grid {
                BackgroundColor = Color.Green
            }, 0, 2);

            Content = grid;

            Title = "Page Title";
        }
示例#12
0
        public Issue5766()
        {
            var grid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition(),
                }
            };

            grid.AddChild(new Label
            {
                Text = "Scroll up and down several times and make sure Frame size is accurate when using Fast Renderers.",
                VerticalTextAlignment = TextAlignment.Center
            }, 0, 0);
            grid.AddChild(new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Enumerable.Range(0, 99).Select(i => i % 2 == 0 ? "small" : "big string > big frame"),
                ItemTemplate  = new DataTemplate(() =>
                {
                    var text = new Label
                    {
                        VerticalOptions = LayoutOptions.Fill,
                        TextColor       = Color.White
                    };
                    text.SetBinding(Label.TextProperty, ".");
                    var view = new Grid
                    {
                        HeightRequest   = 200,
                        Margin          = new Thickness(0, 10, 0, 0),
                        BackgroundColor = Color.FromHex("#F1F1F1")
                    };
                    view.AddChild(new Frame
                    {
                        Padding           = new Thickness(5),
                        Margin            = new Thickness(0, 0, 10, 0),
                        BorderColor       = Color.Blue,
                        BackgroundColor   = Color.Gray,
                        VerticalOptions   = LayoutOptions.Center,
                        HorizontalOptions = LayoutOptions.End,
                        CornerRadius      = 3,
                        Content           = text
                    }, 0, 0);
                    return(new ViewCell
                    {
                        View = view
                    });
                })
            }, 0, 1);

            Content = grid;
        }
示例#13
0
        protected override void Init()
        {
            var rootGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                },
            };


            _mainContent = new ContentView {
                Content = new ScrollView {
                    Content = new Label {
                        Text = Description
                    }
                }
            };
            rootGrid.AddChild(_mainContent, 0, 0);


            var buttons = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            var button1A = new Button {
                Text = "View 1A"
            };

            button1A.Clicked += (sender, args) => ShowView(_view1A);
            buttons.Children.Add(button1A);

            var button1B = new Button {
                Text = "View 1B"
            };

            button1B.Clicked += (sender, args) => ShowView(_view1B);
            buttons.Children.Add(button1B);

            var button2 = new Button {
                Text = "View 2"
            };

            button2.Clicked += (sender, args) => ShowView(_view2);
            buttons.Children.Add(button2);

            rootGrid.AddChild(buttons, 0, 1);


            Content = rootGrid;
        }
示例#14
0
        public void When_Three_Colums_One_Auto_Two_Fixed_And_Column_Span_Full()
        {
            var SUT = new Grid()
            {
                Name = "test", Width = 44
            };

            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "18"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "auto"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "18"
            });

            var c1 = SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(10, 0)
            }
                .GridPosition(0, 1)
                );
            var c2 = SUT.AddChild(
                new View {
                Name = "Child02", RequestedDesiredSize = new Windows.Foundation.Size(0, 30)
            }
                .GridPosition(0, 1)
                );
            var c3 = SUT.AddChild(
                new View {
                Name = "Child03", RequestedDesiredSize = new Windows.Foundation.Size(24, 8)
            }
                .GridPosition(0, 0)
                .GridColumnSpan(3)
                );

            SUT.Measure(new Windows.Foundation.Size(44, 100));
            var measuredSize = SUT.DesiredSize;

            Assert.AreEqual(new Windows.Foundation.Size(44, 30), measuredSize);

            Assert.AreEqual(new Windows.Foundation.Size(10, 0), c1.RequestedDesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(0, 30), c2.RequestedDesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(24, 8), c3.RequestedDesiredSize);

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 44, 20));

            Assert.AreEqual(new Windows.Foundation.Rect(18, 0, 8, 20), c1.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(18, 0, 8, 20), c2.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 44, 20), c3.Arranged);

            Assert.AreEqual(3, SUT.GetChildren().Count());
        }
示例#15
0
        public void When_Three_Rows_One_Auto_Two_Fixed_And_Row_Span_Full()
        {
            var SUT = new Grid()
            {
                Name = "test", Height = 44
            };

            SUT.RowDefinitions.Add(new RowDefinition {
                Height = "18"
            });
            SUT.RowDefinitions.Add(new RowDefinition {
                Height = "auto"
            });
            SUT.RowDefinitions.Add(new RowDefinition {
                Height = "18"
            });

            var c1 = SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(0, 10)
            }
                .GridPosition(1, 0)
                );
            var c2 = SUT.AddChild(
                new View {
                Name = "Child02", RequestedDesiredSize = new Windows.Foundation.Size(30, 0)
            }
                .GridPosition(1, 0)
                );
            var c3 = SUT.AddChild(
                new View {
                Name = "Child03", RequestedDesiredSize = new Windows.Foundation.Size(8, 24)
            }
                .GridPosition(0, 0)
                .GridRowSpan(3)
                );

            SUT.Measure(new Windows.Foundation.Size(100, 44));
            var measuredSize = SUT.DesiredSize;

            Assert.AreEqual(new Windows.Foundation.Size(30, 44), measuredSize);

            Assert.AreEqual(new Windows.Foundation.Size(0, 10), c1.RequestedDesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(30, 0), c2.RequestedDesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(8, 24), c3.RequestedDesiredSize);

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 20, 44));

            Assert.AreEqual(new Windows.Foundation.Rect(0, 18, 20, 8), c1.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(0, 18, 20, 8), c2.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 20, 44), c3.Arranged);

            Assert.AreEqual(3, SUT.GetChildren().Count());
        }
示例#16
0
        public void When_One_Auto_and_one_abs_and_one_star_and_three_children()
        {
            using var _ = new AssertionScope();

            var SUT = new Grid()
            {
                Name = "test"
            };

            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "auto"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "6"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });

            var c1 = SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Size(5, 5)
            }
                .GridPosition(0, 0)
                );
            var c2 = SUT.AddChild(
                new View {
                Name = "Child02", RequestedDesiredSize = new Size(10, 10)
            }
                .GridPosition(0, 1)
                );
            var c3 = SUT.AddChild(
                new View {
                Name = "Child03", RequestedDesiredSize = new Size(10, 7)
            }
                .GridPosition(0, 2)
                );

            SUT.Measure(new Size(20, 20));
            var measuredSize = SUT.DesiredSize;

            measuredSize.Should().Be(new Size(20, 10));
            c1.DesiredSize.Should().Be(new Size(5, 5));
            c2.DesiredSize.Should().Be(new Size(10, 10));
            c3.DesiredSize.Should().Be(new Size(10, 7));

            SUT.Arrange(new Rect(0, 0, 20, 20));

            c1.Arranged.Should().Be(new Rect(0, 0, 5, 20));
            c2.Arranged.Should().Be(new Rect(5, 0, 10, 20));
            c3.Arranged.Should().Be(new Rect(15, 0, 10, 20));

            SUT.GetChildren().Should().HaveCount(3);
        }
示例#17
0
        public void When_One_Auto_and_one_abs_and_one_star_and_three_children()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "auto"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "6"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });

            var c1 = SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(5, 5)
            }
                .GridPosition(0, 0)
                );
            var c2 = SUT.AddChild(
                new View {
                Name = "Child02", RequestedDesiredSize = new Windows.Foundation.Size(10, 10)
            }
                .GridPosition(0, 1)
                );
            var c3 = SUT.AddChild(
                new View {
                Name = "Child03", RequestedDesiredSize = new Windows.Foundation.Size(10, 7)
            }
                .GridPosition(0, 2)
                );

            SUT.Measure(new Windows.Foundation.Size(20, 20));
            var measuredSize = SUT.DesiredSize;

            Assert.AreEqual(new Windows.Foundation.Size(20, 10), measuredSize);
            Assert.AreEqual(new Windows.Foundation.Size(5, 5), c1.RequestedDesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(10, 10), c2.RequestedDesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(10, 7), c3.RequestedDesiredSize);

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 20, 20));

            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 5, 20), c1.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(5, 0, 6, 20), c2.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(11, 0, 9, 20), c3.Arranged);

            //Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 20, 20), Windows.Foundation.default(Size));
            Assert.AreEqual(3, SUT.GetChildren().Count());
        }
示例#18
0
        protected override void Init()
        {
            _elements = new View[]
            {
                new Button()
                {
                    Text = "Edit", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start
                },
                new Button()
                {
                    Text = "Save", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start
                },
                new Button()
                {
                    Text = "Cancel", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start
                },
                new Label()
                {
                    Text = "Some Label", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start
                },
                new Label()
                {
                    Text = "Success", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start
                },
            };

            var layout = new PopupStackLayout()
            {
            };

            foreach (View element in _elements)
            {
                layout.Children.Add(element);
            }

            var grid = new Grid()
            {
                Children =
                {
                    layout
                }
            };

            grid.AddChild(new Label()
            {
                Text = "Success"
            }, 0, 0);
            grid.AddChild(layout, 0, 1);

            Content = grid;
        }
示例#19
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        protected async override Task <View> BuildContent()
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            var stlContent = new StackLayout();

            stlContent.Orientation = StackOrientation.Vertical;

            // Header
            lblHeader = new Label()
            {
                TextColor = settings.TextColor, Margin = new Thickness(0, 0, 0, 2)
            };
            stlContent.Children.Add(lblHeader);

            // Editor
            edtEditor = new Entry()
            {
                TextColor = settings.TextColor, BackgroundColor = settings.EditorsColor
            };
            edtEditor.Completed += (s, e) => CloseDialogOk();
            if (String.IsNullOrEmpty(ext))
            {
                edtEditor.Margin = new Thickness(0, 0, 0, 10);
                stlContent.Children.Add(edtEditor);
            }
            else
            {
                edtEditor.WidthRequest = 160;
                var grd = new Grid();
                grd.Margin = new Thickness(0, 0, 0, 10);
                grd.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Auto)
                });
                grd.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Auto)
                });
                grd.AddChild(edtEditor, 0, 0).SetLayoutOption(LO.S, LO.C);
                grd.AddChild(new Label()
                {
                    Text = ext, Margin = new Thickness(5, 0, 0, 0), TextColor = settings.TextColor
                }, 0, 1)
                .SetLayoutOption(LO.S, LO.C);
                stlContent.Children.Add(grd);
            }

            return(stlContent);
        }
示例#20
0
        Grid ActionGrid(List <ImageButton> buttons)
        {
            ImageButton firstButton = buttons.FirstOrDefault();
            Grid        actionGrid  = new Grid();

            actionGrid.AddChild(new Button()
            {
                Text    = "Add Right",
                Command = new Command(() =>
                {
                    var button     = firstButton;
                    button.Padding = new Thickness(button.Padding.Left, 0, button.Padding.Right + 10, 0);
                })
            }, 0, 0);
            actionGrid.AddChild(new Button()
            {
                Text    = "Add Left",
                Command = new Command(() =>
                {
                    var button     = firstButton;
                    button.Padding = new Thickness(button.Padding.Left + 10, 0, button.Padding.Right, 0);
                })
            }, 0, 1);

            actionGrid.AddChild(new Button()
            {
                Text    = "Animation",
                Command = new Command(() => animation = !animation)
            }, 1, 1);
            actionGrid.AddChild(new Button()
            {
                Text    = "Add Top",
                Command = new Command(() =>
                {
                    var button     = firstButton;
                    button.Padding = new Thickness(0, button.Padding.Top + 10, 0, button.Padding.Bottom);
                })
            }, 2, 0);
            actionGrid.AddChild(new Button()
            {
                Text    = "Add Bottom",
                Command = new Command(() =>
                {
                    var button     = firstButton;
                    button.Padding = new Thickness(0, button.Padding.Top, 0, button.Padding.Bottom + 10);
                })
            }, 2, 1);
            return(actionGrid);
        }
示例#21
0
        public void When_Grid_Has_Two_Variable_Sized_Element_With_ColSpan_and_One_Auto_Columns()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "auto"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });

            var c1 = SUT.AddChild(
                new View
            {
                Name = "Child01",
                DesiredSizeSelector = s => s.Width > 10 ? new Windows.Foundation.Size(20, 5) : new Windows.Foundation.Size(10, 10)
            }
                .GridColumnSpan(2)
                );

            var c2 = SUT.AddChild(
                new View
            {
                Name = "Child02",
                DesiredSizeSelector = s => new Windows.Foundation.Size(5, 5)
            }
                .GridPosition(0, 1)
                );

            SUT.Measure(new Windows.Foundation.Size(30, 30));
            var measuredSize = SUT.DesiredSize;

            Assert.AreEqual(new Windows.Foundation.Size(20, 5), c1.DesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(5, 5), c2.DesiredSize);

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 30, 30));
            Assert.AreEqual(new Windows.Foundation.Size(20, 5), c1.DesiredSize);
            Assert.AreEqual(new Windows.Foundation.Size(5, 5), c2.DesiredSize);

            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 17.5f, 30), c1.Arranged);
            Assert.AreEqual(new Windows.Foundation.Rect(12.5f, 0, 5, 30), c2.Arranged);
            Assert.AreEqual(2, SUT.GetChildren().Count());
        }
 private void OnAdd()
 {
     if (DeckInputBox.Text.Length > 0 && gridRight.CanHaveMoreChildren())
     {
         Deck newDeck = new Deck(new Point(), 20, (int)(gridRight.Height * 0.1),
                                 Game1.self.GraphicsDevice, Gui, Gui.mediumFont, false, DeckInputBox.Text);
         Decks.Add(newDeck);
         newDeck.RecentlyAdded = true;
         newDeck.clickEvent   += DeckClick;
         gridRight.AddChild(newDeck);
         DeckInputBox.Text = "";
         Clickable.Add(newDeck);
         gridRight.ResizeChildren();
     }
 }
示例#23
0
        void AddChild(string desc, int row, Action <double> onChanged)
        {
            var sliderLabel = new Label();
            var slider      = new Slider {
                Maximum = 360
            };

            slider.ValueChanged += (sender, e) =>
            {
                onChanged(e.NewValue);
                sliderLabel.Text = $"{desc} = {(int)e.NewValue}";
            };
            grid.AddChild(slider, 0, row);
            grid.AddChild(sliderLabel, 1, row);
        }
示例#24
0
        void SetupMeasuringTest3()
        {
            ContentPage contentPage = new ContentPage();

            AddFlyoutItem(contentPage, "Width Measure and ToolBarItem (13949)");

            Grid grid = new Grid();

            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            grid.AddChild(new Label()
            {
                Text = "Text"
            }, 0, 0);
            grid.AddChild(new Button()
            {
                Text = "B1"
            }, 1, 0);
            grid.AddChild(new Button()
            {
                Text = "B2"
            }, 2, 0);

            Shell.SetTitleView(contentPage, grid);

            contentPage.Content = new StackLayout()
            {
                Children =
                {
                    new Label()
                    {
                        Text = "TitleView should have one label and two buttons"
                    }
                }
            };

            contentPage.ToolbarItems.Add(new ToolbarItem()
            {
                Text = "Item"
            });
        }
示例#25
0
        public AboutPage(AboutPageVM vm)
        {
            VM             = vm ?? new AboutPageVM();
            BindingContext = VM;
            Title          = "About";
            var testo = new Label
            {
                Text = "" +
                       "Questa app è stata realizzata grazie al lavoro degli studenti che hanno partecipato al corso di Xamarin tenuto dal Dott. Luca Pisano nell'a.a. 2016-2017"
                       + Environment.NewLine + Environment.NewLine +
                       "Si ringrazia il team del Luiss Loft per la collaborazione offerta e la Luiss Guido Carli per l'opportunità"
            };
            var scrollVerticale = new ScrollView {
                Orientation = ScrollOrientation.Vertical,
                Content     = testo,
            };

            var stackImmagini = new StackLayout {
                Orientation = StackOrientation.Vertical
            };

            var listaImg = new ListView();

            listaImg.ItemTemplate = new DataTemplate(typeof(PersonCellView));
            listaImg.SetBinding(ListView.ItemsSourceProperty, new Binding(nameof(AboutPageVM.Utenti)));
            listaImg.SetBinding(ListView.IsRefreshingProperty, new Binding(nameof(ViewModelBase.IsLoadingData)));

            var griglia = new Grid {
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition {
                        Height = new GridLength(0.5, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(0.5, GridUnitType.Star)
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition {
                        Width = GridLength.Star
                    }
                }
            };

            griglia.AddChild(scrollVerticale, 0, 0);
            griglia.AddChild(listaImg, 1, 0);

            Content = griglia;
        }
示例#26
0
文件: Issue3624.cs 项目: tytok/maui
            public TestCell2()
            {
                var layout = new AbsoluteLayout();
                var label  = new Label();

                label.SetBinding(Label.TextProperty, new Binding("Name"));
                var stack = new StackLayout
                {
                    Children = { label }
                };
                var grid = new Grid()
                {
                    ColumnDefinitions = new ColumnDefinitionCollection {
                        new ColumnDefinition {
                            Width = GridLength.Star
                        }
                    }
                };

                Microsoft.Maui.Controls.CompressedLayout.SetIsHeadless(stack, true);
                grid.AddChild(stack, 0, 0);
                layout.Children.Add(grid, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

                View = layout;
                Microsoft.Maui.Controls.CompressedLayout.SetIsHeadless(stack, TestPage.ShouldUseCompressedLayout);
            }
示例#27
0
        public void When_ChildIsBigger_PlacementBottom()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            var flyout = new Flyout()
            {
                LightDismissOverlayMode = LightDismissOverlayMode.On,
                Placement = Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Bottom
            };

            var button = new Button()
            {
                Width  = 5,
                Flyout = flyout
            };



            SUT.AddChild(button);

            SUT.Measure(new Size(20, 20));
            SUT.Arrange(new Rect(0, 0, 20, 20));

            //button.Click;
            flyout.ShowAt(button);

            Assert.AreEqual(button.LayoutSlot.X, flyout._popup.LayoutSlot.X);
        }
示例#28
0
        public void ReDo()
        {
            ClickableToRemove = new List <IClickable>();
            Clickable.ForEach(p =>
            {
                if (p is Card || p is CardSlot)
                {
                    ClickableToRemove.Add(p);
                }
            });
            ClickableToRemove.ForEach(p => Clickable.Remove(p));
            grid.RemoveChildren();
            slots = new List <CardSlot>();
            for (int row = 0; row < 3; row++)
            {
                for (int column = 0; column < 5; column++)
                {
                    CardSlot c = new CardSlot(CardWidth, CardHeight, Game1.self.GraphicsDevice, Gui);
                    grid.AddChild(c, row, column);
                    c.clickEvent += CardSlotClick;
                    slots.Add(c);
                    Clickable.Add(c);
                }
            }
            var autoEvent = new AutoResetEvent(false);

            time  = 0;
            timer = new Timer(timerStart, autoEvent, 0, 1000);
            grid.UpdateP();
        }
示例#29
0
        public void When_Grid_Has_Two_Columns_And_VerticalAlignment_Top()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            SUT.VerticalAlignment = VerticalAlignment.Top;

            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });

            var child = new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(10, 10)
            };

            SUT.AddChild(child);

            SUT.Measure(new Windows.Foundation.Size(20, 20));
            var measuredSize = SUT.DesiredSize;

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 20, 20));
            var childArrangedSize = child.Arranged;

            Assert.AreEqual(new Windows.Foundation.Size(20, 10), measuredSize);
            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 10, 10), childArrangedSize);
        }
示例#30
0
        public void When_Grid_Has_One_Element_And_MinWidth_MinHeight_VerticalAlignment_Top_HorizontalAlignment_Center()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            SUT.MinWidth            = 40;
            SUT.MinHeight           = 40;
            SUT.VerticalAlignment   = VerticalAlignment.Top;
            SUT.HorizontalAlignment = HorizontalAlignment.Center;

            SUT.AddChild(new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(20, 20)
            });

            SUT.Measure(new Windows.Foundation.Size(60, 60));
            var measuredSize = SUT.DesiredSize;

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 60, 60));

            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 40, 40), SUT.GetChildren().First().Arranged);

            Assert.AreEqual(measuredSize, new Windows.Foundation.Size(40, 40));
            Assert.AreEqual(1, SUT.GetChildren().Count());
        }
示例#31
0
        public void When_Grid_Has_One_Element_With_ColSpan_Overflow_and_Three_Columns()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };


            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });
            SUT.ColumnDefinitions.Add(new ColumnDefinition {
                Width = "*"
            });

            SUT.AddChild(
                new View {
                Name = "Child01", RequestedDesiredSize = new Windows.Foundation.Size(10, 10)
            }
                .GridColumnSpan(4)
                );

            SUT.Measure(new Windows.Foundation.Size(20, 20));
            var measuredSize = SUT.DesiredSize;

            SUT.Arrange(new Windows.Foundation.Rect(0, 0, 20, 20));

            Assert.AreEqual(new Windows.Foundation.Rect(0, 0, 20, 20), SUT.GetChildren().First().Arranged);

            Assert.AreEqual(new Windows.Foundation.Size(10, 10), measuredSize);
            Assert.AreEqual(1, SUT.GetChildren().Count());
        }
        public override void Enter()
        {
            base.Enter();
            Program.Instance.Interface.AddChild(new Control
            {
                Background = new StretchingImageGraphic
                {
                    Texture = new TextureFromFile("mainmenubackground.png"),
                    Size = new Vector2(Program.Settings.GraphicsDeviceSettings.Resolution.Width, Program.Settings.GraphicsDeviceSettings.Resolution.Height)
                },
                Dock = System.Windows.Forms.DockStyle.Fill
            });

            if (Common.ProgramConfigurationInformation.Warnings.Count > 0)
                Program.Instance.Interface.AddChild(
                    new Graphics.Interface.ProgramConfigurationInformationControl
                    {
                        Position = new Vector2(0, 150)
                    });

            form = new DeveloperMainMenuForm();
            Program.Instance.Interface.AddChild(form);

            Program.Instance.Interface.AddChild(new TestMaps());

            var buttonsGrid = new Grid
            {
                Size = new Vector2(800, 200),
                Anchor = Orientation.BottomLeft,
                NWidth = 4,
                NHeight = 8
            };
            Program.Instance.Interface.AddChild(buttonsGrid);

            var videoSettings = new Button
            {
                Size = new Vector2(200, 20),
                Text = "Options",
                Position = new Vector2(200, 60)
            };
            buttonsGrid.AddChild(videoSettings);
            videoSettings.Click += new EventHandler(videoSettings_Click3);

            videoSettings = new Button
            {
                Text = "Fullscreen",
            };
            buttonsGrid.AddChild(videoSettings);
            videoSettings.Click += new EventHandler((o, e) => { Program.Settings.WindowMode = WindowMode.Fullscreen; Program.UpdateWindowMode(); });

            Button exitGameButton = new Button
            {
                Position = new Vector2(200, 40),
                Size = new Vector2(200, 20),
                Text = "Exit",
            };
            buttonsGrid.AddChild(exitGameButton);
            exitGameButton.Click += new EventHandler(exitGameButton_Click);

            Button ratingTestPopup = new Button
            {
                Position = new Vector2(200, 0),
                Size = new Vector2(200, 20),
                Text = "Rating Test"
            };
            buttonsGrid.AddChild(ratingTestPopup);
            ratingTestPopup.Click += new EventHandler((o, e) =>
            {
                Client.Game.Interface.ScoreScreenControl ssc = new Client.Game.Interface.ScoreScreenControl
                {
                    GameState = new Client.Game.GameState { },
                    Map = new Client.Game.Map.Map { Settings = new Client.Game.Map.MapSettings { Name = "asdf" } },
                    GameTime = 123,
                    Statistics = new Client.Game.Statistics { },
                    EarnedGoldCoins = 1,
                    SilverEnabled = Program.Settings.SilverEnabled,
                    HideStats = Program.Settings.HideStats
                };
                ssc.AddChild(new Client.Game.Interface.RatingBox { Anchor = Orientation.TopRight, Position = new Vector2(0, 45) });
                Program.Instance.Interface.AddChild(ssc);
            });

            Button helpPopup = new Button
            {
                Position = new Vector2(200, 40),
                Size = new Vector2(200, 20),
                Text = "Help",
            };
            buttonsGrid.AddChild(helpPopup);
            helpPopup.Click += new EventHandler(helpPopup_Click);

            Button button = new Button
            {
                Text = "NormalWindow",
            };
            buttonsGrid.AddChild(button);
            button.Click += new EventHandler((o, e) =>
            {
                Program.Instance.Interface.AddChild(
                new Window { Anchor = Orientation.Center, Moveable = true });
            });

            button = new Button
            {
                Text = "LargeWindow",
            };
            buttonsGrid.AddChild(button);
            button.Click += new EventHandler((o, e) =>
            {
                Program.Instance.Interface.AddChild(
                new Window { Anchor = Orientation.Center, Moveable = true, LargeWindow = true });
            });

            button = new Button
            {
                Text = "Display settings form"
            };
            buttonsGrid.AddChild(button);
            button.Click += new EventHandler(button_Click);

            var currentStages = new Client.Game.Interface.StageInfo[]
            {
                new Client.Game.Interface.StageInfo
                {
                    HitPoints = 300,
                    Rage = 2.3f,
                    Time = 200,
                    MaxHitPoints = 600,
                },
                new Client.Game.Interface.StageInfo
                {
                    HitPoints = 300,
                    Rage = 2.3f,
                    Time = 200,
                    MaxHitPoints = 600,
                },
                null,
                null,
                null
            };
            var bestStages = new Client.Game.Interface.StageInfo[]
            {
                new Client.Game.Interface.StageInfo
                {
                    HitPoints = 500,
                    Rage = 3f,
                    Time = 150,
                    MaxHitPoints = 600,
                },
                new Client.Game.Interface.StageInfo
                {
                    HitPoints = 100,
                    Rage = 3f,
                    Time = 150,
                    MaxHitPoints = 600,
                },
                new Client.Game.Interface.StageInfo
                {
                    HitPoints = 500,
                    Rage = 3f,
                    Time = 150,
                    MaxHitPoints = 600,
                },
                new Client.Game.Interface.StageInfo
                {
                    HitPoints = 500,
                    Rage = 3f,
                    Time = 150,
                    MaxHitPoints = 600,
                },
                null
            };

            Action<String, Func<Graphics.Entity>> addDialogTest = (text, dialog) =>
            {
                button = new Button
                {
                    Text = text,
                };
                buttonsGrid.AddChild(button);
                button.Click += new EventHandler((o, e) =>
                {
                    var d = dialog();
                    Program.Instance.Interface.AddChild(d);
                    System.Windows.Forms.Form f = new System.Windows.Forms.Form
                    {
                        Size = new System.Drawing.Size(200, 500)
                    };
                    var pg = new System.Windows.Forms.PropertyGrid
                    {
                        SelectedObject = d,
                        Dock = System.Windows.Forms.DockStyle.Fill
                    };
                    f.Controls.Add(pg);
                    pg.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler((o2, e2) =>
                    { d.Invalidate(); });
                    f.Show();
                });
            };

            addDialogTest("StartScreenControl", () => new Game.Interface.StartScreenControl
            {
                Anchor = Orientation.Center,
                Moveable = true,
                MapSettings = new Client.Game.Map.MapSettings
                {
                    Name = "The test map",
                },
                AvailableRangedWeapons = Program.Instance.Profile.AvailableRangedWeapons,
                AvailableMeleeWeapons = Program.Instance.Profile.AvailableMeleeWeapons
            });
            addDialogTest("CreditsText", () => new Game.Interface.CreditsText
            {
                Title = "Entertainment",
                Text = "The muppets",
            });

            addDialogTest("LargeStoneButton", () => new LargeStoneButton
            {
                Text = "Button",
                Anchor = Orientation.Center
            });

            addDialogTest("StoneButton", () => new StoneButton
            {
                Text = "Button",
                Anchor = Orientation.Center
            });

            Random random = new Random();
            var stats = new Client.Game.Statistics();
            stats.CharacterActions.ShotgunFired = 40;
            stats.CharacterActions.ShotgunSlugHits = 67;
            stats.CharacterActions.GhostRifleFired = 20;
            stats.CharacterActions.GhostRifleHits = 18;
            stats.Actions.DamageDealt = random.Next(950);
            stats.Actions.DamageTaken = random.Next(340);
            stats.Actions.HitsTaken = random.Next(34);
            stats.Actions.TimesNetted = random.Next(40);
            stats.Kills.TotalKills = random.Next(12031);
            addDialogTest("ScoreScreenControl", () => new Game.Interface.ScoreScreenControl
            {
                Anchor = Orientation.Center,
                Map = new Client.Game.Map.Map
                {
                    Settings = new Client.Game.Map.MapSettings
                    {
                        Name = "The Challenge",
                        Stages = 5
                    }
                },
                Statistics = stats,
                Moveable = true,
                EarnedGoldCoins = 1,
                LostGameReason = "You were killed by a grunt",
                GameState = Client.Game.GameState.Won,
                AchievementsEarned = new List<Achievement>
                {
                    new Achievements.Make5TriesOnASingleMap(),
                    new Achievements.Kill70ZombiesInUnder10Seconds(),
                    new Achievements.Make10TriesOnASingleMap(),
                    new Achievements.Make20TriesOnASingleMap(),
                    new Achievements.Kill100ZombiesInUnder10Seconds(),
                },
                CurrentStages = currentStages,
                BestStages = bestStages,
                SilverEnabled = Program.Settings.SilverEnabled,
                HideStats = Program.Settings.HideStats
            });

            addDialogTest("InGameMenu", () => new Game.Interface.InGameMenu
            {
                Anchor = Orientation.Center,
                MapSettings = new Client.Game.Map.MapSettings
                {
                    Name = "The test map",
                },
            });

            addDialogTest("StoneDropDownBar", () =>
                {
                    var r = new StoneDropDownBar
                        {
                            Anchor = Orientation.Center,
                        };
                    r.AddItem("hello");
                    r.AddItem("cruel");
                    r.AddItem("world which sdlf jdsf klsdfadsflksda jödaskfj lsdjf lksafdjdöf kl sdkj\n\nslkfj");
                    return r;
                });
            addDialogTest("AchievementUnlockedPopup", () => new AchievementUnlockedPopup
            {
                DisplayName = "O needs medical attention?",
                Description = "Complete \"Reverse Gauntlet\" without killing any regular chests."
            });

            addDialogTest("UnlockButton", () => new UnlockButton
            {

            });

            addDialogTest("MapButton", () =>
            {
                var mb = new MapButton
                {
                    Map = "LevelA",
                };
                Program.Instance.Tooltip.SetToolTip(mb, new MapToolTip
                    {
                        Title = "Jahman",
                        Objective = "Killin them zombies",
                        Yield = 2

                    });
                return mb;
            });

            addDialogTest("RatingBox", () => new Game.Interface.RatingBox
            {
            });

            addDialogTest("ActionTipText", () => new Game.Interface.WarningFlashText
            {
                Text = "Press space!"
            });

            addDialogTest("TutorialText", () => new Game.Interface.TutorialText
            {
                Text = "Dead Meets Lead is every bit and piece of what a zombie slaying, fast paced action game should be. Enter the role of the 18th century commander who's on a mission to obliterate the evil, by fighting your way through the islands and liberating the villagers before they are all consumed by a mystic plague. You'll have to act, think and move fast if you want to survive the horrors of these wicked parts of the world, and do not hope for any rescue or help, it's all up to you and you alone!",
                Title = "Tutorial"
            });

            addDialogTest("Dialog", () => new Dialog
            {
                Title = "Hello",
                Text = "Applications that load assemblies with this method will be affected by upgrades of those assemblies. Therefore, do not use this method; redesign the application to use the Load(String) method overload or the LoadFrom(String) method overload.",
            });

            addDialogTest("InGameMenu", () => new Game.Interface.InGameMenu
            {
            });

            addDialogTest("SpeachBubble", () => new Game.Interface.SpeachBubble
            {
                Text = "Dead Meets Lead is every bit and piece of what a zombie slaying, fast paced action game should be. Enter the role of the 18th century commander who's on a mission..."
            });

            addDialogTest("Rating", () => new Game.Interface.RatingControl
            {
                Anchor = global::Graphics.Orientation.Center
            });

            addDialogTest("StageInfo", () => new Game.Interface.StageInfoControl
            {
                Anchor = global::Graphics.Orientation.Center,
                Background = InterfaceScene.DefaultSlimBorder,
                CurrentStage = new Client.Game.Interface.StageInfo
                {
                    HitPoints = 300,
                    Rage = 2.3f,
                    Time = 200,
                    MaxHitPoints = 600
                },
                BestStage = new Client.Game.Interface.StageInfo
                {
                    HitPoints = 500,
                    Rage = 3,
                    Time = 150,
                    MaxHitPoints = 600
                }
            });
            addDialogTest("StageCompleted", () =>
                {
                    var s = new Game.Interface.StageControl
                    {
                        Anchor = global::Graphics.Orientation.Center,
                        CurrentStage = new Client.Game.Interface.StageInfo
                        {
                            HitPoints = 300,
                            Rage = 2.3f,
                            Ammo = 15,
                            Time = 200,
                            MaxHitPoints = 600,
                            Stage = 2
                        },
                        BestStage = new Client.Game.Interface.StageInfo
                        {
                            HitPoints = 200,
                            Rage = 3,
                            Ammo = 5,
                            Time = 150,
                            MaxHitPoints = 600
                        },
                        Stage = 1,
                        Clickable = true
                    };
                    s.Click += new EventHandler((o, e) =>
                    {
                        if (s.State == Client.Game.Interface.StageCompletedState.Maximized)
                            s.State = Client.Game.Interface.StageCompletedState.Minimizing;
                        else
                            s.State = Client.Game.Interface.StageCompletedState.Maximizing;
                    });
                    return s;
                }
            );
            addDialogTest("ArrowIndicator", () => new ArrowIndicator
            {
                Anchor = global::Graphics.Orientation.Center,
                Size = new Vector2(100, 100)
            });
            addDialogTest("DefaultFormBorderOutlined", () => new Form
            {
                Anchor = global::Graphics.Orientation.Center,
                Size = new Vector2(250, 140),
                Background = InterfaceScene.DefaultFormBorderOutlined,
                Moveable = true
            });
            addDialogTest("Stages", () =>
                {
                    var s = new Client.Game.Interface.StagesControl
                    {
                        Anchor = global::Graphics.Orientation.Center,
                        Size = new Vector2(1000, 140),
                        NStages = 5
                    };
                    for (int i = 0; i < s.NStages; i++)
                    {
                        s.SetBestStage(i + 1, bestStages[i]);
                        s.SetCurrentStage(i + 1, currentStages[i]);
                    }
                    s.SetActive(1, true);
                    Program.Instance.Timeout(2, () => s.Maximize(2));
                    Program.Instance.Timeout(10, () => s.Minimize(2));
                    return s;
                });
            addDialogTest("Scaling", () =>
            {
                var s = new Graphics.Interface.Control
                {
                    Background = new Graphics.Content.ImageGraphic
                    {
                        SizeMode= SizeMode.AutoAdjust,
                        Texture = new TextureFromFile("checker.png")
                    },
                    Size = new Vector2(512, 512),
                    Position = new Vector2(100, 100),
                    Updateable = true
                };
                var c = new Graphics.Interface.Control
                {
                    Background = new Graphics.Content.ImageGraphic
                    {
                        SizeMode = SizeMode.AutoAdjust,
                        Texture = new TextureFromFile("cornell.png")
                    },
                    Size = new Vector2(128, 128),
                    Position = new Vector2(100, 100),
                };
                s.AddChild(c);
                float v = 0;
                s.Update += new UpdateEventHandler((o, d) =>
                {
                    v += d.Dtime;
                    s.Scale = new Vector3((float)Math.Abs(Math.Sin(v)), (float)Math.Abs(Math.Sin(v)), 1);
                });
                return s;
            });

            addDialogTest("VideoOptionsWindow", () => new VideoOptionsWindow
            {
                AvailableAnimationQualities = new Graphics.Renderer.Settings.AnimationQualities[] { Graphics.Renderer.Settings.AnimationQualities.Low, Graphics.Renderer.Settings.AnimationQualities.Medium, Graphics.Renderer.Settings.AnimationQualities.High },
                AnimationQuality = Program.Settings.RendererSettings.AnimationQuality,
                AvailableVideoQualities = new VideoQualities[] { VideoQualities.Custom, VideoQualities.Low, VideoQualities.Medium, VideoQualities.High, VideoQualities.Ultra },
                OverallVideoQuality = Program.Settings.VideoQuality,
            });

            deviceRes = new Label
            {
                Anchor = Orientation.TopLeft,
                Size = new Vector2(70, 70),
                Position = new Vector2(0, 50)
            };

            clientRes = new Label
            {
                Anchor = Orientation.TopLeft,
                Size = new Vector2(70, 70),
                Position = new Vector2(80, 50)
            };

            windowRes = new Label
            {
                Anchor = Orientation.TopLeft,
                Size = new Vector2(70, 70),
                Position = new Vector2(240, 50)
            };

            fps = new Label
            {
                Anchor = Orientation.BottomRight,
                Size = new Vector2(70, 70),
                Position = new Vector2(160, 50)
            };

            mousePos = new Label
            {
                Anchor = Orientation.TopLeft,
                Size = new Vector2(70, 70),
                Position = new Vector2(320, 50)
            };
            #if DEBUG_DEVELOPERMAINMENU
            i++;
            s[i] = new System.IO.StreamWriter("debugRESOLUTION" + i + ".txt");
            #endif
            Program.Instance.Interface.AddChild(deviceRes);
            Program.Instance.Interface.AddChild(clientRes);
            Program.Instance.Interface.AddChild(windowRes);
            Program.Instance.Interface.AddChild(fps);
            Program.Instance.Interface.AddChild(mousePos);

            fader = new Fader { State = FadeState.FadedOut };
            Program.Instance.Interface.AddChild(fader);
        }
        public DeveloperMainMenuForm()
        {
            Anchor = Orientation.Left;
            Position = new Vector2(40, 0);
            Size = new Vector2(500, 700);
            ControlBox = false;
            Moveable = true;

            var g = new Grid
            {
                Size = Size,
                NWidth = (int)(Size.X / 200),
                NHeight = (int)(Size.Y / 20),
                Position = new Vector2(0, 0),
                Anchor = Orientation.TopLeft
            };
            AddChild(g);

            foreach (String s in Common.FileSystem.Instance.DirectoryGetFiles("Maps", "*"))
                    if (s.EndsWith(".map"))
                    {
                        string map = s.Substring("Maps/".Length);
                        var button = new Button
                        {
                            Text = map.Substring(0, map.Length - 4),
                        };
                        button.Click += new EventHandler((o, e) =>
                        {
                            Program.Instance.ProgramState = new Game.Game("Maps/" + map);
                        });
                        g.AddChild(button);

                        if (Program.Settings.DisplayMapNamesInDeveloperMenu)
                        {
                            Game.Map.MapSettings gameMap;
                            if (!loadedMaps.TryGetValue(s, out gameMap) &&
                                global::Common.FileSystem.Instance.FileExists(s))
                            {
                                try
                                {
                                    gameMap = loadedMaps[s] = Client.Game.Map.MapPersistence.Instance.LoadSettings(s);
                                }
                                catch { }
                            }
                            if (gameMap != null)
                                Program.Instance.Tooltip.SetToolTip(button, gameMap.Name);
                        }
                    }
        }
        public TestMaps()
        {
            Anchor = Orientation.Right;
            Position = new Vector2(40, 0);
            Size = new Vector2(500, 700);
            ControlBox = false;
            Moveable = true;

            var g = new Grid
            {
                Size = Size,
                NWidth = (int)(Size.X / 200),
                NHeight = (int)(Size.Y / 20),
                Position = new Vector2(0, 0),
                Anchor = Orientation.TopLeft
            };

            SortedDictionary<String, System.Reflection.MethodInfo> ms = new SortedDictionary<string, System.Reflection.MethodInfo>();

            foreach (var v in typeof(Game.TestMaps).GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public))
                ms.Add(v.Name, v);
            foreach (var k in ms)
            {
                var button = new Button
                {
                    Text = k.Value.Name,
                };
                string details = "";
                foreach (var a in Attribute.GetCustomAttributes(k.Value, true))
                    if (a is System.ComponentModel.DescriptionAttribute)
                    {
                        details = ((System.ComponentModel.DescriptionAttribute)a).Description;
                        break;
                    }
                var m = k.Value;
                button.Click += new EventHandler((o, e) =>
                {
                    Program.Instance.ProgramState = new Game.Game(
                        //() => { return
                            (Game.Map.Map)m.Invoke(null, new object[] { Program.Instance.Device9 })
                        //; }
                        );
                });
                button.MouseEnter += new EventHandler((o, e) =>
                {
                    detailsBox.Text = details;
                });
                button.MouseLeave += new EventHandler((o, e) =>
                {
                    detailsBox.Text = "";
                });
                g.AddChild(button);
            }
            AddChild(g);
            AddChild(detailsBox);
            detailsBox.Size = new Vector2(Size.X - 40, 200);
        }