PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/csharp/callback/runme.cs

#
C# | 46 lines | 38 code | 8 blank | 0 comment | 0 complexity | 6be0fd81ed8e809a61e7c9f58f86123f MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. using System;
  2. public class runme
  3. {
  4. static void Main()
  5. {
  6. Console.WriteLine("Adding and calling a normal C++ callback");
  7. Console.WriteLine("----------------------------------------");
  8. Caller caller = new Caller();
  9. using (Callback callback = new Callback())
  10. {
  11. caller.setCallback(callback);
  12. caller.call();
  13. caller.resetCallback();
  14. }
  15. Console.WriteLine();
  16. Console.WriteLine("Adding and calling a C# callback");
  17. Console.WriteLine("------------------------------------");
  18. using (Callback callback = new CSharpCallback())
  19. {
  20. caller.setCallback(callback);
  21. caller.call();
  22. caller.resetCallback();
  23. }
  24. Console.WriteLine();
  25. Console.WriteLine("C# exit");
  26. }
  27. }
  28. public class CSharpCallback : Callback
  29. {
  30. public CSharpCallback()
  31. : base()
  32. {
  33. }
  34. public override void run()
  35. {
  36. Console.WriteLine("CSharpCallback.run()");
  37. }
  38. }