星火微课系统客户端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ScreenRecordingToolbarWindow.xaml.cs 47KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  1. using Common.system;
  2. using System;
  3. using System.IO;
  4. using System.Threading;
  5. using System.Windows;
  6. using System.Windows.Forms;
  7. using System.Windows.Ink;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. using System.Windows.Threading;
  11. using XHWK.Model;
  12. namespace XHWK.WKTool
  13. {
  14. /// <summary>
  15. /// 录屏工具栏
  16. /// </summary>
  17. public partial class ScreenRecordingToolbarWindow : Window
  18. {
  19. #region 初始变量
  20. /// <summary>
  21. /// 视频保存名称
  22. /// </summary>
  23. private string VideoSavePathName;
  24. /// <summary>
  25. /// 是否首次录屏
  26. /// </summary>
  27. private bool IsFirstRS = true;
  28. /// <summary>
  29. /// 是否暂停
  30. /// </summary>
  31. private bool IsSuspend = true;
  32. /// <summary>
  33. /// 视频信息
  34. /// </summary>
  35. private Model_Video VideoInfo = null;
  36. //声明一个 DrawingAttributes 类型的变量
  37. private DrawingAttributes drawingAttributes;
  38. private DispatcherTimer t = null;
  39. /// <summary>
  40. /// 计时器状态
  41. /// </summary>
  42. private enum State
  43. {
  44. Start,
  45. Pause,
  46. End
  47. }
  48. /// <summary>
  49. /// 状态
  50. /// </summary>
  51. private State _state = State.End;
  52. private KeyboardHookCommon k_hook;
  53. /// <summary>
  54. /// 🖊状态 0红色 1蓝色 10红色批注内 11蓝色批注内
  55. /// </summary>
  56. public int flg = 0;
  57. private System.Timers.Timer timer = new System.Timers.Timer();
  58. #endregion
  59. #region 初始化
  60. /// <summary>
  61. /// 录屏工具栏
  62. /// </summary>
  63. public ScreenRecordingToolbarWindow()
  64. {
  65. InitializeComponent();
  66. ResizeMode = ResizeMode.NoResize;
  67. }
  68. /// <summary>
  69. /// 初始化
  70. /// </summary>
  71. public void Initialize()
  72. {
  73. if (APP.W_PracticeWindow == null)
  74. {
  75. APP.W_PracticeWindow = new PracticeWindow
  76. {
  77. //APP.W_PracticeWindow.Topmost = true;
  78. Width = pwidth,
  79. Height = pHeight,
  80. Left = 0,
  81. Top = 0
  82. };
  83. //practiceWin.Owner = this;
  84. }
  85. APP.W_PracticeWindow.Show();
  86. new Thread(new ThreadStart(new Action(() =>
  87. {
  88. Thread.Sleep(100);
  89. Dispatcher.Invoke(() =>
  90. {
  91. Owner = APP.W_PracticeWindow;
  92. Topmost = true;
  93. });
  94. }))).Start();
  95. APP.W_PracticeWindow.Hide();
  96. //timer = new System.Timers.Timer(200);
  97. //timer.Interval = 300;
  98. //timer.Elapsed += new System.Timers.ElapsedEventHandler(TimerDealy);
  99. //timer.Enabled = true; //启动计时器
  100. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  101. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  102. flg = 0;
  103. k_hook = new KeyboardHookCommon();
  104. k_hook.KeyDownEvent += K_hook_KeyDownEvent;
  105. //创建 DrawingAttributes 类的一个实例
  106. drawingAttributes = new DrawingAttributes();
  107. //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
  108. //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
  109. blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
  110. drawingAttributes.FitToCurve = true;
  111. //隐藏画笔工具栏
  112. //BtnToolbarDown_Click(null, null);
  113. gridToolbar.Visibility = Visibility.Hidden;
  114. gridColour.Visibility = Visibility.Hidden;
  115. gridThickness.Visibility = Visibility.Hidden;
  116. ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar26.png"));//大圆圈三角形
  117. ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
  118. BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
  119. imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
  120. btnBlackPenOne.IsEnabled = false;//蓝笔不可点击
  121. imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
  122. btnBlackPenTwo.IsEnabled = false;//红笔不可点击
  123. //imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar29.png"));
  124. //btnReturn.IsEnabled = true;//返回主界面可点击
  125. txbTime.Visibility = Visibility.Hidden;//时间不显示
  126. BtnRecordingScreen.ToolTip = "开始";
  127. if (t == null)
  128. {
  129. t = new DispatcherTimer();
  130. t.Tick += OnTimer;
  131. t.Interval = new TimeSpan(0, 0, 0, 0, 300);
  132. t.IsEnabled = true;
  133. t.Start();
  134. }
  135. t.Interval = new TimeSpan(0, 0, 0, 0, 300);
  136. //Stack();
  137. //ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar25.png"));
  138. //BtnRecordingScreen_Click(null, null);
  139. }
  140. private void TimerDealy(object o, EventArgs e)
  141. {
  142. Dispatcher.Invoke(() =>
  143. {
  144. if (Left > 1630)
  145. {
  146. return;
  147. }
  148. //获取鼠标在屏幕上的位置
  149. double mouse_x = Form.MousePosition.X; //需要添加引用System.Drawing
  150. double mouse_y = Form.MousePosition.Y;
  151. bool is_in_collasped_range = (mouse_y > Left + Height) || (mouse_x < Left || mouse_x > Left + Width);//缩起的条件
  152. bool is_in_visiable_range = (mouse_y < 1 && mouse_x >= Left && mouse_x <= Left + Width); //展开的条件
  153. if (Left < 1630 && Left >= 0 && is_in_collasped_range)
  154. {
  155. System.Threading.Thread.Sleep(300);
  156. Left += 20 /*-this.ActualWidth - 3*/;
  157. }
  158. else if (Left < 0 && is_in_visiable_range)
  159. {
  160. Left = 1;
  161. }
  162. });
  163. }
  164. private void K_hook_KeyDownEvent(object sender, System.Windows.Forms.KeyEventArgs e)
  165. {
  166. if (e.KeyValue == (int)System.Windows.Forms.Keys.F5 && (int)Control.ModifierKeys == (int)Keys.Control)
  167. {
  168. //开始,暂停
  169. BtnRecordingScreen_Click(null, null);
  170. }
  171. if (e.KeyValue == (int)Keys.S && (int)Control.ModifierKeys == (int)Keys.Control)
  172. {
  173. //结束
  174. BtnStopRecordingScreen_Click(null, null);
  175. }
  176. }
  177. #endregion
  178. #region 事件
  179. /// <summary>
  180. /// 记录上次执行时间
  181. /// </summary>
  182. private DateTime Recorddt = DateTime.Now;
  183. DateTime SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
  184. /// <summary>
  185. /// 时钟回调
  186. /// </summary>
  187. /// <param name="sender"></param>
  188. /// <param name="e"></param>
  189. private void OnTimer(object sender, EventArgs e)
  190. {
  191. switch (_state)
  192. {
  193. case State.Start:
  194. {
  195. DateTime dt = DateTime.Now;
  196. TimeSpan ts = dt.Subtract(Recorddt);//时间差
  197. double tsmi = ts.TotalMilliseconds;
  198. if (tsmi > 500.0)
  199. {
  200. Recorddt = Recorddt.AddMilliseconds(500);
  201. SRTime = SRTime.AddMilliseconds(500);
  202. }
  203. }
  204. break;
  205. case State.Pause:
  206. {
  207. }
  208. break;
  209. case State.End:
  210. {
  211. SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
  212. //_timeSpan = new TimeSpan();
  213. ////_timeSpan = new TimeSpan(0, 23, 12, 45, 54);
  214. }
  215. break;
  216. }
  217. //string time = string.Format("{0:D2}:{1:D2}",/* _timeSpan.Hours,*/ _timeSpan.Minutes, _timeSpan.Seconds);
  218. //char[] times = time.ToCharArray();
  219. if (SRTime.Hour > 0)
  220. {
  221. //Dispatcher.Invoke(() =>
  222. //{
  223. txbTime.Text = SRTime.ToString("HH:mm:ss");
  224. //});
  225. }
  226. else
  227. {
  228. //Dispatcher.Invoke(() =>
  229. //{
  230. txbTime.Text = SRTime.ToString("mm:ss");
  231. //});
  232. }
  233. }
  234. /// <summary>
  235. /// 开始
  236. /// </summary>
  237. /// <param name="sender"></param>
  238. /// <param name="e"></param>
  239. private void Stack()
  240. {
  241. Recorddt = DateTime.Now;
  242. _state = State.Start;
  243. }
  244. /// <summary>
  245. /// 暂停
  246. /// </summary>
  247. private void TimeOut()
  248. {
  249. _state = State.Pause;
  250. }
  251. /// <summary>
  252. /// 结束
  253. /// </summary>
  254. /// <param name="sender"></param>
  255. /// <param name="e"></param>
  256. private void End()
  257. {
  258. _state = State.End;
  259. }
  260. #region 录屏
  261. /// <summary>
  262. /// 设置录屏文件地址
  263. /// </summary>
  264. private void SetUpVideoPathName()
  265. {
  266. //FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
  267. FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  268. FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temprs/");
  269. VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
  270. int num = 1;
  271. while (FileToolsCommon.IsExistFile(VideoSavePathName))
  272. {
  273. VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + "." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
  274. num++;
  275. }
  276. }
  277. /// <summary>
  278. /// 是否已经按下按钮
  279. /// </summary>
  280. private bool IsPressButton = false;
  281. /// <summary>
  282. /// 开始或暂停录制
  283. /// </summary>
  284. /// <param name="sender"></param>
  285. /// <param name="e"></param>
  286. private void BtnRecordingScreen_Click(object sender, RoutedEventArgs e)
  287. {
  288. #region 防止连击
  289. if (IsPressButton)
  290. {
  291. return;
  292. }
  293. else
  294. {
  295. IsPressButton = true;
  296. new Thread(new ThreadStart(new Action(() =>
  297. {
  298. Thread.Sleep(500);
  299. IsPressButton = false;
  300. }))).Start();
  301. }
  302. #endregion
  303. if (IsSuspend)
  304. {
  305. if (IsFirstRS)
  306. {
  307. #region 检测麦克风扬声器是否可用
  308. string audioSpeakerPath = FileToolsCommon.GetFileAbsolutePath("adoS.m");
  309. string audioMicrophonePath = FileToolsCommon.GetFileAbsolutePath("adoM.m");
  310. try
  311. {
  312. FileToolsCommon.DeleteFile(audioSpeakerPath);
  313. FileToolsCommon.DeleteFile(audioMicrophonePath);
  314. }
  315. catch (Exception)
  316. {
  317. }
  318. //扬声器
  319. if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
  320. {
  321. APP.FFmpeg.StopRecordAudio(2);
  322. //Thread.Sleep(500);
  323. //麦克风
  324. if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
  325. {
  326. }
  327. else
  328. {
  329. //无法录制麦克风
  330. MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
  331. if (Res == MessageBoxResult.Cancel)
  332. {
  333. return;
  334. }
  335. }
  336. APP.FFmpeg.StopRecordAudio(1);
  337. }
  338. else
  339. {
  340. //无法录制扬声器音频
  341. MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制音频,是否继续?", "消息提示", MessageBoxButton.OKCancel);
  342. if (Res == MessageBoxResult.Cancel)
  343. {
  344. return;
  345. }
  346. }
  347. #endregion
  348. VideoInfo = new Model_Video
  349. {
  350. VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType")),
  351. WkType = Enum_WKVidetype.RecordingScreen
  352. };
  353. SetUpVideoPathName();
  354. k_hook.Start();//安装键盘钩子
  355. if (APP.W_CountdownWindow == null)
  356. {
  357. APP.W_CountdownWindow = new CountdownWindow();
  358. APP.W_CountdownWindow.Initialize(true, 1800);
  359. //APP.W_CountdownWindow.Topmost = true;
  360. }
  361. else
  362. {
  363. APP.W_CountdownWindow.Initialize(true, 1800);
  364. //APP.W_CountdownWindow.Topmost = true;
  365. }
  366. APP.W_CountdownWindow.Show();
  367. }
  368. IsSuspend = false;
  369. //#region 录像倒计时
  370. //if (APP.W_CountdownWindow == null)
  371. //{
  372. // APP.W_CountdownWindow = new CountdownWindow();
  373. // //APP.W_CountdownWindow.Topmost = true;
  374. //}
  375. //else
  376. //{
  377. // APP.W_CountdownWindow.Initialize();
  378. // //APP.W_CountdownWindow.Topmost = true;
  379. //}
  380. //APP.W_CountdownWindow.Show();
  381. //#endregion
  382. ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar25.png"));//播放状态
  383. ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar14.png"));
  384. BtnStopRecordingScreen.IsEnabled = true; //停止录制按钮可点击
  385. imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar27.png"));
  386. btnBlackPenOne.IsEnabled = true;//蓝笔可点击
  387. imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar28.png"));
  388. btnBlackPenTwo.IsEnabled = true;//红笔可点击
  389. txbTime.Visibility = Visibility.Visible;//时间显示
  390. //imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar30.png"));
  391. //borOne.Background = new SolidColorBrush(Colors.LightBlue);
  392. BtnRecordingScreen.ToolTip = "暂停";
  393. try
  394. {
  395. #region 4秒内不可点击
  396. new Thread(new ThreadStart(new Action(() =>
  397. {
  398. //Dispatcher.Invoke(() =>
  399. //{
  400. // ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
  401. // BtnRecordingScreen.IsEnabled = false;
  402. // BtnStopRecordingScreen.IsEnabled = false;
  403. //});
  404. //Thread.Sleep(4000);
  405. Dispatcher.Invoke(() =>
  406. {
  407. ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar14.png"));
  408. BtnRecordingScreen.IsEnabled = true;
  409. BtnStopRecordingScreen.IsEnabled = true;
  410. });
  411. }))).Start();
  412. #endregion
  413. new Thread(new ThreadStart(new Action(() =>
  414. {
  415. if (IsFirstRS)
  416. {
  417. Thread.Sleep(800);
  418. }
  419. if (APP.FFmpeg.myProcess != null)
  420. {
  421. Thread.Sleep(100);
  422. }
  423. System.Drawing.Size DesktopSize = PrimaryScreen.DESKTOP;
  424. bool SynRes = APP.FFmpeg.StartRecordingVideo(VideoSavePathName, DesktopSize, out string ErrMessage);
  425. Thread.Sleep(1300);
  426. Dispatcher.Invoke(() =>
  427. {
  428. if (!SynRes)
  429. {
  430. MessageWindow.Show(ErrMessage);
  431. //隐藏画笔工具栏
  432. //BtnToolbarDown_Click(null, null);
  433. gridToolbar.Visibility = Visibility.Hidden;
  434. gridColour.Visibility = Visibility.Hidden;
  435. gridThickness.Visibility = Visibility.Hidden;
  436. ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar26.png"));//大圆圈三角形
  437. ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
  438. BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
  439. imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
  440. btnBlackPenOne.IsEnabled = false;//蓝笔不可点击
  441. imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
  442. btnBlackPenTwo.IsEnabled = false;//红笔不可点击
  443. txbTime.Visibility = Visibility.Hidden;//时间不显示
  444. BtnRecordingScreen.ToolTip = "开始";
  445. IsSuspend = true;
  446. IsFirstRS = true;
  447. return;
  448. }
  449. Stack();
  450. });
  451. }))).Start();
  452. }
  453. catch (Exception ex)
  454. {
  455. MessageWindow.Show(ex.Message);
  456. }
  457. IsFirstRS = false;
  458. }
  459. else
  460. {
  461. TimeOut();
  462. IsSuspend = true;
  463. ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar26.png"));//大圆圈三角形
  464. BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
  465. BtnRecordingScreen.ToolTip = "开始";
  466. //imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
  467. //btnBlackPenOne.IsEnabled = false;//蓝笔不可点击
  468. //imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
  469. //btnBlackPenTwo.IsEnabled = false;//红笔不可点击
  470. txbTime.Visibility = Visibility.Hidden;//时间不显示
  471. //imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar29.png"));
  472. //btnReturn.IsEnabled = true;//返回主界面可点击
  473. #region 2秒内不可点击
  474. new Thread(new ThreadStart(new Action(() =>
  475. {
  476. //Dispatcher.Invoke(() =>
  477. //{
  478. // ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
  479. // BtnRecordingScreen.IsEnabled = false;
  480. // BtnStopRecordingScreen.IsEnabled = false;
  481. //});
  482. //Thread.Sleep(2000);
  483. Dispatcher.Invoke(() =>
  484. {
  485. ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar14.png"));
  486. BtnRecordingScreen.IsEnabled = true;
  487. BtnStopRecordingScreen.IsEnabled = true;
  488. });
  489. }))).Start();
  490. #endregion
  491. try
  492. {
  493. APP.FFmpeg.SuspendFFmpeg();
  494. }
  495. catch (Exception ex)
  496. {
  497. MessageWindow.Show(ex.Message);
  498. }
  499. }
  500. }
  501. /// <summary>
  502. /// 停止录像
  503. /// </summary>
  504. /// <param name="sender"></param>
  505. /// <param name="e"></param>
  506. private void BtnStopRecordingScreen_Click(object sender, RoutedEventArgs e)
  507. {
  508. #region 防止连击
  509. if (IsPressButton)
  510. {
  511. return;
  512. }
  513. else
  514. {
  515. IsPressButton = true;
  516. new Thread(new ThreadStart(new Action(() =>
  517. {
  518. Thread.Sleep(500);
  519. IsPressButton = false;
  520. }))).Start();
  521. }
  522. #endregion
  523. k_hook.Stop();
  524. IsSuspend = true;
  525. txbTime.Text = "00:00";
  526. txbTime.Visibility = Visibility.Hidden;
  527. End();
  528. if (APP.W_PracticeWindow != null)
  529. {
  530. if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
  531. {
  532. Owner = null;
  533. APP.W_PracticeWindow.ReturnPractice();
  534. }
  535. }
  536. if (gridToolbar.Visibility == Visibility.Visible)
  537. {
  538. gridToolbar.Visibility = Visibility.Hidden;
  539. gridColour.Visibility = Visibility.Hidden;
  540. gridThickness.Visibility = Visibility.Hidden;
  541. }
  542. if (APP.W_XHMicroLessonSystemWindow == null)
  543. {
  544. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  545. }
  546. APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
  547. APP.W_XHMicroLessonSystemWindow.Show();
  548. if (!IsFirstRS)
  549. {
  550. try
  551. {
  552. if (SRTime.Hour > 0 || SRTime.Minute > 0 || SRTime.Second > 3)
  553. {
  554. try
  555. {
  556. APP.FFmpeg.StopFFmpeg(VideoSavePathName);
  557. }
  558. catch (Exception ex)
  559. {
  560. LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
  561. }
  562. IsFirstRS = true;
  563. //生成缩略图
  564. string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
  565. FileToolsCommon.CreateDirectory(ThumbnailPath);
  566. //缩略图存储位置
  567. string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
  568. new Thread(new ThreadStart(new Action(() =>
  569. {
  570. while (!FileToolsCommon.IsExistFile(VideoSavePathName))
  571. {
  572. Thread.Sleep(100);
  573. }
  574. FileToolsCommon.DeleteFile(ThumbnailPathName);
  575. //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
  576. VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  577. VideoInfo.VideoPath = VideoSavePathName;
  578. VideoInfo.ThumbnailPath = ThumbnailPathName;
  579. APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
  580. VideoInfo.FileGuid = Guid.NewGuid().ToString();
  581. VideoInfo.IsUpload = false;
  582. VideoInfo.Uploaded = 0;
  583. VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
  584. APP.VideoList.Add(VideoInfo);
  585. //保存数据
  586. APP.SaveWkData();
  587. }))).Start();
  588. Click_stopRecordingScreen();
  589. }
  590. else
  591. {
  592. //视频过短
  593. APP.FFmpeg.SuspendFFmpeg();
  594. IsFirstRS = true;
  595. MessageWindow.Show("录屏时间过短,请重新录制!");
  596. }
  597. }
  598. catch (Exception ex)
  599. {
  600. LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
  601. }
  602. }
  603. Hide();
  604. }
  605. #endregion
  606. #region 画笔相关
  607. /// <summary>
  608. /// 画笔工具栏关闭事件
  609. /// </summary>
  610. /// <param name="sender"></param>
  611. /// <param name="e"></param>
  612. private void BtnToolbarDown_Click(object sender, RoutedEventArgs e)
  613. {
  614. gridToolbar.Visibility = Visibility.Hidden;
  615. gridColour.Visibility = Visibility.Hidden;
  616. gridThickness.Visibility = Visibility.Hidden;
  617. APP.W_PracticeWindow.Hide();
  618. }
  619. /// <summary>
  620. /// 画笔点击事件
  621. /// </summary>
  622. /// <param name="sender"></param>
  623. /// <param name="e"></param>
  624. private void BtnBrush_Click(object sender, RoutedEventArgs e)
  625. {
  626. #region 防止连击
  627. if (IsPressButton)
  628. {
  629. return;
  630. }
  631. else
  632. {
  633. IsPressButton = true;
  634. new Thread(new ThreadStart(new Action(() =>
  635. {
  636. Thread.Sleep(500);
  637. IsPressButton = false;
  638. }))).Start();
  639. }
  640. #endregion
  641. string time = GetTimeStamp();
  642. string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
  643. if (!Directory.Exists(tempPath))
  644. {
  645. Directory.CreateDirectory(tempPath);
  646. }
  647. #region 录屏批注取消画笔
  648. //string imagePath = Path.Combine(tempPath, time + ".jpg");
  649. //ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
  650. #endregion
  651. try
  652. {
  653. if (flg == 11)
  654. {
  655. Dispatcher.Invoke(() =>
  656. {
  657. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  658. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  659. });
  660. flg = 1;
  661. //this.Owner = null;
  662. APP.W_PracticeWindow.ReturnPractice();
  663. }
  664. else if (flg == 10)
  665. {
  666. Dispatcher.Invoke(() =>
  667. {
  668. borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
  669. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  670. });
  671. APP.W_PracticeWindow.Blue();
  672. flg = 11;
  673. }
  674. else
  675. {
  676. //new Thread(new ThreadStart(new Action(() =>
  677. //{
  678. Dispatcher.Invoke(() =>
  679. {
  680. borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
  681. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  682. });
  683. //}))).Start();
  684. if (APP.W_PracticeWindow == null)
  685. {
  686. APP.W_PracticeWindow = new PracticeWindow
  687. {
  688. //APP.W_PracticeWindow.Topmost = true;
  689. Width = pwidth,
  690. Height = pHeight,
  691. Left = 0,
  692. Top = 0
  693. };
  694. //practiceWin.Owner = this;
  695. }
  696. APP.W_PracticeWindow.Initialize();// imagePath);
  697. flg = 11;
  698. APP.W_PracticeWindow.Blue();
  699. APP.W_PracticeWindow.Show();
  700. new Thread(new ThreadStart(new Action(() =>
  701. {
  702. Thread.Sleep(100);
  703. Dispatcher.Invoke(() =>
  704. {
  705. Owner = APP.W_PracticeWindow;
  706. Topmost = true;
  707. });
  708. }))).Start();
  709. }
  710. }
  711. catch (Exception ex)
  712. {
  713. LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
  714. }
  715. //imgCanvas.Source = new BitmapImage(new Uri(imagePath));
  716. }
  717. /// <summary>
  718. /// 屏幕宽
  719. /// </summary>
  720. internal double pwidth = SystemParameters.PrimaryScreenWidth;
  721. /// <summary>
  722. /// 屏幕高
  723. /// </summary>
  724. internal double pHeight = SystemParameters.PrimaryScreenHeight;
  725. /// <summary>
  726. /// 获取时间戳
  727. /// </summary>
  728. /// <returns></returns>
  729. public string GetTimeStamp()
  730. {
  731. TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
  732. return Convert.ToInt64(ts.TotalMilliseconds).ToString();
  733. }
  734. /// <summary>
  735. /// 画笔粗细事件
  736. /// </summary>
  737. /// <param name="sender"></param>
  738. /// <param name="e"></param>
  739. private void BtnThickness_Click(object sender, RoutedEventArgs e)
  740. {
  741. gridThickness.Visibility = Visibility.Visible;
  742. gridColour.Visibility = Visibility.Collapsed;
  743. }
  744. /// <summary>
  745. /// 画笔颜色事件
  746. /// </summary>
  747. /// <param name="sender"></param>
  748. /// <param name="e"></param>
  749. private void BtnColour_Click(object sender, RoutedEventArgs e)
  750. {
  751. gridColour.Visibility = Visibility.Visible;
  752. gridThickness.Visibility = Visibility.Collapsed;
  753. }
  754. /// <summary>
  755. /// 白色
  756. /// </summary>
  757. /// <param name="sender"></param>
  758. /// <param name="e"></param>
  759. private void BtnWhite_Click(object sender, RoutedEventArgs e)
  760. {
  761. //drawingAttributes.Color = Colors.White;
  762. APP.W_PracticeWindow.White();
  763. gridColour.Visibility = Visibility.Collapsed;
  764. gridThickness.Visibility = Visibility.Collapsed;
  765. }
  766. /// <summary>
  767. /// 红色
  768. /// </summary>
  769. /// <param name="sender"></param>
  770. /// <param name="e"></param>
  771. private void BtnRed_Click(object sender, RoutedEventArgs e)
  772. {
  773. //drawingAttributes.Color = Colors.Red;
  774. APP.W_PracticeWindow.Red();
  775. gridColour.Visibility = Visibility.Collapsed;
  776. gridThickness.Visibility = Visibility.Collapsed;
  777. }
  778. /// <summary>
  779. /// 黄色
  780. /// </summary>
  781. /// <param name="sender"></param>
  782. /// <param name="e"></param>
  783. private void BtnYellow_Click(object sender, RoutedEventArgs e)
  784. {
  785. //drawingAttributes.Color = Colors.Gold;
  786. APP.W_PracticeWindow.Yellow();
  787. gridColour.Visibility = Visibility.Collapsed;
  788. gridThickness.Visibility = Visibility.Collapsed;
  789. }
  790. /// <summary>
  791. /// 青色
  792. /// </summary>
  793. /// <param name="sender"></param>
  794. /// <param name="e"></param>
  795. private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
  796. {
  797. //drawingAttributes.Color = Colors.LimeGreen;
  798. APP.W_PracticeWindow.CyanBlue();
  799. gridColour.Visibility = Visibility.Collapsed;
  800. gridThickness.Visibility = Visibility.Collapsed;
  801. }
  802. /// <summary>
  803. /// 灰色
  804. /// </summary>
  805. /// <param name="sender"></param>
  806. /// <param name="e"></param>
  807. private void BtnGray_Click(object sender, RoutedEventArgs e)
  808. {
  809. //drawingAttributes.Color = Colors.Gray;
  810. APP.W_PracticeWindow.Gray();
  811. gridColour.Visibility = Visibility.Collapsed;
  812. gridThickness.Visibility = Visibility.Collapsed;
  813. }
  814. /// <summary>
  815. /// 蓝色
  816. /// </summary>
  817. /// <param name="sender"></param>
  818. /// <param name="e"></param>
  819. private void BtnBlue_Click(object sender, RoutedEventArgs e)
  820. {
  821. //drawingAttributes.Color = Colors.DeepSkyBlue;
  822. APP.W_PracticeWindow.Blue();
  823. gridColour.Visibility = Visibility.Collapsed;
  824. gridThickness.Visibility = Visibility.Collapsed;
  825. }
  826. /// <summary>
  827. /// 画笔 细
  828. /// </summary>
  829. /// <param name="sender"></param>
  830. /// <param name="e"></param>
  831. private void BtnFine_Click(object sender, RoutedEventArgs e)
  832. {
  833. APP.W_PracticeWindow.Fine();
  834. gridColour.Visibility = Visibility.Collapsed;
  835. gridThickness.Visibility = Visibility.Collapsed;
  836. }
  837. /// <summary>
  838. /// 画笔 中
  839. /// </summary>
  840. /// <param name="sender"></param>
  841. /// <param name="e"></param>
  842. private void BtnIn_Click(object sender, RoutedEventArgs e)
  843. {
  844. APP.W_PracticeWindow.In();
  845. gridColour.Visibility = Visibility.Collapsed;
  846. gridThickness.Visibility = Visibility.Collapsed;
  847. }
  848. /// <summary>
  849. /// 画笔粗
  850. /// </summary>
  851. /// <param name="sender"></param>
  852. /// <param name="e"></param>
  853. private void BtnCrude_Click(object sender, RoutedEventArgs e)
  854. {
  855. APP.W_PracticeWindow.Crude();
  856. gridColour.Visibility = Visibility.Collapsed;
  857. gridThickness.Visibility = Visibility.Collapsed;
  858. }
  859. /// <summary>
  860. /// 橡皮
  861. /// </summary>
  862. /// <param name="sender"></param>
  863. /// <param name="e"></param>
  864. private void BtnEraser_Click(object sender, RoutedEventArgs e)
  865. {
  866. APP.W_PracticeWindow.Eraser();
  867. }
  868. /// <summary>
  869. /// 🖊
  870. /// </summary>
  871. /// <param name="sender"></param>
  872. /// <param name="e"></param>
  873. private void BtnPen_Click(object sender, RoutedEventArgs e)
  874. {
  875. APP.W_PracticeWindow.Pen();
  876. }
  877. /// <summary>
  878. /// ⚪
  879. /// </summary>
  880. /// <param name="sender"></param>
  881. /// <param name="e"></param>
  882. private void BtnRound_Click(object sender, RoutedEventArgs e)
  883. {
  884. APP.W_PracticeWindow.Round();
  885. }
  886. /// <summary>
  887. /// 矩形
  888. /// </summary>
  889. /// <param name="sender"></param>
  890. /// <param name="e"></param>
  891. private void BtnRectangle_Click(object sender, RoutedEventArgs e)
  892. {
  893. APP.W_PracticeWindow.Rectangle();
  894. }
  895. #endregion
  896. #endregion
  897. /// <summary>
  898. /// 停止录屏
  899. /// </summary>
  900. public delegate void StopRecordingScreen();
  901. /// <summary>
  902. /// 停止录屏
  903. /// </summary>
  904. public event StopRecordingScreen Click_stopRecordingScreen;
  905. /// <summary>
  906. /// 黑笔
  907. /// </summary>
  908. /// <param name="sender"></param>
  909. /// <param name="e"></param>
  910. private void BtnBlackPen_Click(object sender, RoutedEventArgs e)
  911. {
  912. }
  913. /// <summary>
  914. /// 移动工具栏
  915. /// </summary>
  916. /// <param name="sender"></param>
  917. /// <param name="e"></param>
  918. private void Grid_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
  919. {
  920. DragMove();
  921. }
  922. /// <summary>
  923. /// 红笔
  924. /// </summary>
  925. /// <param name="sender"></param>
  926. /// <param name="e"></param>
  927. private void BtnBlackPenTwo_Click(object sender, RoutedEventArgs e)
  928. {
  929. #region 防止连击
  930. if (IsPressButton)
  931. {
  932. return;
  933. }
  934. else
  935. {
  936. IsPressButton = true;
  937. new Thread(new ThreadStart(new Action(() =>
  938. {
  939. Thread.Sleep(500);
  940. IsPressButton = false;
  941. }))).Start();
  942. }
  943. #endregion
  944. string time = GetTimeStamp();
  945. string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
  946. if (!Directory.Exists(tempPath))
  947. {
  948. Directory.CreateDirectory(tempPath);
  949. }
  950. #region 录屏批注取消画笔
  951. string imagePath = Path.Combine(tempPath, time + ".jpg");
  952. ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
  953. #endregion
  954. try
  955. {
  956. if (flg == 10)
  957. {
  958. Dispatcher.Invoke(() =>
  959. {
  960. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  961. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  962. });
  963. flg = 0;
  964. //this.Owner = null;
  965. APP.W_PracticeWindow.ReturnPractice();
  966. }
  967. else if (flg == 11)
  968. {
  969. Dispatcher.Invoke(() =>
  970. {
  971. borTwo.Background = new SolidColorBrush(Colors.LightSkyBlue);
  972. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  973. });
  974. flg = 10;
  975. APP.W_PracticeWindow.Red();
  976. }
  977. else
  978. {
  979. Dispatcher.Invoke(() =>
  980. {
  981. borTwo.Background = new SolidColorBrush(Colors.LightSkyBlue);
  982. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  983. });
  984. if (APP.W_PracticeWindow == null)
  985. {
  986. APP.W_PracticeWindow = new PracticeWindow
  987. {
  988. //APP.W_PracticeWindow.Topmost = true;
  989. Width = pwidth,
  990. Height = pHeight,
  991. Left = 0,
  992. Top = 0
  993. };
  994. //practiceWin.Owner = this;
  995. }
  996. APP.W_PracticeWindow.Initialize();//imagePath);
  997. flg = 10;
  998. APP.W_PracticeWindow.Red();
  999. APP.W_PracticeWindow.Show();
  1000. new Thread(new ThreadStart(new Action(() =>
  1001. {
  1002. Thread.Sleep(100);
  1003. Dispatcher.Invoke(() =>
  1004. {
  1005. Owner = APP.W_PracticeWindow;
  1006. Topmost = true;
  1007. });
  1008. }))).Start();
  1009. }
  1010. }
  1011. catch (Exception ex)
  1012. {
  1013. LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
  1014. }
  1015. }
  1016. /// <summary>
  1017. /// 鼠标右键按下事件 废弃
  1018. /// </summary>
  1019. /// <param name="sender"></param>
  1020. /// <param name="e"></param>
  1021. private void RightButtonDown()
  1022. {
  1023. if (flg > 9)
  1024. {
  1025. Owner = null;
  1026. APP.W_PracticeWindow.Hide();
  1027. }
  1028. else
  1029. {
  1030. //string time = GetTimeStamp();
  1031. string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
  1032. if (!Directory.Exists(tempPath))
  1033. {
  1034. Directory.CreateDirectory(tempPath);
  1035. }
  1036. #region 录屏批注取消画笔
  1037. //string imagePath = Path.Combine(tempPath, time + ".jpg");
  1038. //ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
  1039. #endregion
  1040. try
  1041. {
  1042. if (APP.W_PracticeWindow == null)
  1043. {
  1044. APP.W_PracticeWindow = new PracticeWindow
  1045. {
  1046. //APP.W_PracticeWindow.Topmost = true;
  1047. Width = pwidth,
  1048. Height = pHeight,
  1049. Left = 0,
  1050. Top = 0
  1051. };
  1052. //practiceWin.Owner = this;
  1053. }
  1054. APP.W_PracticeWindow.Initialize();//imagePath);
  1055. if (flg == 0)
  1056. {
  1057. flg = 10;
  1058. APP.W_PracticeWindow.Red();
  1059. }
  1060. else
  1061. {
  1062. flg = 11;
  1063. APP.W_PracticeWindow.Blue();
  1064. }
  1065. APP.W_PracticeWindow.Show();
  1066. }
  1067. catch (Exception ex)
  1068. {
  1069. LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
  1070. }
  1071. }
  1072. }
  1073. /// <summary>
  1074. /// 返回主界面
  1075. /// </summary>
  1076. /// <param name="sender"></param>
  1077. /// <param name="e"></param>
  1078. private void BtnReturn_Click(object sender, RoutedEventArgs e)
  1079. {
  1080. if (!IsFirstRS)
  1081. {
  1082. MessageBoxResult br = MessageWindow.Show("退出将取消保存当前录屏,是否继续?", "提示", MessageBoxButton.OKCancel);
  1083. if (br == MessageBoxResult.Cancel)
  1084. {
  1085. return;
  1086. }
  1087. k_hook.Stop();
  1088. IsSuspend = true;
  1089. txbTime.Text = "00:00";
  1090. txbTime.Visibility = Visibility.Hidden;
  1091. End();
  1092. APP.W_PracticeWindow.ReturnPractice();
  1093. if (APP.W_PracticeWindow != null)
  1094. {
  1095. if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
  1096. {
  1097. APP.W_PracticeWindow.Hide();
  1098. }
  1099. }
  1100. if (gridToolbar.Visibility == Visibility.Visible)
  1101. {
  1102. gridToolbar.Visibility = Visibility.Hidden;
  1103. gridColour.Visibility = Visibility.Hidden;
  1104. gridThickness.Visibility = Visibility.Hidden;
  1105. }
  1106. if (APP.W_XHMicroLessonSystemWindow == null)
  1107. {
  1108. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  1109. }
  1110. try
  1111. {
  1112. try
  1113. {
  1114. APP.FFmpeg.SuspendFFmpeg();
  1115. }
  1116. catch (Exception ex)
  1117. {
  1118. LogHelper.WriteErrLog("【录屏返回】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
  1119. }
  1120. IsFirstRS = true;
  1121. new Thread(new ThreadStart(new Action(() =>
  1122. {
  1123. VideoInfo = null;
  1124. FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temprs/");
  1125. }))).Start();
  1126. }
  1127. catch (Exception ex)
  1128. {
  1129. LogHelper.WriteErrLog("【录屏返回】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
  1130. }
  1131. }
  1132. APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
  1133. APP.W_XHMicroLessonSystemWindow.Show();
  1134. Hide();
  1135. }
  1136. /// <summary>
  1137. /// 批注退出 废弃
  1138. /// </summary>
  1139. public void ReturnPractice()
  1140. {
  1141. new Thread(new ThreadStart(new Action(() =>
  1142. {
  1143. Dispatcher.Invoke(() =>
  1144. {
  1145. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  1146. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  1147. });
  1148. flg = 0;
  1149. Thread.Sleep(500);
  1150. Dispatcher.Invoke(() =>
  1151. {
  1152. Owner = null;
  1153. APP.W_PracticeWindow.Hide();
  1154. });
  1155. }))).Start();
  1156. //Dispatcher.Invoke(() =>
  1157. //{
  1158. // borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  1159. // borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  1160. //});
  1161. //flg = 0;
  1162. //Thread.Sleep(300);
  1163. //APP.W_PracticeWindow.Hide();
  1164. }
  1165. /// <summary>
  1166. /// 修改笔状态
  1167. /// </summary>
  1168. public void ModifyState()
  1169. {
  1170. borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
  1171. borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
  1172. }
  1173. /// <summary>
  1174. /// 切换页面
  1175. /// </summary>
  1176. void SwitchPages()
  1177. {
  1178. //SendKeys.SendWait("%{TAB}");
  1179. MouseEventCommon.MouseMiddleClickEvent(0);
  1180. }
  1181. }
  1182. }