public NumberInputView()
            {
                BackgroundColor = UIColor.Black.ColorWithAlpha(.5f);
                Add(numberPanel = new StackPanel {
                    Columns = 3,
                    Padding = 5,
                });

                Enumerable.Range(1, 9).ForEach(x => numberPanel.Add(createButton(x.ToString())));
                numberPanel.Add(createButton("."));
                numberPanel.Add(createButton("0"));
                numberPanel.Add(createButton("del"));

                done = new TintedButton {
                    Layer =
                    {
                        CornerRadius = 5
                    },
                    BackgroundColor   = UIColor.White,
                    Frame             = new RectangleF(0, 0, 44, 44),
                    Title             = "Done",
                    Font              = UIFont.SystemFontOfSize(30),
                    SelectedTintColor = UIColor.Black,
                    TintColor         = TintColor,
                };
                done.TouchUpInside += (object sender, EventArgs e) => {
                    EndEditing();
                };
                Add(done);
            }
Example #2
0
        public MainWindow()
        {
            Title = "Examples \u2690-\xD83C\xDFC1-\u2690";

            mouseExampleControl = new MouseExampleControl {
                PreferredSize = new Size(200, 25)
            };
            eventsExampleControl = new EventsExampleControl {
                PreferredSize = new Size(350, 250)
            };

            var dockPanel = new DockPanel();
            var menuPanel = new StackPanel {
                Orientation = StackPanelOrientation.Vertical, PreferredSize = new Size(150, 25)
            };

            dockPanel.Left = menuPanel;
            var scrollView = new ScrollView();

            dockPanel.Center = scrollView;

            var mainContent = CreateMainContent();

            scrollView.Content = mainContent;

            var performanceTestControl = new PerformanceTestControl();
            var bitmapExampleControl   = new BitmapExampleControl();

            menuPanel.Add(new Button("Main", (_, __) => scrollView.Content             = mainContent));
            menuPanel.Add(new Button("Performance Test", (_, __) => scrollView.Content = performanceTestControl));
            menuPanel.Add(new Button("Paint To Bitmap", (_, __) => scrollView.Content  = bitmapExampleControl));

            Content = dockPanel;
        }
        public VisibilityExampleControl()
        {
            RepaintMode = ControlRepaintMode.IncrementalGrowth;
            Orientation = StackPanelOrientation.Vertical;
            var p1b = new StackPanel {
                Orientation = StackPanelOrientation.Horizontal
            };
            var p2 = new StackPanel {
                Orientation = StackPanelOrientation.Vertical
            };
            var p2b = new StackPanel {
                Orientation = StackPanelOrientation.Horizontal
            };
            var tb = new TextBox {
                PreferredSize = new Size(200, 20), Text = "Test"
            };

            Add(p1b);
            Add(p2);
            p2.Add(p2b);
            p2.Add(tb);

            p1b.Add(new Button("Show", (_, __) => p2.Visibility     = ControlVisibility.Visible));
            p1b.Add(new Button("Hide", (_, __) => p2.Visibility     = ControlVisibility.Hidden));
            p1b.Add(new Button("Collapse", (_, __) => p2.Visibility = ControlVisibility.Collapsed));

            p2b.Add(new Button("Show", (_, __) => tb.Visibility     = ControlVisibility.Visible));
            p2b.Add(new Button("Hide", (_, __) => tb.Visibility     = ControlVisibility.Hidden));
            p2b.Add(new Button("Collapse", (_, __) => tb.Visibility = ControlVisibility.Collapsed));
        }
Example #4
0
        private void CreateButtons()
        {
            var stackPanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal,
            };

            var okButton = new Button()
            {
                Text = "Save",
            };

            okButton.Click += OkButtonClicked;

            var cancelButton = new Button()
            {
                Text   = "Cancel",
                Margin = new Thickness(10, 0, 0, 0),
            };

            cancelButton.Click += CancelButtonClicked;

            stackPanel.Add(okButton);
            stackPanel.Add(cancelButton);

            stackPanel.SetGridProperties(8, 0);
            _grid.Add(stackPanel);
        }
