void ConfigureView() { // Update the user interface for the detail item if (IsViewLoaded && DetailItem != null) { detailDescriptionLabel.Text = DetailItem.ToString(); var myDel = new MySimpleCBCentralManagerDelegate(); var myMgr = new CBCentralManager(myDel, DispatchQueue.CurrentQueue); System.Threading.Thread.Sleep(200); MDSWrapper wrapper = new MDSWrapper(); MDSResponseBlock block = new MDSResponseBlock(async(arg0) => DoThing(arg0, wrapper)); MDSEventBlock eventBlock = (MDSEvent arg0) => DoTheOtherThing(arg0, wrapper); wrapper.DoSubscribe("MDS/ConnectedDevices", new Foundation.NSDictionary(), block, eventBlock); } }
/// <summary> /// Setup the (Dis)Connection listener for iOS devices /// </summary> /// <returns></returns> public Task <bool> EnsureInitializedAsync() { setuplistenertcs = new TaskCompletionSource <bool>(); if (!mIsListening) { // Setup the connection listener MDSResponseBlock responseBlock = new MDSResponseBlock((arg0) => MdsConnectionListener.Current.OnListenerSetupCompleted(arg0)); MDSEventBlock eventBlock = (MDSEvent arg0) => MdsConnectionListener.Current.OnDeviceConnectionEvent(arg0); ((MDSWrapper)(CrossMovesense.Current.MdsInstance)).DoSubscribe("MDS/ConnectedDevices", new Foundation.NSDictionary(), responseBlock, eventBlock); } else { // Complete immediately if we've already done this setuplistenertcs?.TrySetResult(true); } return(setuplistenertcs.Task); }