public virtual void VirtualMain(string[] args) { try { Trace("Begin ManualTestCallback.Main\n"); Vehicle v1 = new Vehicle(); GCHandle gch = GCHandle.Alloc(this); Trace(String.Format("v1: {0:x}\n", (uint) v1.GetCppThis().Handle)); //Trace(String.Format("cb: {0}\n", cb == null ? "(null)" : cb.ToString())); uint i = 0; uint maxi = 1999005;//v1.GetMaxIndex(); Trace("Set/GetValue loop...\n"); //v1.SetCallback(cb, gch); for (i= 0; i<maxi; ++i) { v1.TSetValue(i, v1.TGetValue(i+1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("Set/GetDoubleValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetDoubleValue(i, v1.TGetDoubleValue(i+1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("Set/GetStringValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetStringValue(i, v1.TGetStringValue(i+1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("Set/GetObjectValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetObjectValue(i, v1.TGetObjectValue(i+1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("MethodWithBoolRefArg loop...\n"); for (i = 0; i < 30; ++i) { byte arg = 0; v1.MethodWithBoolRefArg(ref arg); Trace(String.Format(" i: {0} -- arg: \n", i, (arg != 0 ? "true" : "false"))); } Trace(String.Format(" i: {0}\n", i)); gch.Free(); Trace("End ManualTestCallback.Main\n"); } catch(Exception exc) { Trace(exc.ToString()); throw; } }
public virtual void VirtualMain(string[] args) { try { Trace("Begin ManualTestCallback.Main\n"); Vehicle v1 = new Vehicle(); GCHandle gch = GCHandle.Alloc(this); Trace(String.Format("v1: {0:x}\n", (uint)v1.GetCppThis().Handle)); //Trace(String.Format("cb: {0}\n", cb == null ? "(null)" : cb.ToString())); uint i = 0; uint maxi = 1999005;//v1.GetMaxIndex(); Trace("Set/GetValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetValue(i, v1.TGetValue(i + 1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("Set/GetDoubleValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetDoubleValue(i, v1.TGetDoubleValue(i + 1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("Set/GetStringValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetStringValue(i, v1.TGetStringValue(i + 1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("Set/GetObjectValue loop...\n"); //v1.SetCallback(cb, gch); for (i = 0; i < maxi; ++i) { v1.TSetObjectValue(i, v1.TGetObjectValue(i + 1)); if (0 == i) { //v1.SetCallback(null, gch); } } Trace(String.Format(" i: {0}\n", i)); Trace("MethodWithBoolRefArg loop...\n"); for (i = 0; i < 30; ++i) { byte arg = 0; v1.MethodWithBoolRefArg(ref arg); Trace(String.Format(" i: {0} -- arg: \n", i, (arg != 0 ? "true" : "false"))); } Trace(String.Format(" i: {0}\n", i)); gch.Free(); Trace("End ManualTestCallback.Main\n"); } catch (Exception exc) { Trace(exc.ToString()); throw; } }