[英]Can't see Loaded, Initialized, Visible window
Simplified version简化版
ParentWindow.ShowDialog()
ParentWindow.Hide()
ParentWindow.Hide()
ChildWindow.ShowDialog()
ParentWindow.Visibility = Visibility.Visible
I checked, and ParentWindow returns true for IsInitialized
, IsLoaded
, and IsVisible
.我检查了一下,ParentWindow 为
IsInitialized
、 IsLoaded
和IsVisible
返回 true。 I also Alt-Tabbed my way through all my windows to look for it - it's not hiding under anything.我还在我所有的 windows 中使用 Alt-Tabbed 来寻找它——它没有隐藏在任何东西下面。
Why can't I see ParentWindow anywhere?为什么我在任何地方都看不到 ParentWindow?
Full version完整版本
parseSettingsWindow.ShowDialog()
ParentWindow.Hide()
b. ParentWindow.Hide()
b. parseSettingsWindow.GoToNextWindow flag set to true (Next window is Fix Selector) while
loop does fixSelector.ShowDialog()
because it's not yet loaded while
循环执行fixSelector.ShowDialog()
因为它尚未加载while
loop is entered again, goes to `case "Parse Settings" sectionwhile
循环,转到`case“Parse Settings”部分parseSettingsWindow.Visibility = Visibility.Visible
I checked, and parseSettingsWindow returns true for IsInitialized
, IsLoaded
, and IsVisible
in the Immediate Window when pausing execution on the break;
我检查了,当暂停执行时,parseSettingsWindow 为即时 Window 中的
IsInitialized
、 IsLoaded
和IsVisible
返回 true break;
line of the "Parse Settings" while
loop section. “解析设置”
while
循环部分的行。 I also Alt-Tabbed my way through all my windows to look for it - it's not hiding under anything.我还在我所有的 windows 中使用 Alt-Tabbed 来寻找它——它没有隐藏在任何东西下面。
Why can't I see parseSettingsWindow anywhere?为什么我在任何地方都看不到 parseSettingsWindow?
Main class主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 ParseSettingsWindow.cs
private void GoToNextWindow_Click(object sender, RoutedEventArgs e)
{
this.GoToNextWindow = true;
this.Hide();
}
You can't bring a hidden .ShowDialog()
window back again via Window.Visibility
.您不能通过
Window.Visibility
再次将隐藏的.ShowDialog()
window 带回来。 You need to use .ShowDialog()
on it again.您需要再次使用
.ShowDialog()
。 In addition, any buttons given the IsCancel = True
property will no longer have that functionality even when using ShowDialog()
again, so presses on that button will need to be handled manually.此外,即使再次使用
ShowDialog()
,任何具有IsCancel = True
属性的按钮都将不再具有该功能,因此需要手动处理对该按钮的按下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.