Device.TestCooperativeLevel() Method (Microsoft.DirectX.Direct3D)
Reports the current cooperative-level status of the Microsoft Direct3D device for a windowed or full-screen application.
If the device is lost and cannot be restored at the current time, Device.TestCooperativeLevel throws a DeviceLostException. This is the case, for example, when a full-screen device loses focus. If an application detects a lost device, it should pause and periodically call Device.TestCooperativeLevel until no exceptions are thrown. The application can then attempt to reset the device by calling Device.Reset and, if this succeeds, restore the necessary resources and resume normal operation. Note that Device.Present throws a DeviceLostException if the device is either "lost" or "not reset".
A call to Device.TestCooperativeLevel fails if made on a different thread than the one used to create the device being reset.
DeviceLostException The device is lost but cannot be reset at this time. Therefore, rendering is not possible. DeviceNotResetException The device is lost but can be reset at this time.