Newer
Older
IRIS_REFACTOR_ZJ / irisRefactor / IrisSound / PlaySound.cs
yxw on 14 Aug 2020 7 KB first commit
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 (ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp
                    && !ProMemory.appConfig.AuthConfig.DoorDt.NeedPermisson)
                {
                    if (ProMemory.tempRegion == 2)
                        successTempNormalPass();
                    else
                        successTempAbnormalNoPass();
                }
                else if (ProMemory.appConfig.AuthConfig.DoorDt.NeedPermisson
                    && !ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp)
                {

                    if (hasPermisson)
                        successPass();
                    else
                        successsNoPower();

                }
                else if (ProMemory.appConfig.AuthConfig.DoorDt.NeedPermisson
                    && ProMemory.appConfig.AuthConfig.DoorDt.CheckTemp)
                {
                    if (ProMemory.tempRegion == 2)
                    {
                        if (hasPermisson)
                            successTempNormalPass();
                        else
                            successTempNormalNoPower();
                    }
                    else
                        successTempAbnormalNoPass();
                }
            }
        }

        public static void successNoSound(bool hasPermission)
        {

        }

        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();
        }
    }
}