Example #5
0
        /// <summary>
        /// Creates a new BestScore panel.
        /// </summary>
        /// <param name="y">The y of the new element.</param>
        /// <param name="score">The score of the new element.</param>
        /// <returns></returns>
        public static StackPanel CreateBestScore(int y, int score)
        {
            var stackPanelScore = new StackPanel()
            {
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                Orientation         = WaveEngine.Components.UI.Orientation.Horizontal,
                Margin = new Thickness(
                    0,
                    y,
                    0,
                    0)
            };

            var bestScoreText = new Image(WaveContent.Assets.Menus.best_score_png);

            var bestScoreNumber = new TextBlock()
            {
                FontPath      = WaveContent.Assets.Fonts.BadaBoom_BB_wpk,
                Text          = score.ToString(),
                TextAlignment = WaveEngine.Components.UI.TextAlignment.Right,
                Width         = 50,
            };

            stackPanelScore.Add(bestScoreText);
            stackPanelScore.Add(bestScoreNumber);

            return(stackPanelScore);
        }
        private StackPanel CreateBadge(IAchievement achievement, EntityManager entityManager)
        {
            var background = new StackPanel("badge")
            {
                Width = WaveServices.Platform.ScreenWidth, Height = 150, DrawOrder = 1
            };

            var headline = new TextBlock()
            {
                Text = "Achievement completed!",
            };

            var title = new TextBlock()
            {
                Text = achievement.Title,
            };

            var description = new TextBlock()
            {
                Text = achievement.Description,
            };

            var dismissButton = new Button()
            {
                Text = "Dismiss",
            };

            dismissButton.Click += (sender, args) => entityManager.Remove("badge");

            background.Add(headline);
            background.Add(title);
            background.Add(description);

            return(background);
        }
Example #7
0
        /// <summary>
        /// Creates a new BestScore panel.
        /// </summary>
        /// <param name="y">The y of the new element.</param>
        /// <param name="score">The score of the new element.</param>
        /// <returns></returns>
        public static StackPanel CreateBestScore(int y, int score)
        {
            var stackPanelScore = new StackPanel()
            {
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                Orientation         = WaveEngine.Components.UI.Orientation.Horizontal,
                Margin = new Thickness(
                    0,
                    y,
                    0,
                    0)
            };

            var bestScoreText = new Image(Textures.BEST_SCORE);

            var bestScoreNumber = new TextBlock()
            {
                FontPath      = Fonts.SMALL_SCORE,
                Text          = score.ToString(),
                TextAlignment = WaveEngine.Components.UI.TextAlignment.Right,
                Width         = 50,
            };

            stackPanelScore.Add(bestScoreText);
            stackPanelScore.Add(bestScoreNumber);

            return(stackPanelScore);
        }
Example #8
0
        public override void StartProgram()
        {
            Console.WriteLine("Start Menu");
            base.StartProgram();
            ListView listView = new ListView("MainScroller");

            listView.FixedHeight = 32;
            listView.FixedWidth  = 32;

            foreach (var a in applications)
            {
                StackPanel stackPanel = new StackPanel();
                stackPanel.Orientation = Orientation.Horizontal;
                Label l = new Label(a.Name, font, CanvasColor.WHITE);
                if (a.Stream != null)
                {
                    Image i = new Image(a.Stream);
                    i.X = 1;
                    i.Y = 1;
                    stackPanel.Add(i);
                    l.X = 2;
                }

                stackPanel.Add(l);

                listView.Add(stackPanel);
            }

            View = listView;

            Controls.Instance.OnButtonClick("ScrollerBtn", KnobClicked);
        }
