private void reset()
        {
            doNotAddChildren = false;
            scheduledAdder?.Cancel();

            Child = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Width            = 0.2f,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
                Depth            = float.MinValue,
                Children         = new[]
                {
                    new FillFlowContainer
                    {
                        Direction        = FillDirection.Vertical,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            new SpriteText {
                                Text = @"Fill mode"
                            },
                            selectionDropdown = new FillDirectionDropdown
                            {
                                RelativeSizeAxes = Axes.X,
                                Items            = Enum.GetValues(typeof(FlowTestCase)).Cast <FlowTestCase>()
                                                   .Select(value => new KeyValuePair <string, FlowTestCase>(value.ToString(), value)),
                            },
                            new SpriteText {
                                Text = @"Child anchor"
                            },
                            anchorDropdown = new AnchorDropdown
                            {
                                RelativeSizeAxes = Axes.X,
                                Items            = new[]
                                {
                                    Anchor.TopLeft,
                                    Anchor.TopCentre,
                                    Anchor.TopRight,
                                    Anchor.CentreLeft,
                                    Anchor.Centre,
                                    Anchor.CentreRight,
                                    Anchor.BottomLeft,
                                    Anchor.BottomCentre,
                                    Anchor.BottomRight,
                                }.Select(anchor => new KeyValuePair <string, Anchor>(anchor.ToString(), anchor)),
                            },
                            new SpriteText {
                                Text = @"Child origin"
                            },
                            originDropdown = new AnchorDropdown
                            {
                                RelativeSizeAxes = Axes.X,
                                Items            = new[]
                                {
                                    Anchor.TopLeft,
                                    Anchor.TopCentre,
                                    Anchor.TopRight,
                                    Anchor.CentreLeft,
                                    Anchor.Centre,
                                    Anchor.CentreRight,
                                    Anchor.BottomLeft,
                                    Anchor.BottomCentre,
                                    Anchor.BottomRight,
                                }.Select(anchor => new KeyValuePair <string, Anchor>(anchor.ToString(), anchor)),
                            },
                        }
                    }
                }
            };

            selectionDropdown.Current.ValueChanged += changeTest;
            buildTest();
            selectionDropdown.Current.Value = FlowTestCase.Full;
            changeTest(FlowTestCase.Full);
        }
Esempio n. 2
0
        public override void Reset()
        {
            base.Reset();

            scheduledAdder?.Cancel();

            Add(new Container
            {
                RelativeSizeAxes = Axes.Both,
                Width            = 0.2f,
                Anchor           = Anchor.TopRight,
                Origin           = Anchor.TopRight,
                Depth            = float.MinValue,
                Children         = new[]
                {
                    new FillFlowContainer
                    {
                        Direction        = FillDirection.Vertical,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            new SpriteText {
                                Text = @"Fill mode"
                            },
                            selectionDropdown = new FillDirectionDropdown
                            {
                                RelativeSizeAxes = Axes.X,
                                Items            = Enum.GetValues(typeof(FlowTestCase)).Cast <FlowTestCase>()
                                                   .Select(value => new KeyValuePair <string, FlowTestCase>(value.ToString(), value)),
                            },
                            new SpriteText {
                                Text = @"Child anchor"
                            },
                            anchorDropdown = new AnchorDropdown
                            {
                                RelativeSizeAxes = Axes.X,
                                Items            = new[]
                                {
                                    Anchor.TopLeft,
                                    Anchor.TopCentre,
                                    Anchor.TopRight,
                                    Anchor.CentreLeft,
                                    Anchor.Centre,
                                    Anchor.CentreRight,
                                    Anchor.BottomLeft,
                                    Anchor.BottomCentre,
                                    Anchor.BottomRight,
                                }.Select(anchor => new KeyValuePair <string, Anchor>(anchor.ToString(), anchor)),
                            },
                            new SpriteText {
                                Text = @"Child origin"
                            },
                            originDropdown = new AnchorDropdown
                            {
                                RelativeSizeAxes = Axes.X,
                                Items            = new[]
                                {
                                    Anchor.TopLeft,
                                    Anchor.TopCentre,
                                    Anchor.TopRight,
                                    Anchor.CentreLeft,
                                    Anchor.Centre,
                                    Anchor.CentreRight,
                                    Anchor.BottomLeft,
                                    Anchor.BottomCentre,
                                    Anchor.BottomRight,
                                }.Select(anchor => new KeyValuePair <string, Anchor>(anchor.ToString(), anchor)),
                            },
                        }
                    }
                }
            });

            selectionDropdown.Current.ValueChanged += newValue =>
            {
                if (current == newValue)
                {
                    return;
                }

                current = newValue;
                Reset();
            };

            selectionDropdown.Current.Value = current;
            changeTest(current);
        }