Query_ShowInstruction.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES.PublicMethod;
  10. namespace UAS_MES.Query
  11. {
  12. public partial class Query_ShowInstruction : Form
  13. {
  14. //文件具体地址
  15. string type = "";
  16. public Query_ShowInstruction(string FileType)
  17. {
  18. InitializeComponent();
  19. MediaPlayer.PlayStateChange += MediaPlayer_PlayStateChange;
  20. type = FileType;
  21. StartPosition = FormStartPosition.CenterScreen;
  22. }
  23. private void MediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
  24. {
  25. if ((int)MediaPlayer.playState == 1)
  26. {
  27. System.Threading.Thread.Sleep(1000);
  28. MediaPlayer.Ctlcontrols.play();
  29. }
  30. }
  31. private void Quert_ShowInstruction_Load(object sender, EventArgs e)
  32. {
  33. switch (BaseUtil.GetFileSuffix(type))
  34. {
  35. case "MP4":
  36. MediaPlayer.Visible = true;
  37. PageView.Visible = false;
  38. PicBox.Visible = false;
  39. MediaPlayer.URL = type;
  40. MediaPlayer.Ctlcontrols.play();
  41. break;
  42. case "PDF":
  43. MediaPlayer.Visible = false;
  44. PageView.Visible = true;
  45. PDFDocument.FilePath = type;
  46. PicBox.Visible = false;
  47. break;
  48. case "JPEG":
  49. MediaPlayer.Visible = false;
  50. PageView.Visible = false;
  51. PicBox.Visible = true;
  52. break;
  53. case "JPG":
  54. MediaPlayer.Visible = false;
  55. PageView.Visible = false;
  56. PicBox.Visible = true;
  57. break;
  58. default:
  59. break;
  60. }
  61. }
  62. }
  63. }