コード例 #1
0
        private static void popToastReduced()
        {
            // Vibrate:
            if (ApiInformation.IsTypePresent("Windows.Phone.Devices.Notification.VibrationDevice") && !Settings.getSettingBoolean(SettingsConsts.DISABLE_VIBRATION_FOR_NEW_CHAT_MESSAGES))
            {
                VibrationDevice.GetDefault().Vibrate(VIBRATE_TS);
            }

            // Play sound:
            if (!Settings.getSettingBoolean(SettingsConsts.DISABLE_PLAY_SOUND_FOR_NEW_CHAT_MESSAGES))
            {
                SharedUtils.PlaySoundFromUri("ms-winsoundevent:Notification.Default");
            }
        }
コード例 #2
0
        private static void PopToastReduced()
        {
            // Only vibrate or play sound once every VIBRATE_TIMEOUT_TS time span:
            if (DateTime.Now.Subtract(lastVibration).CompareTo(VIBRATE_TIMEOUT_TS) < 0)
            {
                return;
            }
            lastVibration = DateTime.Now;

            // Vibrate:
            if (DeviceFamilyHelper.SupportsVibration() && !Settings.GetSettingBoolean(SettingsConsts.DISABLE_VIBRATION_FOR_NEW_CHAT_MESSAGES))
            {
                SharedUtils.VibratePress(VIBRATE_TS);
            }

            // Play sound:
            if (!Settings.GetSettingBoolean(SettingsConsts.DISABLE_PLAY_SOUND_FOR_NEW_CHAT_MESSAGES))
            {
                SharedUtils.PlaySoundFromUri("ms-winsoundevent:Notification.Default");
            }
        }