partial void btnReject(NSObject sender) { if (connection != null) { connection.Reject(); } }
void SetupDeviceEvents() { device.StoppedListeningForIncomingConnections += delegate { UpdateStatus(); }; device.StartedListeningForIncomingConnections += delegate { UpdateStatus(); }; device.ReceivedIncomingConnection += (sender, e) => { if (connection != null && connection.State == TCConnectionState.Connected) { connection.Disconnect(); } connection = e.Connection; SetupConnectionEvents(); UpdateStatus(); var alert = new UIAlertView("Incoming call", e.Connection.Parameters["From"].ToString(), null, "Answer", new string[] { "Reject" }); alert.Clicked += (s, b) => { //label1.Text = "Button " + b.ButtonIndex.ToString () + " clicked"; //Console.WriteLine ("Button " + b.ButtonIndex.ToString () + " clicked"); if (b.ButtonIndex == 0) { connection.Accept(); } else { connection.Reject(); } }; alert.Show(); }; device.ReceivedPresenceUpdate += delegate { Debug.WriteLine("Received Presence Update"); }; }