You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/labs/CameraCard/CameraCard/ProgressForm.cs

31 lines
922 B

using System;
using System.Windows.Forms;
namespace CameraCard
{
public partial class ProgressForm : Form
{
public ProgressForm(string title, string status, int min, int max, int width = 0)
{
InitializeComponent();
this.ControlBox = false;
this.Width = width == 0 ? this.Width : width;
this.Text = title;
this.status.Text = status;
this.progressBar.Minimum = min;
this.progressBar.Maximum = max;
}
public void SetProgress(string label, int progress)
{
if (this.IsHandleCreated)
{
this.Invoke(new Action(() =>
{
this.status.Text = label;
this.progressBar.Value = progress < this.progressBar.Maximum ? progress : this.progressBar.Maximum;
}));
}
}
}
}