Progress bar decorate class
Inheritance: UIBase
示例#1
0
文件: MyScene.cs 项目: noatom/Samples
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;

            // Adds record button.
            this.recordButton = new Button("recordButton")
            {
                Text = STARTTEXT,
                Margin = new WaveEngine.Framework.UI.Thickness(100),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top
            };

            this.recordButton.Click += OnRecordButtonClicked;
            this.EntityManager.Add(this.recordButton);

            // Adds play button
            this.playButton = new Button("playButton")
            {
                Text = PLAYTEXT,
                Margin = new WaveEngine.Framework.UI.Thickness(100),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                IsVisible = false
            };
            this.playButton.Click += OnPlayButtonClicked;
            this.EntityManager.Add(this.playButton);

            // Shows error label if microphone is not available
            if (!WaveServices.Microphone.IsConnected)
            {
                TextBlock errorText = new TextBlock()
                {
                    Text = ERROREXT,
                    HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                    VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                    Margin = new WaveEngine.Framework.UI.Thickness(50)
                };

                this.EntityManager.Add(errorText);
            }

            this.progressBar = new ProgressBar()
            {
                Maximum = 255,
                Minimum = 0,
                Value = 0,
                Width = 400,
                Height = 10,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                IsVisible = false
            };

            this.EntityManager.Add(this.progressBar);

            //Register bank
            this.bank = new SoundBank(this.Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(this.bank);
        }
示例#2
0
        public HubPanel()
        {
            Grid grid = new Grid("HubPanel")
            {
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Width = 800,
                Height = 40,
            };

            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });

            Image background = new Image(WaveContent.Assets.Textures.hubBackground_png);
            background.SetValue(GridControl.RowProperty, 0);
            background.SetValue(GridControl.ColumnProperty, 0);
            grid.Add(background);

            // Life
            this.progressBar = new ProgressBar()
            {
                Height = 25,
                Width = 300,
                Foreground = Color.Gold,
                Background = Color.Red,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                DrawOrder = -1
            };

            progressBar.SetValue(GridControl.RowProperty, 0);
            progressBar.SetValue(GridControl.ColumnProperty, 0);
            grid.Add(progressBar);

            // Murders
            this.murdersText = new TextBlock()
            {
                DrawOrder = -1,
                FontPath = WaveContent.Assets.Fonts.Coalition_16_ttf, 
                Text = "#00",
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
            };

            murdersText.SetValue(GridControl.RowProperty, 0);
            murdersText.SetValue(GridControl.ColumnProperty, 1);
            grid.Add(murdersText);

            this.entity = grid.Entity;

        }
示例#3
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Gray;
            //RenderManager.DebugLines = true;

            // Progress 1
            int progress1Top = 20;
            int spacing = 40;
            textblock1 = new TextBlock()
            {
                Margin = new Thickness(20, progress1Top, 0, 0),
                Text = "Range: [0, 100] Value = 23",
            };
            EntityManager.Add(textblock1.Entity);

            progressbar1 = new ProgressBar()
            {
                Margin = new Thickness(20, progress1Top + spacing, 0, 0),
                Width = 360,
                Value = 23,
            };
            EntityManager.Add(progressbar1.Entity);

            // Progress 2
            int progress2Top = 120;
            textblock2 = new TextBlock()
            {
                Margin = new Thickness(20, progress2Top, 0, 0),
                Text = "Range: [-21, 300] Value= -5",
            };
            EntityManager.Add(textblock2.Entity);

            progressbar2 = new ProgressBar()
            {
                Margin = new Thickness(20, progress2Top + spacing, 0, 0),
                Width = 360,
                Minimum = -21,
                Maximum = 300,
                Value = -5,
                Foreground = Color.OliveDrab,
                Background = Color.LightGreen,
            };
            EntityManager.Add(progressbar2.Entity);

            // Progress 3
            int progress3Top = 220;
            textblock3 = new TextBlock()
            {
                Margin = new Thickness(20, progress3Top, 0, 0),
                Text = "Range: [400, 600] InitValue: 580",
            };
            EntityManager.Add(textblock3.Entity);

            progressbar3 = new ProgressBar()
            {
                Margin = new Thickness(20, progress3Top + spacing, 0, 0),
                Width = 360,
                Minimum = 400,
                Maximum = 600,
                Value = 580,
                Foreground = Color.Purple,
                Background = Color.LightPink,
            };
            progressbar3.ValueChanged += progressbar3_ValueChanged;
            EntityManager.Add(progressbar3.Entity);

            button1 = new Button()
            {
                Margin = new Thickness(20, progress3Top + spacing * 2, 0, 0),
                Text = "Down",
                Foreground = Color.Gray,
                BackgroundColor = Color.LightBlue,
                BorderColor = Color.LightBlue,
            };
            button1.Click += button1_Click;
            EntityManager.Add(button1.Entity);

            info1 = new TextBlock()
            {
                Margin = new Thickness(20, progress3Top + spacing * 3, 0, 0),
                Text = string.Empty,
                Foreground = Color.Purple,
            };
            EntityManager.Add(info1.Entity);

            // Progress 4
            int progress4Top = 380;
            textblock4 = new TextBlock()
            {
                Margin = new Thickness(20, progress4Top, 0, 0),
                Text = "Range: [-300, -100] InitValue: -280",
            };
            EntityManager.Add(textblock4.Entity);

            progressbar4 = new ProgressBar()
            {
                Margin = new Thickness(20, progress4Top + spacing, 0, 0),
                Width = 360,
                Minimum = -300,
                Maximum = -100,
                Value = -280,
                Foreground = Color.Purple,
                Background = Color.LightPink,
            };
            progressbar4.ValueChanged += progressbar4_ValueChanged;
            EntityManager.Add(progressbar4.Entity);

            button2 = new Button()
            {
                Margin = new Thickness(20, progress4Top + spacing * 2, 0, 0),
                Text = "Up",
                Foreground = Color.Gray,
                BackgroundColor = Color.LightBlue,
                BorderColor = Color.LightBlue,
            };
            button2.Click += button2_Click;
            EntityManager.Add(button2.Entity);

            info2 = new TextBlock()
            {
                Margin = new Thickness(20, progress4Top + spacing * 3, 0, 0),
                Text = string.Empty,
                Foreground = Color.Purple,
            };
            EntityManager.Add(info2.Entity);

            // Image Check
            AddCheckImage("Content/ProgressBarSample.wpk");
        }