每次打开新窗口时,我都会注意到性能下降。 当我打开一个新窗口时,我使用它:
@media only screen and (max-width: 1267px) { /* 10 items */
inner-container {width: 1024px;}
}
@media only screen and (max-width: 1167px) { /* 9 items */
inner-container {width: 924px;}
}
@media only screen and (max-width: 1067px) { /* 8 items */
inner-container {width: 824px;}
}
@media only screen and (max-width: 967px) { /* 7 items */
inner-container {width: 724px;}
}
@media only screen and (max-width: 867px) { /* 6 items */
inner-container {width: 624px;}
}
@media only screen and (max-width: 767px) { /* 5 items */
inner-container {width: 524px;}
}
这会导致参考/性能下降,还是我需要深入了解这个应用程序?
编辑: 是一个可怕的CanExecute,它正在轮询数据库。
答案 0 :(得分:0)
我遇到了同样的问题并通过在新线程中创建新窗口来解决它! 这是一个例子:
Thread windowThread = new Thread(new ThreadStart(() =>
{
MyWindow NSWindow = new MyWindow();
// When the window closes, shut down the dispatcher
NSWindow.Closed += (s, e) =>
Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background);
NSWindow.Show();
// Start the Dispatcher Processing
System.Windows.Threading.Dispatcher.Run();
}));
windowThread.SetApartmentState(ApartmentState.STA);
// Make the thread a background thread
windowThread.IsBackground = true;
// Start the thread
windowThread.Start();