private async Task InitData()
        {
            InitSDK();
            EZOpenSDK.Instance.SetAccessToken(ServiceContext.Instance.YSAccessToken);
            var result = await CameraHelpers.FetchCameraList(0, 10);

            if (result.HasError)
            {
                Toast.MakeText(this, result.Error.Description, ToastLength.Long).Show();
            }
            else
            {
                cameraListAdapter.AddCameras("塔区", result.Model.ToArray());
            }
        }
        private async void SetQuality(PopupWindow window, EZConstants.EZVideoLevel level)
        {
            window.Dismiss();
            if (!ConnectionDetector.IsNetworkAvailable(this))
            {
                // 提示没有连接网络
                Utils.ShowToast(this, Resource.String.realplay_set_fail_network);
                return;
            }
            Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this);
            builder.SetCancelable(false);
            builder.SetMessage(Resource.String.setting_video_level);
            Android.Support.V7.App.AlertDialog dialog = builder.Show();
            var result = await CameraHelpers.SetVideoLevel(camera.DeviceSerial, camera.CameraNo, level);

            dialog.Dismiss();

            if (result.Model)
            {
                camera.SetVideoLevel(videoLevel.Ordinal());
                if (level == EZConstants.EZVideoLevel.VideoLevelHd)
                {
                    btnVideoLevel.Text = GetString(Resource.String.quality_hd);
                }
                else if (level == EZConstants.EZVideoLevel.VideoLevelBalanced)
                {
                    btnVideoLevel.Text = GetString(Resource.String.quality_balanced);
                }
                else if (level == EZConstants.EZVideoLevel.VideoLevelFlunet)
                {
                    btnVideoLevel.Text = GetString(Resource.String.quality_flunet);
                }
                else
                {
                    btnVideoLevel.Text = GetString(Resource.String.quality_flunet);
                }
            }
            else if (result.HasError)
            {
                Toast.MakeText(this, result.Error.Description, ToastLength.Long).Show();
            }

            player.StopPlay();
            SystemClock.Sleep(500);
            player.StartPlay();
        }
        /// <summary>
        /// Sends the command.
        /// </summary>
        /// <param name="cmd">the command</param>
        /// <param name="action">Action.</param>
        private async Task DoCtrl(EZConstants.EZPTZCommand cmd, MotionEventActions action, View container)
        {
            EZConstants.EZPTZAction ptzAction = EZConstants.EZPTZAction.EZPTZActionSTOP;
            if (action == MotionEventActions.Down)
            {
                if (cmd == EZConstants.EZPTZCommand.EZPTZCommandDown)
                {
                    container.SetBackgroundResource(Resource.Drawable.ptz_bottom_sel);
                }
                else if (cmd == EZConstants.EZPTZCommand.EZPTZCommandLeft)
                {
                    container.SetBackgroundResource(Resource.Drawable.ptz_left_sel);
                }
                else if (cmd == EZConstants.EZPTZCommand.EZPTZCommandRight)
                {
                    container.SetBackgroundResource(Resource.Drawable.ptz_right_sel);
                }
                else if (cmd == EZConstants.EZPTZCommand.EZPTZCommandUp)
                {
                    container.SetBackgroundResource(Resource.Drawable.ptz_up_sel);
                }
                if (ctrlCompleted)
                {
                    ctrlCompleted = false;
                    var result = await CameraHelpers.ControlPTZ(camera.DeviceSerial, camera.CameraNo, cmd, EZConstants.EZPTZAction.EZPTZActionSTART, EZConstants.PtzSpeedDefault);

                    if (result.HasError)
                    {
                        Toast.MakeText(this, result.Error.Description, ToastLength.Long).Show();
                    }
                    ctrlCompleted = true;
                }
            }
            else if (action == MotionEventActions.Up)
            {
                container.SetBackgroundResource(Resource.Drawable.ptz_bg);
                var result = await CameraHelpers.ControlPTZ(camera.DeviceSerial, camera.CameraNo, cmd, EZConstants.EZPTZAction.EZPTZActionSTOP, EZConstants.PtzSpeedDefault);

                if (result.HasError)
                {
                    Toast.MakeText(this, result.Error.Description, ToastLength.Long).Show();
                }
            }
        }