Example #9
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

            camera2d.ClearFlags = ClearFlags.DepthAndStencil;
            EntityManager.Add(camera2d);

            // Music Player
            MusicInfo musicInfo = new MusicInfo("Content/audiodolby.mp3");

            WaveServices.MusicPlayer.Play(musicInfo);
            WaveServices.MusicPlayer.IsRepeat = true;

            WaveServices.MusicPlayer.Play(new MusicInfo("Content/audiodolby.mp3"));
            WaveServices.MusicPlayer.IsDolbyEnabled = true;
            WaveServices.MusicPlayer.DolbyProfile   = DolbyProfiles.GAME;

            // Button Stack Panel
            buttonPanel = new StackPanel();
            buttonPanel.Entity.AddComponent(new AnimationUI());
            buttonPanel.VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Center;
            buttonPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            // Enable/Disable Dolby Button
            this.CreateButton(out this.enableDolbyButton, string.Empty, this.EnableDolbyButtonClick);
            buttonPanel.Add(this.enableDolbyButton);

            // Profile Buttons
            this.CreateButton(out this.profileGameButton, WaveEngine.Common.Media.DolbyProfiles.GAME.ToString(), this.ProfileGameButtonClick);
            buttonPanel.Add(this.profileGameButton);
            this.CreateButton(out this.profileMovieButton, WaveEngine.Common.Media.DolbyProfiles.MOVIE.ToString(), this.ProfileMovieButtonClick);
            buttonPanel.Add(this.profileMovieButton);
            this.CreateButton(out this.profileMusicButton, WaveEngine.Common.Media.DolbyProfiles.MUSIC.ToString(), this.ProfileMusicButtonClick);
            buttonPanel.Add(this.profileMusicButton);
            this.CreateButton(out this.profileVoiceButton, WaveEngine.Common.Media.DolbyProfiles.VOICE.ToString(), this.ProfileVoiceButtonClick);
            buttonPanel.Add(this.profileVoiceButton);
            EntityManager.Add(buttonPanel);

            // Information Text
            infoPanel = new StackPanel();
            infoPanel.Entity.AddComponent(new AnimationUI());
            infoPanel.VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom;
            infoPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            infoPanel.Orientation = Orientation.Vertical;
            this.CreateLabel(out this.isDolbyEnabledTextBox, string.Empty);
            infoPanel.Add(this.isDolbyEnabledTextBox);
            this.CreateLabel(out this.selectedDolbyProfileTextBox, string.Empty);
            infoPanel.Add(this.selectedDolbyProfileTextBox);
            EntityManager.Add(infoPanel);

            // Sets text
            this.SetDolbyText();

            //// Animations
            this.fadeIn = new SingleAnimation(0.0f, 1.0f, TimeSpan.FromSeconds(8), EasingFunctions.Cubic);
        }
Example #10
0
        private Control CreateMainContent()
        {
            StackPanel hPanel1 = new StackPanel {
                Orientation = StackPanelOrientation.Horizontal
            };
            StackPanel hPanel2 = new StackPanel {
                Orientation = StackPanelOrientation.Horizontal
            };
            StackPanel vPanel = new StackPanel {
                Orientation = StackPanelOrientation.Vertical
            };

            vPanel.Add(hPanel1);
            vPanel.Add(hPanel2);

            var drawingExampleControl = new DrawingExampleControl {
                PreferredSize = new Size(200, 250)
            };

            hPanel1.Add(drawingExampleControl);

            var vPanel3 = new StackPanel {
                Orientation = StackPanelOrientation.Vertical
            };

            vPanel3.Add(new VisibilityExampleControl());
            vPanel3.Add(new TextExampleControl {
                PreferredSize = new Size(600, 220)
            });
            hPanel1.Add(vPanel3);

            hPanel2.Add(mouseExampleControl);
            hPanel2.Add(eventsExampleControl);
            var vPanel2 = new StackPanel {
                Orientation = StackPanelOrientation.Vertical
            };

            hPanel2.Add(vPanel2);
            vPanel2.Add(new TextBox {
                PreferredSize = new Size(200, 20), Text = "TextBox Test 1"
            });
            var textBox2 = new TextBox {
                PreferredSize = new Size(200, 20), Text = "TextBox Test 2"
            };

            vPanel2.Add(textBox2);
            var hPanel3 = new StackPanel {
                Orientation = StackPanelOrientation.Horizontal
            };

            vPanel2.Add(hPanel3);
            hPanel3.Add(new Button("+A", (_, __) => textBox2.Text += "A"));
            hPanel3.Add(new Button("+B", (_, __) => textBox2.Text += "B"));

            return(vPanel);
        }
