internal void InitNetBrowser () { _serviceList = new List<NSNetService> (); _netBrowser = new NSNetServiceBrowser (); _source = new ServicesTableSource (this); servicesTable.Source = _source; _netBrowser.SearchForServices ("_bonjourdemoservice._tcp", ""); _netBrowser.FoundService += delegate(object sender, NSNetServiceEventArgs e) { logView.AppendTextLine (String.Format ("{0} added", e.Service.Name)); _serviceList.Add (e.Service); e.Service.AddressResolved += ServiceAddressResolved; // NOTE: could also insert and remove rows in a // more fine grained fashion here as well servicesTable.ReloadData (); }; _netBrowser.ServiceRemoved += delegate(object sender, NSNetServiceEventArgs e) { logView.AppendTextLine (String.Format ("{0} removed", e.Service.Name)); var nsService = _serviceList.Single (s => s.Name.Equals (e.Service.Name)); _serviceList.Remove (nsService); servicesTable.ReloadData (); }; }
internal void InitNetBrowser() { _serviceList = new List <NSNetService> (); _netBrowser = new NSNetServiceBrowser(); _source = new ServicesTableSource(this); servicesTable.Source = _source; _netBrowser.SearchForServices("_bonjourdemoservice._tcp", ""); _netBrowser.FoundService += delegate(object sender, NSNetServiceEventArgs e) { logView.AppendTextLine(String.Format("{0} added", e.Service.Name)); _serviceList.Add(e.Service); e.Service.AddressResolved += ServiceAddressResolved; // NOTE: could also insert and remove rows in a // more fine grained fashion here as well servicesTable.ReloadData(); }; _netBrowser.ServiceRemoved += delegate(object sender, NSNetServiceEventArgs e) { logView.AppendTextLine(String.Format("{0} removed", e.Service.Name)); var nsService = _serviceList.Single(s => s.Name.Equals(e.Service.Name)); _serviceList.Remove(nsService); servicesTable.ReloadData(); }; }
public override void FoundService (NSNetServiceBrowser sender, NSNetService service, bool moreComing) { Debug.WriteLine (String.Format("Found {0}", service.Name)); if (service.Name.Equals ("Calabash Server")) if (successCallback != null) successCallback (); }
public AutoServerDicovery(UITableViewControllerServerDiscovery parent) { // Setup of the service browser. Browser = new NSNetServiceBrowser(); Delegate = new ServerDelegate(parent); Browser.Init(); Browser.Delegate = Delegate; }
public override void FoundService(NSNetServiceBrowser sender, NSNetService service, bool moreComing) { Console.WriteLine("Found service " + service.HostName); Services.Add(service); if (!moreComing) { UpdateUI(); } }
public void OnAppStart() { serviceBrowser = new NSNetServiceBrowser(); serviceBrowser.FoundService += OnServiceFound; serviceBrowser.ServiceRemoved += OnServiceLost; serviceBrowser.SearchStarted += OnServiceStarted; serviceBrowser.SearchStopped += OnServiceStopped; serviceBrowser.NotSearched += OnServiceNotSearched; serviceBrowser.Schedule(NSRunLoop.Current, NSRunLoopMode.Default.ToString()); serviceBrowser.SearchForServices(Constants.NETWORK_SEARCH, "local"); }
public override void FoundService(NSNetServiceBrowser sender, NSNetService service, bool moreComing) { Debug.WriteLine(String.Format("Found {0}", service.Name)); if (service.Name.Equals("Calabash Server")) { if (successCallback != null) { successCallback(); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); _browserDelegate = new BonjourBrowser(); _browserDelegate.successCallback += () => { statusLabel.Text = "Calabash is running!"; _browser.Stop(); }; _browser = new NSNetServiceBrowser(); _browser.Delegate = _browserDelegate; _browser.SearchForServices("_http._tcp.", "local."); }
public override void ViewDidLoad () { base.ViewDidLoad (); _browserDelegate = new BonjourBrowser (); _browserDelegate.successCallback += ()=> { statusLabel.Text = "Calabash is running!"; _browser.Stop(); }; _browser = new NSNetServiceBrowser (); _browser.Delegate = _browserDelegate; _browser.SearchForServices ("_http._tcp.", "local."); }
static void Enable() { enabled = true; if (browser == null) { browser = new NSNetServiceBrowser (); browser.FoundService += delegate (object sender, NSNetServiceEventArgs e) { if (services == null) services = new ConcurrentDictionary<string, NSNetService> (); var service = e.Service; #if DEBUG service.AddressResolved += (sender2, e2) => { var s = sender2 as NSNetService; Debug.WriteLine ("{0} {1}:{2}", s.Name, s.HostName, s.Port); }; #endif service.Resolve (2.0d); services.TryAdd (service.Name, service); }; browser.ServiceRemoved += delegate (object sender, NSNetServiceEventArgs e) { string name = e.Service.Name; if (!String.IsNullOrEmpty (name)) { NSNetService service; services.TryRemove (name, out service); } }; } browser.SearchForServices ("_airplay._tcp", "local."); }
public override void ServiceRemoved(NSNetServiceBrowser sender, NSNetService service, bool moreComing) { nint idx = (nint)Services.IndexOf(service); Services.RemoveObject(idx); }
public override void NotSearched(NSNetServiceBrowser sender, NSDictionary errors) { Searching = false; HandleError(errors); }
public override void SearchStopped(NSNetServiceBrowser sender) { Console.WriteLine("Started stopped"); Searching = false; UpdateUI(); }
protected override void Initialize() { browser = new NSNetServiceBrowser(); }