private void RunExeThread(object parameter) { bool result = false; string fileName = parameter as string; ApplicationApi.NativeExe ne = new ApplicationApi.NativeExe(fileName); if (ne.Run("", "", true) == true) { result = true; while (_stopThread == false) { UInt32 res = ne.Wait(1000); if (res == ApplicationApi.NativeExe.WaitingFailed || res == 0) { break; } } } ne = null; GC.Collect(); Dispatcher.BeginInvoke(delegate() { VisualStateManager.GoToState(this, "Normal", true); ShowResult(!result); }); }