2using System.Collections.Generic;
3using System.ComponentModel;
5using System.Diagnostics;
9using System.Threading.Tasks;
10using System.Windows.Forms;
14 public partial class Progress : Form
16 Stopwatch watch =
new Stopwatch();
19 InitializeComponent();
21 statusLabel.Text = status;
22 fileLabel.Text = file;
25 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
28 get {
return statusLabel.Text; }
32 if (statusLabel.InvokeRequired)
34 statusLabel.Invoke(() => statusLabel.Text = value);
38 statusLabel.Text = value;
42 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
45 get {
return progressBar.Value; }
48 if (progressBar.InvokeRequired)
50 if (progressBar.Maximum < value)
52 progressBar.Invoke(() => progressBar.Value = (
int)(value / 100));
55 progressBar.Invoke(() => progressBar.Value = (
int)value);
58 if (progressBar.Maximum < value)
59 progressBar.Value = (int)(value * 100);
61 progressBar.Value = (int)(value);
67 progressBar.Value = p;
71 if (p * 100 > progressBar.Maximum)
73 progressBar.Value = (int)(p * 100);
76 private void timer_Tick(
object sender, EventArgs e)
78 timeLabel.Text = watch.Elapsed.Seconds +
"." + watch.Elapsed.Milliseconds +
"s";
void UpdateProgressF(float p)
void UpdateProgress(int p)
Progress(string file, string status)