partial void btnAccept(NSObject sender)
 {
     if (connection != null)
     {
         connection.Accept();
     }
 }
 private void SetupDeviceEvents()
 {
     if (_device != null)
     {
         // When a new connection comes in,
         //store it and use it to accept the incoming call.
         _device.ReceivedIncomingConnection += (sender, e) => {
             _connection = e.Connection;
             _connection.Accept();
         };
     }
 }
        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");
            };
        }