protected override void Setup()
        {
            var bluetoothManager        = DependencyService.Get <IManagerManager>().BluetoothManager;
            var deviceInfomationService = new DeviceInfomationServiceBuilder(bluetoothManager).Build();

            SensorSpeed speed = SensorSpeed.Game;

            Gyroscope.ReadingChanged += Gyroscope_ReadingChanged;
            Gyroscope.Start(speed);

            bluetoothManager.GattSever.AddService(new DeviceInfomationServiceBuilder(bluetoothManager).Build());
            bluetoothManager.GattSever.AddService(new RfcommServerServiceWrapper(bluetoothManager).GattServerService);
            KeyboardServiceWrapper = new KeyboardServiceWrapper(bluetoothManager);
            bluetoothManager.GattSever.AddService(KeyboardServiceWrapper.GattServerService);
            bluetoothManager.GattSever.StartAdvertising();

            var createServiceProviderTask = bluetoothManager.CreateRfcommServiceProviderAsync(MouseServiceWrapper.ServiceId);

            createServiceProviderTask.Wait();
            var mouseServiceProvider = createServiceProviderTask.Result;

            mouseServiceProvider.OnConnectionReceived += MouseServiceProvider_OnConnectionReceived;;
            mouseServiceProvider.StartAdvertising();

            var keyManager = DependencyService.Get <IManagerManager>().KeyManager;

            keyManager.VolumnDownKeyDown += KeyManager_VolumnDownKeyDown;
            keyManager.VolumnDownKeyUp   += KeyManager_VolumnDownKeyUp;
            keyManager.VolumnUpKeyDown   += KeyManager_VolumnUpKeyDown;
            keyManager.VolumnUpKeyUp     += KeyManager_VolumnUpKeyUp;
            ButtonStick = Sketch.SketchEngine.Instantiate <LineAreaJoystick <VirtualKeyCode> >();
            ButtonStick.OnAreaStatusChanged += Stick_OnAreaStatusChanged;
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.LSHIFT, -60, 60, 0, float.PositiveInfinity));
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_V, 30, 150, 0, float.PositiveInfinity));
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_R, 120, 240, 0, float.PositiveInfinity));
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.SPACE, 210, 330, 0, float.PositiveInfinity));
            ButtonStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            ButtonStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            ButtonStick.RectTransform.OffsetMin = new Vector2(1178.8f, -428f);
            ButtonStick.RectTransform.OffsetMax = new Vector2(1528.8f, -78f);


            LeftStick = Sketch.SketchEngine.Instantiate <LineAreaJoystick <VirtualKeyCode> >();
            LeftStick.OnAreaStatusChanged += Stick_OnAreaStatusChanged;
            LeftStick.MaxLength            = 120;
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_D, -60, 60, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_W, 30, 150, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_A, 120, 240, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_S, 210, 330, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.LCONTROL, 0, 360, 1f, 1.2f));
            LeftStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            LeftStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            LeftStick.RectTransform.OffsetMin = new Vector2(26f, -457f);
            LeftStick.RectTransform.OffsetMax = new Vector2(376f, -107f);
            LeftStick.Level = 3;

            DirectionPad = Sketch.SketchEngine.Instantiate <LineAreaJoystick <VirtualKeyCode> >();
            DirectionPad.OnAreaStatusChanged += Stick_OnAreaStatusChanged;
            DirectionPad.MaxLength            = 100;
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_Z, -60, 60, 0, float.PositiveInfinity));
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_Q, 30, 150, 0, float.PositiveInfinity));
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_E, 120, 240, 0, float.PositiveInfinity));
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_N, 210, 330, 0, float.PositiveInfinity));
            DirectionPad.RectTransform.AnchorMax = new Vector2(0f, 1f);
            DirectionPad.RectTransform.AnchorMin = new Vector2(0f, 1f);
            DirectionPad.RectTransform.OffsetMin = new Vector2(26f, -807f);
            DirectionPad.RectTransform.OffsetMax = new Vector2(376f, -457f);

            RightStick         = Sketch.SketchEngine.Instantiate <TouchpadJoystick>();
            RightStick.OnMove += RightStick_OnMove;
            RightStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            RightStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            RightStick.RectTransform.OffsetMin = new Vector2(1178.8f, -778f);
            RightStick.RectTransform.OffsetMax = new Vector2(1528.8f, -428f);
            RightStick.Level = 3;
            Sketch.SketchEngine.Instantiate <SketchBorderRenderer>();
            Sketch.SketchEngine.Instantiate <RectTransformFrameRenderer>();
        }
        protected override void Setup()
        {
            base.Setup();
            var bluetoothManager        = DependencyService.Get <IManagerManager>().BluetoothManager;
            var deviceInfomationService = new DeviceInfomationServiceBuilder(bluetoothManager).Build();

            SensorSpeed speed = SensorSpeed.Game;

            Gyroscope.ReadingChanged += Gyroscope_ReadingChanged;
            Gyroscope.Start(speed);
            OrientationSensor.ReadingChanged += OrientationSensor_ReadingChanged;
            OrientationSensor.Start(speed);

            bluetoothManager.GattSever.AddService(new DeviceInfomationServiceBuilder(bluetoothManager).Build());
            bluetoothManager.GattSever.AddService(new RfcommServerServiceWrapper(bluetoothManager).GattServerService);
            KeyboardServiceWrapper = new KeyboardServiceWrapper(bluetoothManager);
            bluetoothManager.GattSever.AddService(KeyboardServiceWrapper.GattServerService);
            bluetoothManager.GattSever.StartAdvertising();

            var createServiceProviderTask = bluetoothManager.CreateRfcommServiceProviderAsync(MouseServiceWrapper.ServiceId);

            createServiceProviderTask.Wait();
            var mouseServiceProvider = createServiceProviderTask.Result;

            mouseServiceProvider.OnConnectionReceived += MouseServiceProvider_OnConnectionReceived;;
            mouseServiceProvider.StartAdvertising();

            var keyManager = DependencyService.Get <IManagerManager>().KeyManager;

            keyManager.VolumnDownKeyDown += KeyManager_VolumnDownKeyDown;
            keyManager.VolumnDownKeyUp   += KeyManager_VolumnDownKeyUp;
            keyManager.VolumnUpKeyDown   += KeyManager_VolumnUpKeyDown;
            keyManager.VolumnUpKeyUp     += KeyManager_VolumnUpKeyUp;

            LeftMouseButton = Sketch.SketchEngine.Instantiate <KeyboardKeyButton>();
            LeftMouseButton.RectTransform.AnchorMax = new Vector2(0f, 1f);
            LeftMouseButton.RectTransform.AnchorMin = new Vector2(0f, 1f);
            LeftMouseButton.RectTransform.OffsetMin = new Vector2(53f, -1157f);
            LeftMouseButton.RectTransform.OffsetMax = new Vector2(403f, -807f);
            LeftMouseButton.KeyDown += LeftMouseButton_KeyDown;
            LeftMouseButton.KeyUp   += LeftMouseButton_KeyUp;

            RightMouseButton = Sketch.SketchEngine.Instantiate <KeyboardKeyButton>();
            RightMouseButton.RectTransform.AnchorMax = new Vector2(0f, 1f);
            RightMouseButton.RectTransform.AnchorMin = new Vector2(0f, 1f);
            RightMouseButton.RectTransform.OffsetMin = new Vector2(53f, -1552f);
            RightMouseButton.RectTransform.OffsetMax = new Vector2(403f, -1202f);
            RightMouseButton.KeyDown += RightMouseButton_KeyDown;
            RightMouseButton.KeyUp   += RightMouseButton_KeyUp;

            StopMouseButton = Sketch.SketchEngine.Instantiate <KeyboardKeyButton>();
            StopMouseButton.RectTransform.AnchorMax = new Vector2(0f, 1f);
            StopMouseButton.RectTransform.AnchorMin = new Vector2(0f, 1f);
            StopMouseButton.RectTransform.OffsetMin = new Vector2(53f, -778f);
            StopMouseButton.RectTransform.OffsetMax = new Vector2(214.6f, -616.4f);
            StopMouseButton.KeyDown += StopMouseButton_KeyDown;
            StopMouseButton.KeyUp   += StopMouseButton_KeyUp;

            DrawAndPressButton = Sketch.SketchEngine.Instantiate <KeyboardKeyButton>();
            DrawAndPressButton.RectTransform.AnchorMax = new Vector2(0f, 1f);
            DrawAndPressButton.RectTransform.AnchorMin = new Vector2(0f, 1f);
            DrawAndPressButton.RectTransform.OffsetMin = new Vector2(688.4f, -778f);
            DrawAndPressButton.RectTransform.OffsetMax = new Vector2(850f, -616.4f);
            DrawAndPressButton.KeyDown += DrawAndPressButton_KeyDown;
            DrawAndPressButton.KeyUp   += DrawAndPressButton_KeyUp;

            MouseStick = Sketch.SketchEngine.Instantiate <TouchpadJoystick>();
            MouseStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            MouseStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            MouseStick.RectTransform.OffsetMin = new Vector2(500f, -1359f);
            MouseStick.RectTransform.OffsetMax = new Vector2(850f, -1009f);
            MouseStick.OnMove += MouseStick_OnMove;

            OpenLazerButton = Sketch.SketchEngine.Instantiate <KeyboardKeyButton>();
            OpenLazerButton.RectTransform.AnchorMax = new Vector2(0f, 1f);
            OpenLazerButton.RectTransform.AnchorMin = new Vector2(0f, 1f);
            OpenLazerButton.RectTransform.OffsetMin = new Vector2(86f, -286.2f);
            OpenLazerButton.RectTransform.OffsetMax = new Vector2(436f, -78.00001f);
            OpenLazerButton.KeyDown += OpenLazerButton_KeyDown;
            OpenLazerButton.KeyUp   += OpenLazerButton_KeyUp;
            Sketch.SketchEngine.Instantiate <SketchBorderRenderer>();
            Sketch.SketchEngine.Instantiate <RectTransformFrameRenderer>();
            _MouseMoving = false;
        }