判断窗口是否已经被打开

 1                         int win = Application.Current.Windows.Count;
 2                         ArrayList FormNameList = new ArrayList();
 3                         for (int a = 0; a < win; a++)
 4                         {
 5                             var title = Application.Current.Windows[a].Title;
 6                                 if (title == o.FileInfo.FullName)
 7                                 {
 8                                     Application.Current.Windows[a].Show();
 9                                     FormNameList.Add(Application.Current.Windows[a].Title);
10                                 }
11                         }
12                         if (FormNameList.Count > 0)
13                         {
14                             return;
15                         }
16 
17                         Logger.D(TAG, "开始打开文件");
18                         ViewDocumentWindow viewDocumentWindow = new ViewDocumentWindow(topicID, caseID, o.FileInfo);
19                         viewDocumentWindow.Owner = NavigationWindow.GetWindow(this);
20                         viewDocumentWindow.Show();
21                         Logger.D(TAG, "打开文件结束");                    
原文地址:https://www.cnblogs.com/lijianda/p/6720843.html