Example #11
0
 public void Icon(Icon icon, T value, string toolTip)
 {
     _panel.Add <ToggleButton>(x =>
     {
         x.ToIconButton(icon, () => _parent.selectValue(value, x));
         x.ToolTip = toolTip;
         x.Margin  = new System.Windows.Thickness(2);
         _parent._buttons[value] = x;
     });
 }
Example #12
0
        private void CreateLoginPanel()
        {
            // Login
            var login = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Login into service",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
            };

            login.Click += async(s, e) =>
            {
                var properties = new Dictionary <string, string>();
                _socialService.Initialize(properties);
                var loggedIn = await _socialService.Login();

                if (!loggedIn)
                {
                    await WaveServices.Platform.ShowMessageBoxAsync("Error", "Not logged in");
                }
            };

            // Logout
            var logout = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Logout",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
                Margin          = new Thickness(_spaceControl, 0, 0, 0)
            };

            logout.Click += async(s, e) => { await _socialService.Logout(); };

            var sp1 = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(_leftMargin, _topMargin, 0, 0),
            };

            sp1.Add(login);
            sp1.Add(logout);

            EntityManager.Add(sp1);
        }
Example #13
0
        public void DrawListBox()
        {
            _panel = new StackPanel
            {
                Orientation = Orientation,
                Margin      = new Thickness(Margin.Left + PosX, Margin.Top + PosY, Margin.Right, Margin.Bottom)
            };
            _panel.Entity.FindComponent <StackPanelRenderer>().LayerType = DefaultLayers.Alpha;

            foreach (var text in _listString)
            {
                var item = new TextBlock
                {
                    Text       = text,
                    Margin     = new Thickness(0, 5, 0, 0),
                    Foreground = Foreground,
                    Height     = ItemHeight
                };
                if (!string.IsNullOrWhiteSpace(FontPath))
                {
                    item.FontPath = FontPath;
                }
                item.Entity.FindChild("TextEntity").FindComponent <TextControlRenderer>().LayerType = DefaultLayers.Alpha;
                _panel.Add(item);
            }
        }
Example #14
0
        public void TestRemoveChildValidation()
        {
            var c1 = new StackPanel();
            var c2 = new StackPanel();
            var c3 = new StackPanel();

            c1.Add(c2);
            c2.Add(c3);

            Assert.That(() => c1.Remove(c1), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));
            Assert.That(() => c1.Remove(c3), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));

            Assert.That(() => c2.Remove(c1), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));
            Assert.That(() => c2.Remove(c2), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));

            Assert.That(() => c3.Remove(c1), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));
            Assert.That(() => c3.Remove(c2), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));
            Assert.That(() => c3.Remove(c3), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));

            c1.Remove(c2);
            c2.Remove(c3);

            Assert.That(() => c1.Remove(c2), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));
            Assert.That(() => c2.Remove(c3), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control is not a child of this control."));
        }
Example #15
0
        public void TestOrientationChanged()
        {
            var root = new StackPanel {
                Orientation = StackPanelOrientation.Horizontal
            };
            var textBox = new TextBox {
                PreferredSize = new Size(100, 20)
            };

            root.Area = new Rectangle(0, 0, 2000, 1000);
            root.Add(textBox);

            root.Update();

            Assert.That(root.ContentSize, Is.EqualTo(new Size(100, 20)));
            Assert.That(root.Area, Is.EqualTo(new Rectangle(0, 0, 2000, 1000)));

            Assert.That(textBox.ContentSize, Is.EqualTo(new Size(100, 20)));
            Assert.That(textBox.Area, Is.EqualTo(new Rectangle(0, 0, 100, 1000)));

            root.Orientation = StackPanelOrientation.Vertical;
            root.Update();

            Assert.That(root.ContentSize, Is.EqualTo(new Size(100, 20)));
            Assert.That(root.Area, Is.EqualTo(new Rectangle(0, 0, 2000, 1000)));

            Assert.That(textBox.ContentSize, Is.EqualTo(new Size(100, 20)));
            Assert.That(textBox.Area, Is.EqualTo(new Rectangle(0, 0, 2000, 20)));
        }
