加载增加进度条

This commit is contained in:
chenjiangqun
2026-07-02 15:17:21 +08:00
parent 959b4232aa
commit 718cec11a5

View File

@@ -142,38 +142,59 @@ namespace WinISP
#else #else
string debugversion = ""; string debugversion = "";
#endif #endif
private bool _isStartupInitializing = false;
private void FormISP_MSI_Load(object sender, EventArgs e) private void FormISP_MSI_Load(object sender, EventArgs e)
{ {
UpdateNumofConnectedMonitor(); BeginStartupLoadingAnimation();
// lblDisplayNumber.Text = _numberOfMonitors.ToString(); BeginInvoke(new Action(InitializeAfterFormLoaded));
}
CenterToScreen(); private void InitializeAfterFormLoaded()
if (_simI2cCtrl == null) {
_simI2cCtrl = new GraphicCardI2CCtrl(); if (_isStartupInitializing)
MTKDebugCmd.InitI2CCtrl(_simI2cCtrl);
CheckSingleInstance();
SetStatusMsg("Ready");
string betaString = "";
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
this.Text += " [Program Version] : " + fvi.ProductVersion + " " + betaString /*+ " (FW ver : " + ver + ") "*/ + debugversion;
frmISP.WriteLog("Program version: " + fvi.ProductVersion, "debug");
#if DEBUG
{ {
// this.label21.Visible = true; return;
// this.lblPktDelayTime.Visible = true;
// this.txtPktDelayTime.Visible = true;
// this.label20.Visible = true;
// this.lblMTKChipType.Visible = true;
} }
_isStartupInitializing = true;
try
{
UpdateNumofConnectedMonitor();
// lblDisplayNumber.Text = _numberOfMonitors.ToString();
CenterToScreen();
if (_simI2cCtrl == null)
_simI2cCtrl = new GraphicCardI2CCtrl();
MTKDebugCmd.InitI2CCtrl(_simI2cCtrl);
CheckSingleInstance();
SetStatusMsg("Ready");
string betaString = "";
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
this.Text += " [Program Version] : " + fvi.ProductVersion + " " + betaString /*+ " (FW ver : " + ver + ") "*/ + debugversion;
frmISP.WriteLog("Program version: " + fvi.ProductVersion, "debug");
#if DEBUG
{
// this.label21.Visible = true;
// this.lblPktDelayTime.Visible = true;
// this.txtPktDelayTime.Visible = true;
// this.label20.Visible = true;
// this.lblMTKChipType.Visible = true;
}
#endif #endif
TopMost = true; TopMost = true;
btnAuto.Enabled = false; btnAuto.Enabled = false;
Connect(); Connect();
_lastNumOfMonitors = _numberOfMonitors; _lastNumOfMonitors = _numberOfMonitors;
Application.Idle += Application_Idle; Application.Idle += Application_Idle;
}
finally
{
EndStartupLoadingAnimation();
_isStartupInitializing = false;
}
} }
private void FormISP_MSI_Shown(object sender, EventArgs e) private void FormISP_MSI_Shown(object sender, EventArgs e)
@@ -238,6 +259,23 @@ namespace WinISP
return Environment.TickCount & Int32.MaxValue; return Environment.TickCount & Int32.MaxValue;
} }
private void BeginStartupLoadingAnimation()
{
prbProgress.Style = ProgressBarStyle.Marquee;
prbProgress.MarqueeAnimationSpeed = 30;
SetStatusMsg("程序加载中,请稍候...");
btnAuto.Enabled = false;
btnLoadFile.Enabled = false;
}
private void EndStartupLoadingAnimation()
{
prbProgress.MarqueeAnimationSpeed = 0;
prbProgress.Style = ProgressBarStyle.Blocks;
prbProgress.Value = 0;
btnLoadFile.Enabled = true;
}
private void OnUpdateProgress(int total, int done, String msg) private void OnUpdateProgress(int total, int done, String msg)
{ {
if (msg != String.Empty) if (msg != String.Empty)