AutoAnalysisMenu.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using Metis.AutoAnalysis;
  2. using PaintDotNet.Camera;
  3. using PaintDotNet.Data.Param;
  4. using PaintDotNet.GeneralAnalysis;
  5. using PaintDotNet.GeneralAnalysis.Special;
  6. using StageController;
  7. using System;
  8. using System.Globalization;
  9. using System.Windows.Forms;
  10. namespace PaintDotNet.Menus
  11. {
  12. /// <summary>
  13. /// 通用分析
  14. /// </summary>
  15. internal sealed class AutoAnalysisMenu : PdnMenuItem
  16. {
  17. //样品台管理
  18. private PdnMenuItem menuSampleStageMananger;
  19. //自动分析
  20. private PdnMenuItem menuAutoAnalysis;
  21. public AutoAnalysisMenu(int menuId)
  22. {
  23. InitializeComponent();
  24. this.MenuId = menuId;
  25. }
  26. protected override void OnAppWorkspaceChanged()
  27. {
  28. base.OnAppWorkspaceChanged();
  29. }
  30. private void InitializeComponent()
  31. {
  32. this.menuSampleStageMananger = new PdnMenuItem(ActionType.SampleStageMananger);
  33. this.menuAutoAnalysis = new PdnMenuItem(ActionType.AutoAnalysis);
  34. //
  35. // 主菜单
  36. //
  37. this.DropDownItems.AddRange(new ToolStripItem[] {
  38. this.menuSampleStageMananger,
  39. this.menuAutoAnalysis
  40. });
  41. this.Name = "Menu.AutoAnalysis";
  42. this.Text = PdnResources.GetString("Menu.AutoAnalysis.Text");
  43. //
  44. //
  45. //
  46. this.menuSampleStageMananger.Name = "SampleStageMananger";
  47. menuSampleStageMananger.Click += MenuSampleStageMananger_Click;
  48. this.menuSampleStageMananger.Image = PdnResources.GetImageResource("Icons.SampleStageMananger.png").Reference;
  49. //
  50. //
  51. //
  52. this.menuAutoAnalysis.Name = "AutoAnalysis";
  53. menuAutoAnalysis.Click += MenuAutoAnalysis_Click;
  54. this.menuAutoAnalysis.Image = PdnResources.GetImageResource("Icons.AutoAnalysis.png").Reference;
  55. //
  56. //
  57. // 加载菜单的文字和icon
  58. //
  59. this.LoadNames(this.Name);
  60. this.LoadIcons();
  61. }
  62. private void MenuAutoAnalysis_Click(object sender, EventArgs e)
  63. {
  64. /*if (!CameraManager.IsLive)
  65. {
  66. MessageBox.Show(PdnResources.GetString("AvailableCameras"));
  67. return;
  68. }
  69. if (!AxisController.GetInstance().IsOpen)
  70. {
  71. MessageBox.Show(PdnResources.GetString("Console"));
  72. return;
  73. }*/
  74. Form form = Application.OpenForms["AutoAnalysisDialog"];//尝试获取已经弹出的窗口对象
  75. if (form == null || form.IsDisposed)
  76. {
  77. form = new AutoAnalysisDialog(AppWorkspace);
  78. // form.TopMost = true;
  79. form.Show();
  80. }
  81. else
  82. {
  83. form.Focus();
  84. }
  85. }
  86. private void MenuSampleStageMananger_Click(object sender, EventArgs e)
  87. {
  88. using (var form = new SampleStageManageDialog())
  89. {
  90. form.ShowDialog();
  91. }
  92. }
  93. }
  94. }