Example #16
0
                static void MakeChildrenScrollable(StackPanel s)
                {
                    var children = new DependencyObject[s.Children.Count];
                    var i        = -1;

                    foreach (DependencyObject n in s.Children)
                    {
                        children[++i] = n;
                    }
                    s.Children.Clear();
                    foreach (var c in children)
                    {
                        var d = c as ThemedTipDocument;
                        if (d != null)
                        {
                            foreach (var item in d.Children)
                            {
                                //(item as FrameworkElement)?.LimitSize();
                                if (item is TextBlock t)
                                {
                                    t.TextWrapping = TextWrapping.Wrap;
                                }
                            }
                            d.ApplySizeLimit();
                            d.WrapMargin(WpfHelper.SmallVerticalMargin);
                        }
                        s.Add(c.Scrollable().LimitSize());
                    }
                }
Example #17
0
        public override void StartProgram()
        {
            base.StartProgram();
            Console.WriteLine("Start Clock");

            StackPanel time = new StackPanel();

            time.X = 4;
            time.Y = 3;

            hours = new Label(" 00", font, CanvasColor.WHITE);

            time.Add(hours);

            StackPanel dotsMinutes = new StackPanel();

            dotsMinutes.Orientation = Orientation.Horizontal;

            dots    = new Label(":", font, CanvasColor.WHITE);
            minutes = new Label("00", font, CanvasColor.WHITE);

            dotsMinutes.Add(dots);
            dotsMinutes.Add(minutes);

            time.Add(dotsMinutes);

            t          = new Timer();
            t.Interval = 500;
            t.Elapsed += (s, a) =>
            {
                Console.WriteLine(dots.Text);
                if (an)
                {
                    dots.Text = " ";
                    an        = false;
                }
                else
                {
                    dots.Text = ":";
                    an        = true;
                }
            };
            t.Start();

            View = time;
        }
Example #18
0
        private void AddButton(string title)
        {
            Button button = new Button(new TextBlock(title), title);

            button.Margin = new Margin(20);
            button.Click += Button_Click;
            Buttons.Add(button);
        }
Example #19
0
        public void TestLoopDetection()
        {
            var c1 = new StackPanel();
            var c2 = new StackPanel();
            var c3 = new StackPanel();

            c1.Add(c2);
            c2.Add(c3);

            Assert.That(() => c1.Add(c1), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("Control cannot contain itself or its own parent."));
            Assert.That(() => c2.Add(c1), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("Control cannot contain itself or its own parent."));
            Assert.That(() => c3.Add(c1), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("Control cannot contain itself or its own parent."));

            Assert.That(() => c1.Add(c2), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control already has parent."));
            Assert.That(() => c1.Add(c3), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control already has parent."));
            Assert.That(() => c2.Add(c2), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control already has parent."));
            Assert.That(() => c2.Add(c3), Throws.Exception.TypeOf <InvalidOperationException>().And.Message.EqualTo("The given control already has parent."));
        }
Example #20
0
        private void CreateLeaderBoardByCodePanel()
        {
            var leaderboardlabel = new TextBlock()
            {
                Text  = "Enter leaderboard code:",
                Width = 200,
            };
            var leaderboardCodeText = new TextBox()
            {
                Text   = string.Empty,
                Height = 60,
                Width  = _buttonWidth,
                Margin = new Thickness(_spaceControl, 0, 0, 0)
            };

            // Show leaderboard by code
            var leaderboardCodeButton = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Show leaderboard by code",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
                Margin          = new Thickness(_spaceControl, 0, 0, 0)
            };

            leaderboardCodeButton.Click += (s, e) =>
            {
                var code = leaderboardCodeText.Text;
                _socialService.ShowLeaderboard(code);
            };

            var sp4 = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(100, _topMargin + 5, 0, 0),
            };

            sp4.Add(leaderboardlabel);
            sp4.Add(leaderboardCodeText);
            sp4.Add(leaderboardCodeButton);

            EntityManager.Add(sp4);
        }
Example #21
0
        private void AchievementsByCodePanel()
        {
            var unlockAchievementlabel = new TextBlock()
            {
                Text  = "Enter achievement code:",
                Width = 200,
            };
            var unlockAchievementText = new TextBox()
            {
                Text   = string.Empty,
                Height = 60,
                Width  = _buttonWidth,
                Margin = new Thickness(_spaceControl, 0, 0, 0)
            };

            // Unlock achievement by code
            var unlockAchievementCodeButton = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Unlock achievement by code",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
                Margin          = new Thickness(_spaceControl, 0, 0, 0)
            };

            unlockAchievementCodeButton.Click += async(s, e) =>
            {
                var code = unlockAchievementText.Text;
                await _socialService.UnlockAchievement(code);
            };

            var sp3 = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(100, _topMargin + 5, 0, 0),
            };

            sp3.Add(unlockAchievementlabel);
            sp3.Add(unlockAchievementText);
            sp3.Add(unlockAchievementCodeButton);

            EntityManager.Add(sp3);
        }
