加载增加进度条

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
string debugversion = "";
#endif
private bool _isStartupInitializing = false;
private void FormISP_MSI_Load(object sender, EventArgs e)
{
UpdateNumofConnectedMonitor();
// lblDisplayNumber.Text = _numberOfMonitors.ToString();
BeginStartupLoadingAnimation();
BeginInvoke(new Action(InitializeAfterFormLoaded));
}
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
private void InitializeAfterFormLoaded()
{
if (_isStartupInitializing)
{
// this.label21.Visible = true;
// this.lblPktDelayTime.Visible = true;
// this.txtPktDelayTime.Visible = true;
// this.label20.Visible = true;
// this.lblMTKChipType.Visible = true;
return;
}
_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
TopMost = true;
btnAuto.Enabled = false;
Connect();
_lastNumOfMonitors = _numberOfMonitors;
Application.Idle += Application_Idle;
TopMost = true;
btnAuto.Enabled = false;
Connect();
_lastNumOfMonitors = _numberOfMonitors;
Application.Idle += Application_Idle;
}
finally
{
EndStartupLoadingAnimation();
_isStartupInitializing = false;
}
}
private void FormISP_MSI_Shown(object sender, EventArgs e)
@@ -238,6 +259,23 @@ namespace WinISP
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)
{
if (msg != String.Empty)