// This method will be called when the thread is started. public void DoWork() { #if normalMode try { CSharpObject.GetType().InvokeMember("Initialize", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); string[] debugLines = new string[1]; int refreshRate = (int)CSharpObject.GetType().InvokeMember("getRefreshRate", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); while (!_shouldStop) { CSharpObject.GetType().InvokeMember("mainLoop", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); if (CSharpObject.GetType().GetMethod("getDebugString") != null) { String aString = (String)CSharpObject.GetType().InvokeMember("getDebugString", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); //String aString; myForm.updateDebugString(aString); } Thread.Sleep(refreshRate); } CSharpObject.GetType().InvokeMember("shutDown", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); return; } catch (Exception e) { MessageBox.Show(e.ToString()); } #else testConfig config; config = new testConfig(); try { config.Initialize(); } catch (Exception e) { MessageBox.Show(e.ToString()); } int refreshRate = config.getRefreshRate(); while (!_shouldStop) { config.mainLoop(); Thread.Sleep(refreshRate); } config.shutDown(); return; #endif }
// This method will be called when the thread is started. public void DoWork() { #if normalMode try { CSharpObject.GetType().InvokeMember("Initialize", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); int refreshRate = (int)CSharpObject.GetType().InvokeMember("getRefreshRate", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); while (!_shouldStop) { CSharpObject.GetType().InvokeMember("mainLoop", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); Thread.Sleep(refreshRate); } CSharpObject.GetType().InvokeMember("shutDown", System.Reflection.BindingFlags.InvokeMethod, null, CSharpObject, null); } catch (Exception e) { MessageBox.Show(e.ToString()); } #else testConfig config; config = new testConfig(); try { config.Initialize(); } catch (Exception e) { MessageBox.Show(e.ToString()); } int refreshRate = config.getRefreshRate(); while (!_shouldStop) { config.mainLoop(); Thread.Sleep(refreshRate); } config.shutDown(); #endif }