Example #22
0
        public static StackPanel AddText(this StackPanel panel, string text, Action <Label> action)
        {
            var label = panel.Add <Label>();

            label.Content = text;

            action(label);

            return(panel);
        }
Example #23
0
        public void Test()
        {
            var panel    = new StackPanel();
            var textBox1 = new TextBox();
            var textBox2 = new TextBox();
            var textBox3 = new TextBox();

            panel.Add(textBox1);
            panel.Add(textBox2);
            panel.Add(textBox3);

            Window window = new Window();

            window.Content = panel;

            Assert.That(window.FocusedControl, Is.EqualTo(textBox1));

            window.MoveFocus(true);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox2));

            window.MoveFocus(true);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox3));

            window.MoveFocus(true);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox1));

            window.MoveFocus(false);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox3));

            window.MoveFocus(false);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox2));

            window.MoveFocus(false);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox1));

            panel.Remove(textBox1);

            // todo: it may not be a desired behaviour
            Assert.That(window.FocusedControl, Is.Null);

            window.MoveFocus(true);
            Assert.That(window.FocusedControl, Is.EqualTo(textBox2));
        }
Example #24
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

            camera2d.BackgroundColor = Color.Gray;
            EntityManager.Add(camera2d);

            // Panel
            stackPanel = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Width  = 400,
                Height = 400,
            };
            EntityManager.Add(stackPanel.Entity);

            // Elements
            Button button;

            for (int i = 0; i < 4; i++)
            {
                button = new Button()
                {
                    Text = i.ToString(),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width           = 100,
                    Height          = 100,
                    Foreground      = Color.Yellow,
                    BackgroundColor = Color.Red,
                };
                stackPanel.Add(button);
            }

            // Set Orientation
            Button button1 = new Button()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Text            = "Change Orientation",
                Width           = 200,
                Margin          = new Thickness(20),
                Foreground      = Color.LightPink,
                BackgroundColor = Color.Purple,
                BorderColor     = Color.LightPink,
            };

            button1.Click += b_Click;
            EntityManager.Add(button1.Entity);

            // Debug
            this.CreateDebugMode();
        }
