示例#1
0
        public async Task <bool> GetAvailabilityAsync()
        {
            var access = await HapticsDevice.RequestAccessAsync();

            if (access == Windows.Devices.Haptics.VibrationAccessStatus.Allowed)
            {
                var device = await HapticsDevice.GetDefaultAsync();

                return(device != null);
            }

            return(true);
        }
示例#2
0
        public async Task VibrateAsync()
        {
            var access = await HapticsDevice.RequestAccessAsync();

            if (access == Windows.Devices.Haptics.VibrationAccessStatus.Allowed)
            {
                var device = await HapticsDevice.GetDefaultAsync();

                if (device != null)
                {
                    device.SimpleHapticsController.SendHapticFeedback(device.SimpleHapticsController.SupportedFeedback[0]);
                }
            }
        }