コード例 #1
0
ファイル: WindowsDataController.cs プロジェクト: jwg4/gtools
        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);
                        }
                    }
                }
            }
        }
コード例 #2
0
        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);
                        }
                    }
                }
            }
        }