X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-sharp%2FAvahiTest.cs;h=395d5cb104d6acc67068195fd4483193fc6882ed;hb=cb6f8a5396aa9bc32619ddd74ead4f3ff209d200;hp=5def8a1b0c333f5f8e7c8ca8fe1707598383b2cf;hpb=907792fc1795c8552fac295ae98fc34d23097f1c;p=catta diff --git a/avahi-sharp/AvahiTest.cs b/avahi-sharp/AvahiTest.cs index 5def8a1..395d5cb 100644 --- a/avahi-sharp/AvahiTest.cs +++ b/avahi-sharp/AvahiTest.cs @@ -35,27 +35,42 @@ public class AvahiTest { eg.AddService ("foobar2", "_daap._tcp", client.DomainName, 444, new string[] { "foo", "bar", "baz" }); eg.Commit (); - - Application.Run (); + Console.WriteLine ("Press enter to quit"); + Console.ReadLine (); } private static void OnEntryGroupChanged (object o, EntryGroupState state) { Console.WriteLine ("Entry group status: " + state); + /* if (state == EntryGroupState.Established) { DomainBrowser browser = new DomainBrowser (client); browser.DomainAdded += OnDomainAdded; } + */ + + BrowseServiceTypes ("dns-sd.org"); } private static void OnDomainAdded (object o, DomainInfo info) { Console.WriteLine ("Got domain added: " + info.Domain); - ServiceTypeBrowser stb = new ServiceTypeBrowser (client, info.Domain); + BrowseServiceTypes (info.Domain); + } + + private static void BrowseServiceTypes (string domain) + { + ServiceTypeBrowser stb = new ServiceTypeBrowser (client, domain); + stb.CacheExhausted += OnCacheExhausted; stb.ServiceTypeAdded += OnServiceTypeAdded; } + private static void OnCacheExhausted (object o, EventArgs args) + { + Console.WriteLine ("Cache is exhausted"); + } + private static void OnServiceTypeAdded (object o, ServiceTypeInfo info) { Console.WriteLine ("Got service type: " + info.ServiceType);