2
我有一個WPF MVVM應用程序。我使用WindowManager
打開並顯示一個veiw。我的主要外殼視圖模型是與顯示ConsoleView
使用MVVM關閉所有Caliburn Micro的子窗口
[Export(typeof(IShell))]
public sealed class ShellViewModel :
Conductor<IScreen>.Collection.OneActive, IShell, IDataErrorInfo
{
IWindowManager windowManager = null;
...
public SomeMethod()
{
...
dynamic eo = new ExpandoObject();
eo.WindowStartupLocation = WindowStartupLocation.CenterScreen;
ConsoleViewModel console = new ConsoleViewModel("Binary Table Compilation Output");
windowManager.ShowWindow(console, null, eo);
...
}
...
}
的SomeMethod
如下與ConsoleViewModel
是
[View(typeof(ConsoleView))]
public class ConsoleViewModel : Screen
{
...
}
的問題是,如果我關機的主要應用,其ConsoleView
不會關閉。問題是,如何在主應用程序/ shell執行時強制所有子窗口關閉?
好了,是的,但我認爲會有一個MVVM「卡利方式」? – MoonKnight
使用Caliburn不*意味着你不能使用.NET類。 – Sheridan
+1尋求幫助。讚賞。只是一個快速的。我很高興使用它,但有4個窗口顯示在Application.Current.Windows中,這些窗口不可見,我不知道它們是什麼!?主窗口位於第一個位置,但還有其他未實例化的窗口實例。任何想法爲什麼這些在那裏? – MoonKnight