就是遍历所有的,有的话就不生成了,没有的话就生成一个,还有最前是一个参数,最后就是窗口事件了。
//如果容器里没有预览控件,就加入控件
ChangeDistingWordOfSelected mw = null;
foreach (Window win in App.Current.Windows)
{
if (win is ChangeDistingWordOfSelected)
{
mw = win as ChangeDistingWordOfSelected;
}
}
if (mw == null)
{
mw = new ChangeDistingWordOfSelected();
mw.WindowStartupLocation = WindowStartupLocation.Manual;
//