Newer
Older
IRIS_REFACTOR_DH / irisRefactor / IrisSound / PlaySound.cs
TAN YUE on 9 Sep 2021 7 KB 20210909 初始提交。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Media;

namespace irisRefactor.IrisSound
{
    class PlaySound
    {
        public static String wavPath = @"wav\";
        public static String wavTempPath = @"wav\temp\";
        public static void recSuccess() //"识别成功"
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavPath + "recSuccess.wav")
                : new SoundPlayer(wavPath + "recSuccessEng.wav");//无语音
            player1.Play();
        }
        
        public static void noPermission() //"无权限"
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
            ? new SoundPlayer(wavPath + "noPermission.wav")
            : new SoundPlayer(wavPath + "noPermissionEng.wav");//无语音
            player1.Play();
        }

        public static void inGreenFrame() //"对准绿框"
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavPath + "inGreenFrame.wav")
                : new SoundPlayer(wavPath + "inGreenFrameEng.wav");
            player1.Play();
        }
        
        public static void recFailureRetry() //"识别失败请重试
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ?new SoundPlayer(wavPath+"recFailureRetry.wav")
                : new SoundPlayer(wavPath + "recFailureRetryEng.wav");
            player1.Play();
        }

        public static void recSuccessOpenDoor() //识别成功请开门
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavPath + "recSuccessOpenDoor.wav")
                : new SoundPlayer(wavPath + "recSuccessOpenDoorEng.wav");
            player1.Play();
        }


        /// <summary>
        /// temp
        /// </summary>
        public static void failedRetry()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "failedRetry.wav")
                : new SoundPlayer(wavTempPath + "failedRetryEng.wav");
            player1.Play();
        }

        public static void successSound(bool hasPermisson)
        {
            if (!ProMemory.appConfig.AuthConfig.HasOpenDoorAuthority)
            {
                switch (ProMemory.tempRegion)
                {
                    case 2:
                        successTempNormal();
                        break;
                    case 3:
                        successTempAbnormal();
                        break;
                    case 4:
                        successTempHigh();
                        break;
                    default:
                        break;
                }
            }
            else
            {
                if (!hasPermisson
                    && ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp)
                {
                    if (ProMemory.tempRegion == 2)
                        successTempNormalNoPower();
                    else
                        successTempAbnormalNoPass();
                }
                else if (hasPermisson
                    && !ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp)
                {
                        successPass();
                }
                else if (hasPermisson
                    && ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp)
                {
                    if (ProMemory.tempRegion == 2)
                            successTempNormalPass();
                    else
                        successTempAbnormalNoPass();
                }
                else if (!hasPermisson
                    && !ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp)
                {
                        successsNoPower();
                }
            }
        }
        
        public static void successTempHigh()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successTempHigh.wav")
                : new SoundPlayer(wavTempPath + "successTempHighEng.wav");
            player1.Play();
        }

        public static void successTempAbnormal()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successTempAbnormal.wav")
                :new SoundPlayer(wavTempPath + "successTempAbnormalEng.wav");
            player1.Play();
        }

        public static void successTempNormal()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successTempNormal.wav")
                : new SoundPlayer(wavTempPath + "successTempNormalEng.wav");
            player1.Play();
        }
        
        public static void successTempAbnormalNoPass()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successTempAbnormalNoPass.wav")
                : new SoundPlayer(wavTempPath + "successTempAbnormalNoPassEng.wav");
            player1.Play();
        }

        public static void successTempNormalPass()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successTempNormalPass.wav")
                : new SoundPlayer(wavTempPath + "successTempNormalPassEng.wav");
            player1.Play();
        }

        public static void successPass()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successPass.wav")
                : new SoundPlayer(wavTempPath + "successPassEng.wav");
            player1.Play();
        }

        public static void successsNoPower()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successsNoPower.wav")
                : new SoundPlayer(wavTempPath + "successsNoPowerEng.wav");
            player1.Play();
        }

        public static void successTempNormalNoPower()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "successTempNormalNoPower.wav")
                : new SoundPlayer(wavTempPath + "successTempNormalNoPowerEng.wav");
            player1.Play();
        }
        
        public static void failedTempNormalPayCard()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "failedTempNormalPayCard.wav")
                : new SoundPlayer(wavTempPath + "failedTempNormalPayCardEng.wav");
            player1.Play();
        }

        public static void failedTempAbnormalNoPass()
        {
            SoundPlayer player1 = ProMemory.appConfig.Language == 1
                ? new SoundPlayer(wavTempPath + "failedTempAbnormalNoPass.wav")
                : new SoundPlayer(wavTempPath + "failedTempAbnormalNoPassEng.wav");
            player1.Play();
        }

        
    }
}