星火微课系统客户端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

DeviceWindow.xaml.cs 24KB

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. using Common.system;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Threading;
  6. using System.Windows;
  7. using System.Windows.Input;
  8. using System.Windows.Media.Imaging;
  9. using System.Windows.Threading;
  10. namespace XHWK.WKTool
  11. {
  12. /// <summary>
  13. /// DeviceWindow.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class DeviceWindow : Window
  16. {
  17. public DeviceWindow()
  18. {
  19. InitializeComponent();
  20. }
  21. /// <summary>
  22. /// 初始化
  23. /// </summary>
  24. public void Initialize()
  25. {
  26. TxbCamera.Text = "";
  27. TxbSpeaker.Text = "";
  28. TxbMicrophone.Text = "";
  29. BtnDetection.Content = "开始检测";
  30. HidePage();
  31. GridDetection.Visibility = Visibility.Visible;
  32. }
  33. /// <summary>
  34. /// 窗体移动
  35. /// </summary>
  36. /// <param name="sender"></param>
  37. /// <param name="e"></param>
  38. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  39. {
  40. DragMove();
  41. }
  42. /// <summary>
  43. /// 关闭当前页
  44. /// </summary>
  45. /// <param name="sender"></param>
  46. /// <param name="e"></param>
  47. private void BtnDown_Click(object sender, RoutedEventArgs e)
  48. {
  49. imgPlayer.Visibility = Visibility.Hidden;
  50. try
  51. {
  52. CameraHelper.CloseDevice();
  53. }
  54. catch (Exception)
  55. {
  56. }
  57. Hide();
  58. }
  59. #region 设备检测
  60. /// <summary>
  61. /// 开始检测
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void BtnDetection_Click(object sender, RoutedEventArgs e)
  66. {
  67. string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
  68. FileToolsCommon.CreateDirectory(AudioPath);
  69. string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";//FileToolsCommon.GetFileAbsolutePath("adoS.m");
  70. string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";//FileToolsCommon.GetFileAbsolutePath("adoM.m");
  71. string PhotoPath = AudioPath + "Photo" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
  72. TxbCamera.Text = "检测中...";
  73. TxbSpeaker.Text = "检测中...";
  74. TxbMicrophone.Text = "检测中...";
  75. BtnDetection.Content = "正在检测";
  76. BtnDetection.IsEnabled = false;
  77. try
  78. {
  79. FileToolsCommon.DeleteFile(audioSpeakerPath);
  80. FileToolsCommon.DeleteFile(audioMicrophonePath);
  81. FileToolsCommon.DeleteFile(PhotoPath);
  82. }
  83. catch (Exception)
  84. {
  85. }
  86. new Thread(new ThreadStart(new Action(() =>
  87. {
  88. #region 检测摄像头
  89. try
  90. {
  91. //new Thread(new ThreadStart(new Action(() =>
  92. //{
  93. //Dispatcher.Invoke(() =>
  94. //{
  95. //});
  96. //}))).Start();
  97. Dispatcher.Invoke(() =>
  98. {
  99. CameraHelper.UpdateCameraDevices();
  100. });
  101. Thread.Sleep(500);
  102. if (CameraHelper.CameraDevices != null && CameraHelper.CameraDevices.Count > 0)
  103. {
  104. Dispatcher.Invoke(() =>
  105. {
  106. int CameraIndex = 0;
  107. for (int i = 0; i < CameraHelper.CameraDevices.Count; i++)
  108. {
  109. if (CameraHelper.CameraDevices[i].Name == "screen-capture-recorder")
  110. {
  111. continue;
  112. }
  113. if (CameraHelper.CameraDevices[i].MonikerString == APP.CameraName)
  114. {
  115. CameraIndex = i;
  116. }
  117. }
  118. CameraHelper.SetCameraDevice(CameraIndex);
  119. });
  120. Thread.Sleep(2000);
  121. //while()
  122. Dispatcher.Invoke(() =>
  123. {
  124. long time = Timestamp();
  125. string path = CameraHelper.CaptureImage(PhotoPath, time.ToString());
  126. if (string.IsNullOrWhiteSpace(path))
  127. {
  128. TxbCamera.Text = "不可用";
  129. }
  130. else
  131. {
  132. TxbCamera.Text = "正常";
  133. }
  134. CameraHelper.CloseDevice();
  135. });
  136. }
  137. else
  138. {
  139. Dispatcher.Invoke(() =>
  140. {
  141. TxbCamera.Text = "无设备";
  142. });
  143. }
  144. }
  145. catch (Exception)
  146. {
  147. Dispatcher.Invoke(() =>
  148. {
  149. TxbCamera.Text = "不可用";
  150. });
  151. }
  152. #endregion
  153. #region 检测扬声器
  154. if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
  155. {
  156. Dispatcher.Invoke(() =>
  157. {
  158. TxbSpeaker.Text = "正常";
  159. });
  160. }
  161. else
  162. {
  163. //无法录制扬声器音频
  164. Dispatcher.Invoke(() =>
  165. {
  166. TxbSpeaker.Text = "不可用";
  167. });
  168. }
  169. APP.FFmpeg.StopRecordAudio(2);
  170. #endregion
  171. Thread.Sleep(300);
  172. #region 检测麦克风
  173. if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath, APP.MicrophoneName))
  174. {
  175. Dispatcher.Invoke(() =>
  176. {
  177. TxbMicrophone.Text = "正常";
  178. });
  179. }
  180. else
  181. {
  182. //无法录制麦克风
  183. Dispatcher.Invoke(() =>
  184. {
  185. TxbMicrophone.Text = "不可用";
  186. });
  187. }
  188. APP.FFmpeg.StopRecordAudio(1);
  189. #endregion
  190. Dispatcher.Invoke(() =>
  191. {
  192. BtnDetection.Content = "再次检测";
  193. BtnDetection.IsEnabled = true;
  194. });
  195. }))).Start();
  196. }
  197. /// <summary>
  198. /// 返回一个时间戳到毫秒
  199. /// </summary>
  200. /// <returns></returns>
  201. public static long Timestamp()
  202. {
  203. TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
  204. long timestr = Convert.ToInt64(ts.TotalMilliseconds);
  205. return timestr;
  206. }
  207. #endregion
  208. #region 摄像头
  209. /// <summary>
  210. /// 设置摄像头
  211. /// </summary>
  212. /// <param name="sender"></param>
  213. /// <param name="e"></param>
  214. private void BtnCameraSave_Click(object sender, RoutedEventArgs e)
  215. {
  216. for (int i = 0; i < CameraHelper.CameraDevices.Count; i++)
  217. {
  218. if (CameraHelper.CameraDevices[i].Name == "screen-capture-recorder")
  219. {
  220. continue;
  221. }
  222. if (CameraHelper.CameraDevices[i].Name == CmbCameraList.Text)
  223. {
  224. APP.CameraName = CameraHelper.CameraDevices[i].Name;
  225. }
  226. }
  227. times.Enabled = false;
  228. imgPlayer.Visibility = Visibility.Hidden;
  229. try
  230. {
  231. CameraHelper.CloseDevice();
  232. }
  233. catch (Exception)
  234. {
  235. }
  236. I = 9999;
  237. //APP.CameraListIndex = CmbCameraList.SelectedIndex;
  238. }
  239. /// <summary>
  240. /// 检测
  241. /// </summary>
  242. /// <param name="sender"></param>
  243. /// <param name="e"></param>
  244. private void BtnCameraStat_Click(object sender, RoutedEventArgs e)
  245. {
  246. try
  247. {
  248. imgPlayer.Visibility = Visibility.Visible;
  249. CameraHelper.UpdateCameraDevices();
  250. if (CameraHelper.CameraDevices.Count > 0)
  251. {
  252. int CameraIndex = 0;
  253. for (int i = 0; i < CameraHelper.CameraDevices.Count; i++)
  254. {
  255. if (CameraHelper.CameraDevices[i].Name == "screen-capture-recorder")
  256. {
  257. continue;
  258. }
  259. if (CameraHelper.CameraDevices[i].MonikerString == APP.CameraName)
  260. {
  261. CameraIndex = i;
  262. }
  263. }
  264. CameraHelper.SetCameraDevice(CameraIndex);
  265. string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayertest");
  266. FileToolsCommon.CreateDirectory(imgPath);
  267. times = new System.Timers.Timer(200)//初始值为300
  268. {
  269. AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
  270. };//设置执行一次(false)还是一直执行(true)
  271. times.Elapsed += new System.Timers.ElapsedEventHandler(Times_Elapsed);
  272. times.Enabled = true; //启动计时器
  273. }
  274. }
  275. catch (Exception ex)
  276. {
  277. LogHelper.WriteErrLog("【摄像头检测】(DeviceWindow)摄像头不可用:" + ex.Message, ex);
  278. }
  279. }
  280. /// <summary>
  281. /// 停止
  282. /// </summary>
  283. /// <param name="sender"></param>
  284. /// <param name="e"></param>
  285. private void BtnCameraStop_Click(object sender, RoutedEventArgs e)
  286. {
  287. times.Enabled = false;
  288. imgPlayer.Visibility = Visibility.Hidden;
  289. try
  290. {
  291. CameraHelper.CloseDevice();
  292. }
  293. catch (Exception ex)
  294. {
  295. LogHelper.WriteErrLog("【摄像头检测】(DeviceWindow)摄像头不可用:" + ex.Message, ex);
  296. }
  297. I = 9999;
  298. }
  299. #region 检测摄像头
  300. private System.Timers.Timer times;
  301. private int I = 9999;
  302. private void Times_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
  303. {
  304. try
  305. {
  306. Dispatcher.Invoke(() =>
  307. {
  308. if (I > 10010)
  309. {
  310. long time = Timestamp();
  311. string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayertest");
  312. //string FilePathName = ImgPath + RsImgName.Count + ".png";
  313. string path = CameraHelper.CaptureImage(imgPath, time.ToString());
  314. if (!string.IsNullOrWhiteSpace(path))
  315. {
  316. imgPlayer.Source = new BitmapImage(new Uri(path));
  317. }
  318. }
  319. I++;
  320. });
  321. }
  322. catch (Exception ex)
  323. {
  324. LogHelper.WriteErrLog("【摄像】(Times_Elapsed)生成图片错误:" + ex.Message, ex);
  325. }
  326. }
  327. #endregion
  328. #endregion
  329. #region 扬声器
  330. /// <summary>
  331. /// 检测扬声器
  332. /// </summary>
  333. /// <param name="sender"></param>
  334. /// <param name="e"></param>
  335. private void BtnSpeakerDetection_Click(object sender, RoutedEventArgs e)
  336. {
  337. string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
  338. FileToolsCommon.CreateDirectory(AudioPath);
  339. string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
  340. TbxSpeakerDetection.Text = "检测中...";
  341. BtnSpeakerDetection.Content = "正在检测";
  342. BtnSpeakerDetection.IsEnabled = false;
  343. new Thread(new ThreadStart(new Action(() =>
  344. {
  345. Dispatcher.Invoke(() =>
  346. {
  347. MediaAudio.Play();
  348. });
  349. Thread.Sleep(4000);
  350. #region 检测扬声器
  351. if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
  352. {
  353. Dispatcher.Invoke(() =>
  354. {
  355. TbxSpeakerDetection.Text = "正常";
  356. });
  357. }
  358. else
  359. {
  360. //无法录制扬声器音频
  361. Dispatcher.Invoke(() =>
  362. {
  363. TbxSpeakerDetection.Text = "不可用";
  364. });
  365. }
  366. APP.FFmpeg.StopRecordAudio(2);
  367. #endregion
  368. Dispatcher.Invoke(() =>
  369. {
  370. BtnSpeakerDetection.Content = "再次检测";
  371. BtnSpeakerDetection.IsEnabled = true;
  372. });
  373. }))).Start();
  374. }
  375. #region 音频播放
  376. ///// <summary>
  377. ///// 计时器
  378. ///// </summary>
  379. //DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); // 定义一个DT
  380. /// <summary>
  381. /// 音频播放 同步进度条和视频进度
  382. /// </summary>
  383. /// <param name="sender"></param>
  384. /// <param name="e"></param>
  385. private void MediaAudio_MediaOpened(object sender, RoutedEventArgs e)
  386. {
  387. //timelineSlider.Maximum = MediaAudio.NaturalDuration.TimeSpan.TotalMilliseconds; //设置slider最大值
  388. //int sec = (int)MediaAudio.NaturalDuration.TimeSpan.TotalSeconds;
  389. //dispatcherTimer.Start(); //DT启动
  390. }
  391. /// <summary>
  392. /// slider滑动值随播放内容位置变化
  393. /// </summary>
  394. /// <param name="sender"></param>
  395. /// <param name="e"></param>
  396. private void dispatcherTimer_Tick(object sender, EventArgs e)
  397. {
  398. //timelineSlider.Value = MediaAudio.Position.TotalMilliseconds; //slider滑动值随播放内容位置变化
  399. }
  400. private void MediaAudio_MediaEnded(object sender, RoutedEventArgs e)
  401. {
  402. //dispatcherTimer.Stop();
  403. //timelineSlider.Value = 0;
  404. MediaAudio.Stop();
  405. MediaAudio.Position = TimeSpan.Zero;
  406. }
  407. #endregion
  408. #endregion
  409. #region 麦克风
  410. /// <summary>
  411. /// 设置麦克风
  412. /// </summary>
  413. /// <param name="sender"></param>
  414. /// <param name="e"></param>
  415. private void BtnMicrophoneSave_Click(object sender, RoutedEventArgs e)
  416. {
  417. //CmbMicrophoneList.SelectedValue.ToString();
  418. APP.MicrophoneName = CmbMicrophoneList.Text;
  419. }
  420. /// <summary>
  421. /// 加载麦克风列表
  422. /// </summary>
  423. void lodingMicrophoneList()
  424. {
  425. //string name = APP.FFmpeg.GetMicrophoneName();
  426. //List<string> MicrophoneList = APP.FFmpeg.GetMicrophoneNameList();
  427. }
  428. /// <summary>
  429. /// 检测麦克风
  430. /// </summary>
  431. /// <param name="sender"></param>
  432. /// <param name="e"></param>
  433. private void BtnMicrophoneDetection_Click(object sender, RoutedEventArgs e)
  434. {
  435. BtnMicrophoneDetectionPlay.Visibility = Visibility.Hidden;
  436. string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
  437. FileToolsCommon.CreateDirectory(AudioPath);
  438. string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".mp3";
  439. TbxMicrophoneDetection.Text = "录制中...";
  440. BtnMicrophoneDetection.Content = "正在录制";
  441. BtnMicrophoneDetection.IsEnabled = false;
  442. new Thread(new ThreadStart(new Action(() =>
  443. {
  444. #region 检测麦克风
  445. bool Record = APP.FFmpeg.StartRecordAudio(audioMicrophonePath, APP.MicrophoneName, false);
  446. Thread.Sleep(5000);
  447. if (Record)
  448. {
  449. Dispatcher.Invoke(() =>
  450. {
  451. TbxMicrophoneDetection.Text = "录制成功";
  452. BtnMicrophoneDetectionPlay.Visibility = Visibility.Visible;
  453. MediaAudioMicPlay.Source = new Uri(audioMicrophonePath);
  454. });
  455. }
  456. else
  457. {
  458. //无法录制麦克风
  459. Dispatcher.Invoke(() =>
  460. {
  461. TbxMicrophoneDetection.Text = "不可用";
  462. BtnMicrophoneDetectionPlay.Visibility = Visibility.Hidden;
  463. });
  464. }
  465. APP.FFmpeg.StopRecordAudio(1);
  466. #endregion
  467. Dispatcher.Invoke(() =>
  468. {
  469. BtnMicrophoneDetection.Content = "重新录制";
  470. BtnMicrophoneDetection.IsEnabled = true;
  471. });
  472. }))).Start();
  473. }
  474. /// <summary>
  475. /// 播放录音
  476. /// </summary>
  477. /// <param name="sender"></param>
  478. /// <param name="e"></param>
  479. private void BtnMicrophoneDetectionPlay_Click(object sender, RoutedEventArgs e)
  480. {
  481. BtnMicrophoneDetectionPlay.Content = "播放中";
  482. BtnMicrophoneDetectionPlay.IsEnabled = false;
  483. MediaAudioMicPlay.Play();
  484. }
  485. /// <summary>
  486. /// 播放结束
  487. /// </summary>
  488. /// <param name="sender"></param>
  489. /// <param name="e"></param>
  490. private void MediaAudioMicPlay_MediaEnded(object sender, RoutedEventArgs e)
  491. {
  492. MediaAudioMicPlay.Stop();
  493. MediaAudioMicPlay.Position = TimeSpan.Zero;
  494. BtnMicrophoneDetectionPlay.Content = "播放";
  495. BtnMicrophoneDetectionPlay.IsEnabled = true;
  496. }
  497. #endregion
  498. #region 页面切换
  499. /// <summary>
  500. /// 摄像头
  501. /// </summary>
  502. /// <param name="sender"></param>
  503. /// <param name="e"></param>
  504. private void BtnCamera_Click(object sender, RoutedEventArgs e)
  505. {
  506. HidePage();
  507. GridCamera.Visibility = Visibility.Visible;
  508. DataTable data = new DataTable();
  509. CameraHelper.UpdateCameraDevices();
  510. if (CameraHelper.CameraDevices.Count > 0)
  511. {
  512. data.Columns.Add("Value");
  513. data.Columns.Add("Key");
  514. for (int i = 0; i < CameraHelper.CameraDevices.Count; i++)
  515. {
  516. if (CameraHelper.CameraDevices[i].Name == "screen-capture-recorder")
  517. {
  518. continue;
  519. }
  520. //创建一行
  521. DataRow row = data.NewRow();
  522. //将此行添加到table中
  523. data.Rows.Add(row);
  524. data.Rows[i]["Value"] = CameraHelper.CameraDevices[i].Name;
  525. data.Rows[i]["Key"] = i.ToString();
  526. }
  527. CmbCameraList.ItemsSource = data.DefaultView;
  528. int CameraIndex = 0;
  529. for (int i = 0; i < CameraHelper.CameraDevices.Count; i++)
  530. {
  531. if (CameraHelper.CameraDevices[i].Name == "screen-capture-recorder")
  532. {
  533. continue;
  534. }
  535. if (CameraHelper.CameraDevices[i].MonikerString == APP.CameraName)
  536. {
  537. CameraIndex = i;
  538. }
  539. }
  540. CmbCameraList.SelectedIndex = CameraIndex;
  541. }
  542. }
  543. /// <summary>
  544. /// 扬声器
  545. /// </summary>
  546. /// <param name="sender"></param>
  547. /// <param name="e"></param>
  548. private void BtnSpeaker_Click(object sender, RoutedEventArgs e)
  549. {
  550. HidePage();
  551. GridSpeaker.Visibility = Visibility.Visible;
  552. MediaAudio.Source = new Uri(FileToolsCommon.GetFileAbsolutePath("/Resources/AudioFrequency.mp3"));
  553. //dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); //超过计时间隔时发生
  554. //dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); //DT间隔
  555. }
  556. /// <summary>
  557. /// 麦克风
  558. /// </summary>
  559. /// <param name="sender"></param>
  560. /// <param name="e"></param>
  561. private void BtnMicrophone_Click(object sender, RoutedEventArgs e)
  562. {
  563. HidePage();
  564. GridMicrophone.Visibility = Visibility.Visible;
  565. BtnMicrophoneDetectionPlay.Visibility = Visibility.Hidden;
  566. string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
  567. FileToolsCommon.DeleteDirectory(AudioPath);
  568. DataTable data = new DataTable();
  569. List<string> MicrophoneList = APP.FFmpeg.GetMicrophoneNameList();
  570. if (MicrophoneList.Count > 0)
  571. {
  572. data.Columns.Add("Value");
  573. data.Columns.Add("Key");
  574. for (int i = 0; i < MicrophoneList.Count; i++)
  575. {
  576. //创建一行
  577. DataRow row = data.NewRow();
  578. //将此行添加到table中
  579. data.Rows.Add(row);
  580. data.Rows[i]["Value"] = MicrophoneList[i];
  581. data.Rows[i]["Key"] = i.ToString();
  582. }
  583. CmbMicrophoneList.ItemsSource = data.DefaultView;
  584. int CameraIndex = 0;
  585. if (MicrophoneList.Exists(x => x == APP.MicrophoneName))
  586. {
  587. CameraIndex = MicrophoneList.FindIndex(x => x == APP.MicrophoneName);
  588. }
  589. CmbMicrophoneList.SelectedIndex = CameraIndex;
  590. }
  591. }
  592. /// <summary>
  593. /// 检测页
  594. /// </summary>
  595. /// <param name="sender"></param>
  596. /// <param name="e"></param>
  597. private void BtnDetectionPage_Click(object sender, RoutedEventArgs e)
  598. {
  599. HidePage();
  600. GridDetection.Visibility = Visibility.Visible;
  601. }
  602. /// <summary>
  603. /// 隐藏页
  604. /// </summary>
  605. void HidePage()
  606. {
  607. GridDetection.Visibility = Visibility.Collapsed;
  608. GridCamera.Visibility = Visibility.Collapsed;
  609. GridSpeaker.Visibility = Visibility.Collapsed;
  610. GridMicrophone.Visibility = Visibility.Collapsed;
  611. try
  612. {
  613. CameraHelper.CloseDevice();
  614. }
  615. catch (Exception)
  616. {
  617. }
  618. }
  619. #endregion
  620. }
  621. }