Example #25
0
        public SymbolFilterBox(ISymbolFilterable filter)
        {
            Orientation = Orientation.Horizontal;
            Margin      = WpfHelper.MenuItemMargin;
            Children.Add(ThemeHelper.GetImage(IconIds.Filter).WrapMargin(WpfHelper.GlyphMargin));
            Children.Add(_FilterBox = new ThemedTextBox {
                MinWidth = 150,
                Margin   = WpfHelper.GlyphMargin,
                ToolTip  = new ThemedToolTip(R.T_ResultFilter, R.T_ResultFilterTip)
            });
            Children.Add(new Border {
                BorderThickness = WpfHelper.TinyMargin,
                CornerRadius    = new CornerRadius(3),
                Child           = _FilterContainer = new StackPanel {
                    Orientation = Orientation.Horizontal
                }
            }.ReferenceProperty(Border.BorderBrushProperty, CommonControlsColors.TextBoxBorderBrushKey));
            switch (filter.SymbolFilterKind)
            {
            case SymbolFilterKind.Type:
                _FilterGroups = new FilterButtonGroup[] { new AccessibilityFilterButtonGroup(), new TypeFilterButtonGroup() };
                break;

            case SymbolFilterKind.Usage:
                _FilterGroups = new FilterButtonGroup[] { new AccessibilityFilterButtonGroup(), new SymbolUsageFilterButtonGroup(), new MemberFilterButtonGroup() };
                break;

            default:
                _FilterGroups = new FilterButtonGroup[] { new AccessibilityFilterButtonGroup(), new MemberFilterButtonGroup() };
                break;
            }
            _FilterContainer.Add(_FilterGroups);
            _FilterContainer.Add(new ThemedButton(IconIds.ClearFilter, R.CMD_ClearFilter, ClearFilters).ClearBorder());
            _Filter = filter;
            foreach (var item in _FilterGroups)
            {
                item.FilterChanged += FilterBox_Changed;
            }
            _FilterBox.TextChanged += FilterBox_Changed;
            _FilterBox.SetOnVisibleSelectAll();
        }
Example #26
0
        private void AddHighscoreEntries(IEnumerable <HighscoreEntry> items, StackPanel panelToInsert)
        {
            foreach (var item in items)
            {
                var entry = new TextBlock()
                {
                    Text = String.Format("{0}: {1} ({2})", item.Name, item.Points, item.Level),
                };

                panelToInsert.Add(entry);
            }
        }
Example #27
0
        private void CreateLeaderBoardsAndAchievementsPanel()
        {
            // Show Leaderboards
            var leaderboards = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Show all leaderboards",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
            };

            leaderboards.Click += (s, e) => { _socialService.ShowAllLeaderboards(); };

            // Show Achievements
            var achievements = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Show all achievements",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
                Margin          = new Thickness(_spaceControl, 0, 0, 0)
            };

            achievements.Click += (s, e) => { _socialService.ShowAchievements(); };

            var sp2 = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(_leftMargin, _topMargin, 0, 0),
            };

            sp2.Add(leaderboards);
            sp2.Add(achievements);

            EntityManager.Add(sp2);
        }
Example #28
0
        public ScorePanel(string name)
        {
            StackPanel stack = new StackPanel(name)
            {
                Width  = (int)WaveServices.ViewportManager.VirtualWidth,
                Height = 76,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Orientation         = Orientation.Horizontal,
                Margin = new Thickness(10),
            };


            stack.Add(new Image(WaveContent.Assets.Textures.starfish_png)
            {
                Width             = 70,
                Height            = 70,
                Stretch           = Stretch.Fill,
                DrawOrder         = 0.1f,
                VerticalAlignment = VerticalAlignment.Center,
                Margin            = new Thickness(5),
            });

            this.scoreText = new TextBlock("scoresText")
            {
                Width             = 80,
                FontPath          = WaveContent.Assets.Fonts.Bulky_Pixels_26_TTF,
                VerticalAlignment = VerticalAlignment.Center,
                TextAlignment     = WaveEngine.Components.UI.TextAlignment.Center,
                Margin            = new Thickness(5, 10, 5, 5),
                DrawOrder         = 0.1f,
            };
            stack.Add(this.scoreText);

            this.entity = stack.Entity;

            this.Score = 0;
        }
