[英]Can't see Loaded, Initialized, Visible window
簡化版
ParentWindow.ShowDialog()
ParentWindow.Hide()
ChildWindow.ShowDialog()
ParentWindow.Visibility = Visibility.Visible
我檢查了一下,ParentWindow 為IsInitialized
、 IsLoaded
和IsVisible
返回 true。 我還在我所有的 windows 中使用 Alt-Tabbed 來尋找它——它沒有隱藏在任何東西下面。
為什么我在任何地方都看不到 ParentWindow?
完整版本
parseSettingsWindow.ShowDialog()
ParentWindow.Hide()
b. parseSettingsWindow.GoToNextWindow 標志設置為真(下一個 window 是修復選擇器)while
循環執行fixSelector.ShowDialog()
因為它尚未加載while
循環,轉到`case“Parse Settings”部分parseSettingsWindow.Visibility = Visibility.Visible
我檢查了,當暫停執行時,parseSettingsWindow 為即時 Window 中的IsInitialized
、 IsLoaded
和IsVisible
返回 true break;
“解析設置” while
循環部分的行。 我還在我所有的 windows 中使用 Alt-Tabbed 來尋找它——它沒有隱藏在任何東西下面。
為什么我在任何地方都看不到 parseSettingsWindow?
主class
public static bool UserPromptedSettingsWereWrittenToModel(ref Model model, ref ActiveFixes activeFixes, ref ActiveReports activeReports)
{
var viewModel = new ViewModel();
var parseSettingsWindow = new ViewPlusViewModel.ParseSettings();
parseSettingsWindow.InitializeComponent();
var fixSelector = new ViewPlusViewModel.FixSelector(viewModel);
fixSelector.InitializeComponent();
var seeAllFixesReports = new ViewPlusViewModel.SeeAllFixesReports();
seeAllFixesReports.InitializeComponent();
parseSettingsWindow.ShowDialog();
var nextWindowToOpen = "Fix Selector";
while (parseSettingsWindow.GoToNextWindow == true && fixSelector.GoToNextWindow == false)
{
switch(nextWindowToOpen)
{
case "Fix Selector":
if (fixSelector.IsLoaded)
{
fixSelector.Visibility = Visibility.Visible;
}
else
{
fixSelector.ShowDialog();
}
nextWindowToOpen = "Parse Settings";
break;
case "Parse Settings":
parseSettingsWindow.GoToNextWindow = false;
parseSettingsWindow.Visibility = Visibility.Visible;
nextWindowToOpen = "Fix Selector";
break;
}
}
if (parseSettingsWindow.GoToNextWindow == false)
{
parseSettingsWindow.Close();
if (fixSelector.IsLoaded) fixSelector.Close();
if (seeAllFixesReports.IsLoaded) { seeAllFixesReports.Close(); }
return false;
}
parseSettingsWindow.Close();
fixSelector.Close();
if (seeAllFixesReports.IsLoaded) { seeAllFixesReports.Close(); }
return true;
}
ParseSettingsWindow.cs
private void GoToNextWindow_Click(object sender, RoutedEventArgs e)
{
this.GoToNextWindow = true;
this.Hide();
}
您不能通過Window.Visibility
再次將隱藏的.ShowDialog()
window 帶回來。 您需要再次使用.ShowDialog()
。 此外,即使再次使用ShowDialog()
,任何具有IsCancel = True
屬性的按鈕都將不再具有該功能,因此需要手動處理對該按鈕的按下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.