partial void swListen(NSObject sender)
        {
            if (device != null)
            {
                if (((UISwitch)sender).On)
                {
                    device.Listen();
                }
                else
                {
                    device.Unlisten();
                }
            }

            Console.WriteLine("listen: " + ((UISwitch)sender).On);
        }
        void SetupOptions()
        {
            muted.ValueChanged += (sender, e) => {
                if (connection != null && connection.State == TCConnectionState.Connected)
                {
                    connection.Muted = muted.Value;
                }
            };

            listening.ValueChanged += (sender, e) => {
                if (device != null)
                {
                    if (listening.Value)
                    {
                        device.Listen();
                    }
                    else
                    {
                        device.Unlisten();
                    }
                }
            };
        }
        public async override void FinishedLaunching(UIApplication application)
        {
            this.Window = new UIWindow(UIScreen.MainScreen.Bounds);

            var client = new HttpClient();
            var token  = await client.GetStringAsync("** Your AuthToken URL goes here **");

            device = new TCDevice(token, null);

            var dialogController = new DialogViewController(new RootElement("Twilio Client Test")
            {
                new Section("Call Options")
                {
                    (numberOrClient = new EntryElement("Target", "Phone # or client name", "")),
                    (callButton = new StyledStatusStringElement("Call", delegate {
                        if (connection == null || connection.State == TCConnectionState.Disconnected)
                        {
                            var param = new TCConnectionParameters {
                                Source = "** Your Twilio Phone Number goes here **",
                                Target = numberOrClient.Value
                            };

                            connection = device.Connect(param, null);

                            SetupConnectionEvents();
                        }
                        else
                        {
                            connection.Disconnect();
                        }
                    })),
                },
                new Section("Status")
                {
                    (deviceState = new StatusStringElement("Device", device.State.ToString())),
                    (connectionState = new StatusStringElement("Connection", "Uninitialized"))
                },

                new Section("Sounds")
                {
                    (disconnectSoundEnabled = new BooleanElement("Disconnect Sound", device.DisconnectSoundEnabled)),
                    (incomingCallSoundEnabled = new BooleanElement("Incoming Sound", device.IncomingSoundEnabled)),
                    (outgoingCallSoundEnabled = new BooleanElement("Outgoing Sound", device.OutgoingSoundEnabled))
                },

                new Section("Options")
                {
                    (muted = new BooleanElement("Muted", false)),
                    (listening = new BooleanElement("Device Listening", true))
                }
            });

            callButton.Alignment = UITextAlignment.Center;
            callButton.TextColor = UIColor.FromRGB(0x00, 0x7A, 0xFF);

            var navigationController = new UINavigationController(dialogController);

            //navigationController.NavigationBar.BarTintColor = UIColor.Red;
            //navigationController.NavigationBar.TintColor = UIColor.White;

            Window.RootViewController = navigationController;

            Window.MakeKeyAndVisible();

            SetupSoundOptionEvents();
            SetupOptions();
            SetupDeviceEvents();
            device.Listen();
        }