您应该在后台线程上执行需要两秒钟才能完成的长时间运行的任务,并在调度程序线程上显示和关闭窗口,例如:Window window = new Window(){ WindowStyle = WindowStyle.None, Content = new TextBlock { Text = "working..." }};Task.Run(() =>{ //do something that might take a while here... System.Threading.Thread.Sleep(2000);}).ContinueWith(task => window.Close(), CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());window.ShowDialog(); //Call .Show() instead if you don't want to block here until the task has finished.