Example #1
1
		Control Indeterminate ()
		{
			var control = new ProgressBar {
				Indeterminate = true
			};
			return control;
		}
Example #2
0
		Control StartStopButton(ProgressBar bar)
		{
			var control = new Button { Text = "Start Timer" };
			control.Click += delegate
			{
				if (timer == null)
				{
					timer = new UITimer { Interval = 0.5 };
					timer.Elapsed += delegate
					{
						if (bar.Value < bar.MaxValue)
							bar.Value += 50;
						else
							bar.Value = bar.MinValue;
					};
					timer.Start();
					control.Text = "Stop Timer";
				}
				else
				{
					timer.Stop();
					timer.Dispose();
					timer = null;
					control.Text = "Start Timer";
				}
			};
			return control;
		}
Example #3
0
		private void Construct()
		{
			Title = "My Eto Form";
			ClientSize = new Size(400, 350);

            lblContent = new Label { Text = "Hello World!" };
            prgBar = new ProgressBar();

			// scrollable region as the main content
			Content = new Scrollable
			{
				// table with three rows
				Content = new TableLayout(
					null,
					// row with three columns
					new TableRow(null, lblContent, null),
                    new TableRow(null, prgBar, null)
				)
			};

			// create a few commands that can be used for the menu and toolbar
            cmdButton = new Command { MenuText = "Click Me!", ToolBarText = "Click Me!" };

			var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q };
			quitCommand.Executed += (sender, e) => Application.Instance.Quit();

			var aboutCommand = new Command { MenuText = "About..." };
			aboutCommand.Executed += (sender, e) => MessageBox.Show(this, "About my app...");

			// create menu
			Menu = new MenuBar
			{
				Items =
				{
					// File submenu
					new ButtonMenuItem { Text = "&File", Items = { cmdButton } },
					// new ButtonMenuItem { Text = "&Edit", Items = { /* commands/items */ } },
					// new ButtonMenuItem { Text = "&View", Items = { /* commands/items */ } },
				},
				ApplicationItems =
				{
					// application (OS X) or file menu (others)
					new ButtonMenuItem { Text = "&Preferences..." },
				},
				QuitItem = quitCommand,
				AboutItem = aboutCommand
			};

			// create toolbar			
            ToolBar = new ToolBar { Items = { cmdButton } };
		}
Example #4
0
        void Init()
        {
            //_labelDownload
            _labelDownload = new Label();

            //_progressBarDownload
            _progressBarDownload = new ProgressBar();

            var layout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)};
            layout.AddRow(_labelDownload);
            layout.AddRow(_progressBarDownload);

            Content = layout;
            Icon = Application.Instance.MainForm.Icon;
        }
Example #5
0
		Control SetValue ()
		{
			var control = new ProgressBar{
				MinValue = 0,
				MaxValue = 1000,
				Value = 500
			};

			var layout = new DynamicLayout (new Panel ());
			
			layout.Add (control);
			
			layout.BeginVertical ();
			layout.AddRow (null, StartStopButton (control), null);
			layout.EndVertical ();
			
			return layout.Container;
		}
Example #6
0
		Control SetValue()
		{
			var control = new ProgressBar
			{
				MinValue = 0,
				MaxValue = 1000,
				Value = 500
			};

			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) };

			layout.Add(control);

			layout.BeginVertical();
			layout.AddRow(null, StartStopButton(control), null);
			layout.EndVertical();

			return layout;
		}
Example #7
0
        /// <summary>
        /// Creates new progress bar window.
        /// </summary>
        /// <param name="title">Window title.</param>
        public ProgressForm(string title = "")
        {
            Title = title;
            ClientSize = new Size(320, 50);
            MinimumSize = new Size(100, 50);
            this.Maximizable = false;
            this.Resizable = false;

            label = new Label { TextAlignment = TextAlignment.Center };
            progressBar = new ProgressBar { Value = 0, MinValue = 0, MaxValue = 100 };

            Content = new TableLayout
            {
                Spacing = new Size(5, 5), // space between each cell
                Padding = new Padding(5), // space around the table's sides
                Rows =
                {
                    new TableRow(new TableCell(label, true)),
                    new TableRow(new TableCell(progressBar, true)),
                    new TableRow { ScaleHeight = true }
                }
            };
        }
Example #8
0
		Control Default()
		{
			var control = new ProgressBar();
			return control;
		}