27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
|
|
namespace UCVL.VPNPlus;
|
||
|
|
|
||
|
|
internal sealed class UpdateProgressForm : Form
|
||
|
|
{
|
||
|
|
private readonly ProgressBar _progress = new() { Minimum = 0, Maximum = 100, Style = ProgressBarStyle.Continuous, Dock = DockStyle.Bottom, Height = 20 };
|
||
|
|
private readonly Label _label = new() { Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleLeft };
|
||
|
|
internal UpdateProgressForm(string version)
|
||
|
|
{
|
||
|
|
Text = $"纵横家 · 更新至 {version}";
|
||
|
|
ClientSize = new Size(390, 102);
|
||
|
|
Padding = new Padding(22);
|
||
|
|
StartPosition = FormStartPosition.CenterParent;
|
||
|
|
FormBorderStyle = FormBorderStyle.FixedDialog;
|
||
|
|
ControlBox = false; ShowInTaskbar = true;
|
||
|
|
AutoScaleDimensions = new SizeF(96,96); AutoScaleMode = AutoScaleMode.Dpi;
|
||
|
|
Font = Brand.Font(9); BackColor = Color.White;
|
||
|
|
_label.Text = "正在下载更新,保留账号和配置…";
|
||
|
|
Controls.Add(_label); Controls.Add(_progress);
|
||
|
|
}
|
||
|
|
internal void Report(int percent)
|
||
|
|
{
|
||
|
|
if (IsDisposed) return;
|
||
|
|
_progress.Value = Math.Clamp(percent,0,100);
|
||
|
|
_label.Text = percent < 100 ? $"正在下载更新 {percent}% · 保留原安装位置和配置" : "下载完成,正在校验并准备安装…";
|
||
|
|
}
|
||
|
|
}
|