PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

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

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