public override void Refresh(ObservableCollection <DataObject> objects) { using (var manager = new RefreshManager <WindowDataObject>(objects)) { foreach (int hwnd in NativeWindowFunctions.EnumWindows()) { string internalID = hwnd.ToString("X4"); WindowDataObject wdo; if (manager.Contains(internalID, out wdo)) { if (!wdo.Refresh(hwnd)) { objects.Remove(wdo); } } else { wdo = new WindowDataObject(hwnd); if (!string.IsNullOrEmpty(wdo.Title)) { objects.Add(wdo); } } } } }
public override void Refresh(ObservableCollection<DataObject> objects) { using (var manager = new RefreshManager<WindowDataObject>(objects)) { foreach (int hwnd in NativeWindowFunctions.EnumWindows()) { string internalID = hwnd.ToString("X4"); WindowDataObject wdo; if (manager.Contains(internalID, out wdo)) { if( !wdo.Refresh(hwnd) ) { objects.Remove(wdo); } } else { wdo = new WindowDataObject(hwnd); if (!string.IsNullOrEmpty(wdo.Title)) { objects.Add(wdo); } } } } }