It is not clear what your original intention was.
This code should hang (almost) forever, because HasShutdownStarted does not become true until the application exits.
while (!Dispatcher.HasShutdownStarted) { // test if Dispatcher started shutdown --> ok, it does but never finishs...! }
This code provides for delegate execution in the user interface thread. It looks great.
private void onFrameEventFocusCam(object sender, EventArgs e) { ... Dispatcher.Invoke(new Action(() => { ... } }
This code seems to be potentially problematic because if DeleteObject actually frees the handle, then the handle can be released twice, once in Delete and once in Dispose. It can quit.
DeleteObject(hBitmap); bitmap.Dispose();
Alon catz
source share