private void RunExport2() { HTuple WindowID = hWindowControlWPF1.HalconID; HDevExp.RunCAM2(WindowID); //HDevExp.RunSync(WindowID); this.Dispatcher.Invoke(new Action(() => { labelStatus.Content = "Finished."; buttonCAM1.IsEnabled = true; })); }