在启动画面标签 c# 上显示数据处理
Showing up DataProcessing on SplashScreen Label c#
屏幕已经完成我使用的是Devexpress SplashScreen。它在开始时打开并在加载所有数据时关闭,直到主应用程序打开。现在我的问题是如何将后台加载的数据放入标签中,以便用户看到正在发生的事情。
查看 SplashScreenManager.SendCommand 以了解应用程序与初始屏幕之间的通信
表单代码
private void btnShowSplashScreen_Click(object sender, EventArgs e) {
// Open a Splash Screen
SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
// The splash screen will be opened in a separate thread. To interact with it, use the SendCommand method.
for (int i = 1; i <= 100; i++) {
SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, i);
//To process commands, override the SplashScreen.ProcessCommand method.
Thread.Sleep(25);
}
// Close the Splash Screen.
SplashScreenManager.CloseForm(false);
}
启动代码
public override void ProcessCommand(Enum cmd, object arg) {
base.ProcessCommand(cmd, arg);
SplashScreenCommand command = (SplashScreenCommand)cmd;
if (command == SplashScreenCommand.SetProgress) {
int pos = (int)arg;
progressBarControl1.Position = pos;
}
}
public enum SplashScreenCommand {
SetProgress,
Command2,
Command3
}
屏幕已经完成我使用的是Devexpress SplashScreen。它在开始时打开并在加载所有数据时关闭,直到主应用程序打开。现在我的问题是如何将后台加载的数据放入标签中,以便用户看到正在发生的事情。
查看 SplashScreenManager.SendCommand 以了解应用程序与初始屏幕之间的通信
表单代码
private void btnShowSplashScreen_Click(object sender, EventArgs e) {
// Open a Splash Screen
SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
// The splash screen will be opened in a separate thread. To interact with it, use the SendCommand method.
for (int i = 1; i <= 100; i++) {
SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, i);
//To process commands, override the SplashScreen.ProcessCommand method.
Thread.Sleep(25);
}
// Close the Splash Screen.
SplashScreenManager.CloseForm(false);
}
启动代码
public override void ProcessCommand(Enum cmd, object arg) {
base.ProcessCommand(cmd, arg);
SplashScreenCommand command = (SplashScreenCommand)cmd;
if (command == SplashScreenCommand.SetProgress) {
int pos = (int)arg;
progressBarControl1.Position = pos;
}
}
public enum SplashScreenCommand {
SetProgress,
Command2,
Command3
}