我尝试为启动应用程序构建逻辑。启动控件需要加载数据,但用户可以登录,同时加载数据。
private void SplashControl_OnLoaded(object sender, RoutedEventArgs e)
{
StausLabel.Content = "Loading Data...";
ShowLoginContinueLoading();
}
private void ShowLoginContinueLoading()
{
var loginWindow = new LoginWindow();
var task = new Task(() =>
{
Managers.LoadUsers();
});
task.ContinueWith(async innerTask =>
{
Dispatcher.Invoke(loginWindow.Show);
try
{
Managers.LoadData();
}
catch (Exception exception)
{
throw exception;
}
Dispatcher.Invoke(() => StausLabel.Content = "Loading Complite");
});
task.Start();
SlashControl如何知道登录成功与否?