1. Fixing another bug where the restore was throwing an exception due to mismatching window search criteria

This commit is contained in:
Min Yong Kim 2015-01-20 23:19:51 -05:00
parent 67c2a93542
commit b3776ce827
2 changed files with 13 additions and 8 deletions

View file

@ -221,11 +221,7 @@ namespace Ninjacrab.PersistentWindows.WpfShell
monitorApplications.Add(displayKey, new SortedDictionary<string, ApplicationDisplayMetrics>());
}
var appWindows = SystemWindow.AllToplevelWindows
.Where(row => row.Parent.HWnd.ToInt64() == 0
&& !string.IsNullOrEmpty(row.Title)
&& !row.Title.Equals("Program Manager")
&& row.Visible);
var appWindows = CaptureWindowsOfInterest();
List<string> changeLog = new List<string>();
List<ApplicationDisplayMetrics> apps = new List<ApplicationDisplayMetrics>();
@ -272,6 +268,15 @@ namespace Ninjacrab.PersistentWindows.WpfShell
}
}
private IEnumerable<SystemWindow> CaptureWindowsOfInterest()
{
return SystemWindow.AllToplevelWindows
.Where(row => row.Parent.HWnd.ToInt64() == 0
&& !string.IsNullOrEmpty(row.Title)
&& !row.Title.Equals("Program Manager")
&& row.Visible);
}
private bool AddOrUpdateWindow(string displayKey, SystemWindow window, out ApplicationDisplayMetrics applicationDisplayMetric)
{
WindowPlacement windowPlacement = new WindowPlacement();
@ -335,7 +340,7 @@ namespace Ninjacrab.PersistentWindows.WpfShell
}
Log.Info("Restoring applications for {0}", displayKey);
foreach (var window in SystemWindow.AllToplevelWindows.Where(row => row.VisibilityFlag == true))
foreach (var window in CaptureWindowsOfInterest())
{
string applicationKey = string.Format("{0}-{1}", window.HWnd.ToInt64(), window.Process.ProcessName);
if (monitorApplications[displayKey].ContainsKey(applicationKey))

View file

@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.0")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyVersion("1.0.6.0")]
[assembly: AssemblyFileVersion("1.0.6.0")]