wpf 检验窗体是否已存在
答案:1 悬赏:60 手机版
解决时间 2021-04-01 14:24
- 提问者网友:
- 2021-03-31 20:21
wpf 检验窗体是否已存在
最佳答案
- 五星知识达人网友:过活
- 2021-03-31 20:52
给你个思路
MainWindow mw = null;
foreach (Window w in App.Current.Windows)
{
if (w is MainWindow)
{
mw = w as MainWindow;
}
}
if (mw == null)
{
mw = new MainWindow();
mw.Show();
}
else
{
mw.Visibility = System.Windows.Visibility.Visible;
}
MainWindow mw = null;
foreach (Window w in App.Current.Windows)
{
if (w is MainWindow)
{
mw = w as MainWindow;
}
}
if (mw == null)
{
mw = new MainWindow();
mw.Show();
}
else
{
mw.Visibility = System.Windows.Visibility.Visible;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