MeasureProcedureMenu.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Resources;
  2. using SmartCoalApplication.Actions;
  3. using SmartCoalApplication.Core;
  4. using SmartCoalApplication.MeasureProcedure;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.Windows.Forms;
  10. namespace SmartCoalApplication.Menus
  11. {
  12. /// <summary>
  13. /// 测试规程 测量规程管理
  14. /// </summary>
  15. internal sealed class MeasureProcedureMenu : PdnMenuItem
  16. {
  17. private PdnMenuItem menuModuleSetting;
  18. private PdnMenuItem menuAutoMeasure;
  19. public MeasureProcedureMenu(int menuId)
  20. {
  21. InitializeComponent();
  22. this.MenuId = menuId;
  23. //在脚本中不显示
  24. this.CanUseInScript = false;
  25. this.AutomaticScript = false;
  26. }
  27. protected override void OnAppWorkspaceChanged()
  28. {
  29. base.OnAppWorkspaceChanged();
  30. }
  31. private void InitializeComponent()
  32. {
  33. this.menuModuleSetting = new PdnMenuItem(ActionType.MeasureRuler);
  34. this.menuAutoMeasure = new PdnMenuItem(ActionType.AutoMeasure);
  35. //
  36. // 主菜单
  37. //
  38. this.DropDownItems.AddRange(new ToolStripItem[] {
  39. this.menuAutoMeasure,
  40. this.menuModuleSetting
  41. });
  42. this.Name = "Menu.Setting";
  43. this.Text = PdnResources.GetString("NewTestProcedure");
  44. this.menuModuleSetting.Text = PdnResources.GetString("NewSetTestProcedure");
  45. this.menuModuleSetting.Click += MenuModuleSetting_Click;
  46. this.menuModuleSetting.Image = PdnResources.GetImageResource("Icons.ModuleSetting.png").Reference;
  47. //
  48. // 自动量测
  49. //
  50. this.menuAutoMeasure.Click += new EventHandler(this.MenuAutoMeasure_Click);
  51. this.menuAutoMeasure.Text = PdnResources.GetString("NewStartTestProcedure");
  52. this.menuAutoMeasure.Image = PdnResources.GetImageResource("Icons.AutoMeasure.png").Reference;
  53. ////
  54. //// 加载菜单的文字和icon
  55. ////
  56. //this.LoadNames(this.Name);
  57. this.namesLoaded = true;
  58. this.LoadIcons();
  59. }
  60. /// <summary>
  61. /// 自动量测
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void MenuAutoMeasure_Click(object sender, System.EventArgs e)
  66. {
  67. using (AutomaticMeasurement.AutomaticMeasurement af = new AutomaticMeasurement.AutomaticMeasurement(AppWorkspace))
  68. {
  69. af.StartPosition = FormStartPosition.CenterScreen;
  70. af.ShowDialog(AppWorkspace);
  71. }
  72. }
  73. private void MenuModuleSetting_Click(object sender, EventArgs e)
  74. {
  75. using (MeasureSettingDialog af = new MeasureSettingDialog(AppWorkspace))
  76. {
  77. af.StartPosition = FormStartPosition.CenterScreen;
  78. af.ShowDialog();
  79. }
  80. }
  81. }
  82. }