From c916037773d7d3d8d37ca2c5a8899b7b728e377d Mon Sep 17 00:00:00 2001 From: Owen Fraser-Green Date: Tue, 23 Mar 2004 12:10:32 +0000 Subject: First checkin of the Mono bindings. --- mono/example/EchoClient.cs | 19 +++++++++++++++++++ mono/example/EchoServer.cs | 23 +++++++++++++++++++++++ mono/example/Echoer.cs | 16 ++++++++++++++++ mono/example/Makefile.am | 19 +++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 mono/example/EchoClient.cs create mode 100644 mono/example/EchoServer.cs create mode 100644 mono/example/Echoer.cs create mode 100644 mono/example/Makefile.am (limited to 'mono/example') diff --git a/mono/example/EchoClient.cs b/mono/example/EchoClient.cs new file mode 100644 index 00000000..dc20771a --- /dev/null +++ b/mono/example/EchoClient.cs @@ -0,0 +1,19 @@ +namespace Foo +{ + using System; + using DBus; + + public class EchoClient + { + public static int Main(string [] args) + { + Connection connection = Bus.GetSessionBus(); + Service service = Service.Get(connection, "org.freedesktop.Test"); + Echoer echoer = (Echoer) + service.GetObject(typeof(Echoer), "/org/freedesktop/Test/Echoer"); + System.Console.WriteLine(echoer.Echo("Hello world!")); + + return 0; + } + } +} diff --git a/mono/example/EchoServer.cs b/mono/example/EchoServer.cs new file mode 100644 index 00000000..243a2730 --- /dev/null +++ b/mono/example/EchoServer.cs @@ -0,0 +1,23 @@ +namespace Foo +{ + using System; + using DBus; + using Gtk; + + public class EchoServer + { + public static int Main(string [] args) + { + Application.Init(); + + Connection connection = Bus.GetSessionBus(); + Service service = new Service(connection, "org.freedesktop.Test"); + Echoer echoer = new Echoer(); + service.RegisterObject(echoer, "/org/freedesktop/Test/Echoer"); + + Application.Run(); + + return 0; + } + } +} diff --git a/mono/example/Echoer.cs b/mono/example/Echoer.cs new file mode 100644 index 00000000..bc5a843d --- /dev/null +++ b/mono/example/Echoer.cs @@ -0,0 +1,16 @@ +namespace Foo +{ + using System; + using DBus; + + [Interface("org.freedesktop.Test.Echoer")] + public class Echoer + { + [Method] + public virtual string Echo(string message) + { + System.Console.WriteLine("I received: " + message); + return "Reply: " + message; + } + } +} diff --git a/mono/example/Makefile.am b/mono/example/Makefile.am new file mode 100644 index 00000000..2355bf31 --- /dev/null +++ b/mono/example/Makefile.am @@ -0,0 +1,19 @@ +DESTDIR= + +NOINST_EXES=echo-server.exe echo-client.exe + +all: $(NOINST_EXES) + +echo-server.exe: EchoServer.cs Echoer.cs + $(MCS) $(MCSFLAGS) --unsafe --target exe -L .. -r dbus-sharp.dll -r gtk-sharp -o echo-server.exe EchoServer.cs Echoer.cs + +echo-client.exe: EchoClient.cs Echoer.cs + $(MCS) $(MCSFLAGS) --unsafe --target exe -L .. -r dbus-sharp.dll -o echo-client.exe EchoClient.cs Echoer.cs + +clean: + rm -f $(NOINST_EXES) + +install: all + +EXTRA_DIST=EchoServer.cs EchoClient.cs Echoer.cs + -- cgit