2 using System.Threading;
10 public static Service service = null;
11 public static Connection connection = null;
13 public static int Main(string [] args)
15 TestServer testServer = new TestServer();
16 Thread serverThread = new Thread(new ThreadStart(testServer.StartServer));
19 connection = Bus.GetSessionBus();
20 service = Service.Get(connection, "org.freedesktop.Test");
22 TestObject testObject = (TestObject) service.GetObject(typeof(TestObject), "/org/freedesktop/Test/TestObject");
24 System.Console.WriteLine(testObject.Test1("Hello"));
26 //RunTests(testObject);
31 public static void RunTests(TestObject testObject)
33 System.Console.WriteLine(testObject.Test1("Hello"));
37 public class TestServer
39 public Connection connection;
40 public Service service;
46 System.Console.WriteLine("Starting server...");
48 connection = Bus.GetSessionBus();
49 service = new Service(connection, "org.freedesktop.Test");
50 TestObject testObject = new TestObject();
51 service.RegisterObject(testObject, "/org/freedesktop/Test/TestObject");
54 public void StartServer()
60 [Interface("org.freedesktop.Test.TestObject")]
61 public class TestObject
64 public virtual int Test1(string x)
66 System.Console.WriteLine("Called: " + x);