Example #29
0
        public void Test()
        {
            var root = new StackPanel();
            var c1   = new StackPanel();
            var c2   = new StackPanel();
            var c11  = new StackPanel();
            var c12  = new StackPanel();
            var c21  = new StackPanel();
            var c22  = new StackPanel();

            root.Add(c1);
            root.Add(c2);
            c1.Add(c11);
            c1.Add(c12);
            c2.Add(c21);
            c2.Add(c22);

            List <Control> directOrder = new List <Control>();
            Control        c           = root;

            for (int i = 0; i < 8; i++, c = ControlTreeWalker.GetNextControl(c))
            {
                directOrder.Add(c);
            }

            Assert.That(directOrder.ToArray(), Is.EqualTo(new Control[] { root, c1, c11, c12, c2, c21, c22, root }));

            List <Control> reverseOrder = new List <Control>();

            c = root;
            for (int i = 0; i < 8; i++, c = ControlTreeWalker.GetPreviousControl(c))
            {
                reverseOrder.Add(c);
            }

            Assert.That(reverseOrder.ToArray(), Is.EqualTo(new Control[] { root, c22, c21, c2, c12, c11, c1, root }));
        }
Example #30
0
        public void Add(View view)
        {
            _stackPanel.Add(view);
            Height = FixedHeight == 0 ? _stackPanel.Height : FixedHeight;
            Width  = FixedWidth == 0 ? _stackPanel.Width + 1 : FixedWidth;
            if (FixedWidth != 0)
            {
                _stackPanel.Width = _fixedWidth - 1;
            }

            foreach (var v in _stackPanel.Items)
            {
                v.Width = _stackPanel.Width;
            }
        }
        public void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(fluidSimulation1.Services, "Content");
            }

            GlassBox glassBox = new GlassBox();
            glassBox.LoadContent(content);

            Fluid = new Fluid(2000, glassBox);
            Fluid.ActiveParticles = 500;

            surfaceTensionSlider = new Slider("Surface Tension: ", 0, 100, Fluid.SurfaceTension, 2);
            surfaceTensionSlider.OnValueChanged += new EventHandler(surfaceTensionSlider_OnValueChanged);
            surfaceTensionSlider.Length = 200;

            viscositySlider = new Slider("Viscosity: ", 0, 100, Fluid.Viscosity, 2);
            viscositySlider.OnValueChanged += new EventHandler(viscositySlider_OnValueChanged);
            viscositySlider.Length = 200;

            massSlider = new Slider("Particle Mass: ", 1, 20, Fluid.ParticleMass, 2);
            massSlider.OnValueChanged += new EventHandler(massSlider_OnValueChanged);
            massSlider.Length = 200;

            particlesSlider = new Slider("Particles: ", 1, Fluid.MaxParticles, Fluid.ActiveParticles, 0);
            particlesSlider.OnValueChanged += new EventHandler(particlesSlider_OnValueChanged);
            particlesSlider.Length = 200;

            timestepSlider = new Slider("Timestep: ", 1, 5, 1, 2);
            timestepSlider.OnValueChanged += new EventHandler(timestepSlider_OnValueChanged);
            timestepSlider.Length = 200;

            rotationSpeedSlider = new Slider("Rotation speed: ", -0.025f, 0.025f, rotationSpeed, 3);
            rotationSpeedSlider.OnValueChanged += new EventHandler(rotationSpeedSlider_OnValueChanged);
            rotationSpeedSlider.Length = 200;

            guiElements = new StackPanel(40);
            guiElements.Add(surfaceTensionSlider);
            guiElements.Add(viscositySlider);
            guiElements.Add(massSlider);
            guiElements.Add(particlesSlider);
            guiElements.Add(timestepSlider);
            guiElements.Add(rotationSpeedSlider);

            restartButton = new Button("Restart", FluidSimulation1.Font);
            restartButton.OnClick += new EventHandler(restartButton_OnClick);
            guiElements.Add(restartButton);

            debugGrid = new DebugGrid(fluidSimulation1.GraphicsDevice);

            guiElements.Font = FluidSimulation1.Font;
            guiElements.LoadContent(content);

            fluidRenderer = new FluidRendererMarchingCubes(Fluid, fluidSimulation1.GraphicsDevice);

            marchingCubesEffect = new BasicEffect(fluidSimulation1.GraphicsDevice);
        }