Browse Source

添加音频提示

callm 4 years ago
parent
commit
eae77aa66b

BIN
UAS_AutoPass/3291.wav


BIN
UAS_AutoPass/4082.wav


BIN
UAS_AutoPass/5185.wav


BIN
UAS_AutoPass/8378.wav


+ 8 - 0
UAS_AutoPass/AutoAnalysisXml.cs

@@ -8,6 +8,7 @@ using System.Windows.Forms;
 using System.Xml;
 using System.Xml;
 using UAS_AutoPass.ToolClass;
 using UAS_AutoPass.ToolClass;
 using System.Text;
 using System.Text;
+using System.Media;
 
 
 namespace UAS_AutoPass
 namespace UAS_AutoPass
 {
 {
@@ -379,6 +380,7 @@ namespace UAS_AutoPass
                                 OperateResult.AppendText("序列号 " + SN + "已执行过" + istepcode + "\n");
                                 OperateResult.AppendText("序列号 " + SN + "已执行过" + istepcode + "\n");
                                 continue;
                                 continue;
                             }
                             }
+                            SoundPlayer player = new SoundPlayer();
                             switch (Result)
                             switch (Result)
                             {
                             {
                                 case "OK":
                                 case "OK":
@@ -389,6 +391,9 @@ namespace UAS_AutoPass
                                         continue;
                                         continue;
                                     }
                                     }
                                     tipform.startthread("序列号 " + SN + "通过检测", Result);
                                     tipform.startthread("序列号 " + SN + "通过检测", Result);
+                                    player.SoundLocation = Application.StartupPath + @"\8378.wav";
+                                    player.Load();
+                                    player.Play();
                                     break;
                                     break;
                                 case "NG":
                                 case "NG":
                                     RecordBadInfo(SN, makecode, FileName, "", badcode.ToArray(), badlocation.ToArray(), badprod.ToArray());
                                     RecordBadInfo(SN, makecode, FileName, "", badcode.ToArray(), badlocation.ToArray(), badprod.ToArray());
@@ -400,6 +405,9 @@ namespace UAS_AutoPass
                                         continue;
                                         continue;
                                     }
                                     }
                                     tipform.startthread("序列号 " + SN + "未通过检测", Result);
                                     tipform.startthread("序列号 " + SN + "未通过检测", Result);
+                                    player.SoundLocation = Application.StartupPath + @"\5185.wav";
+                                    player.Load();
+                                    player.Play();
                                     break;
                                     break;
                                 default:
                                 default:
                                     break;
                                     break;

+ 17 - 0
UAS_AutoPass/ToolClass/BaseUtil.cs

@@ -128,6 +128,23 @@ namespace UAS_AutoPass.ToolClass
             }
             }
         }
         }
 
 
+
+        //播放音频文件
+        public static void PlaySound(string FileName)
+        {
+            //要加载COM组件:Microsoft speech object Library    
+            if (!System.IO.File.Exists(FileName))
+            {
+                return;
+            }
+            SpeechLib.SpVoiceClass pp = new SpeechLib.SpVoiceClass();
+            SpeechLib.SpFileStreamClass spFs = new SpeechLib.SpFileStreamClass();
+            spFs.Open(FileName, SpeechLib.SpeechStreamFileMode.SSFMOpenForRead, true);
+            SpeechLib.ISpeechBaseStream Istream = spFs as SpeechLib.ISpeechBaseStream;
+            pp.SpeakStream(Istream, SpeechLib.SpeechVoiceSpeakFlags.SVSFIsFilename);
+            spFs.Close();
+        }
+
         public static void GetWriteInfo(string FilePath, out Dictionary<string, string> Dic)
         public static void GetWriteInfo(string FilePath, out Dictionary<string, string> Dic)
         {
         {
             Dic = new Dictionary<string, string>();
             Dic = new Dictionary<string, string>();

+ 14 - 0
UAS_AutoPass/UAS_AutoPass.csproj

@@ -70,6 +70,9 @@
     <SignManifests>false</SignManifests>
     <SignManifests>false</SignManifests>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
+    <Reference Include="ICSharpCode.SharpZipLib">
+      <HintPath>..\UAS_AutoUpdate\tool\ICSharpCode.SharpZipLib.dll</HintPath>
+    </Reference>
     <Reference Include="Oracle.ManagedDataAccess">
     <Reference Include="Oracle.ManagedDataAccess">
       <HintPath>..\UAS_DLLTest\tool\Oracle.ManagedDataAccess.dll</HintPath>
       <HintPath>..\UAS_DLLTest\tool\Oracle.ManagedDataAccess.dll</HintPath>
     </Reference>
     </Reference>
@@ -171,6 +174,17 @@
       <Install>false</Install>
       <Install>false</Install>
     </BootstrapperPackage>
     </BootstrapperPackage>
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <COMReference Include="SpeechLib">
+      <Guid>{C866CA3A-32F7-11D2-9602-00C04F8EE628}</Guid>
+      <VersionMajor>5</VersionMajor>
+      <VersionMinor>4</VersionMinor>
+      <Lcid>0</Lcid>
+      <WrapperTool>tlbimp</WrapperTool>
+      <Isolated>False</Isolated>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+    </COMReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.

BIN
UAS_AutoPass/Windows Background.wav


BIN
UAS_AutoPass/tool/Interop.SpeechLib.dll