SettingMenu.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. using Resources;
  2. using SmartCoalApplication.Annotation.Enum;
  3. using SmartCoalApplication.Core;
  4. using SmartCoalApplication.Instrument;
  5. using SmartCoalApplication.Measure;
  6. using SmartCoalApplication.MeasureProcedure;
  7. using SmartCoalApplication.Rule;
  8. using SmartCoalApplication.Setup;
  9. using SmartCoalApplication.SystemLayer;
  10. using System;
  11. using System.Diagnostics;
  12. using System.Threading;
  13. using System.Windows.Forms;
  14. namespace SmartCoalApplication.Menus
  15. {
  16. /// <summary>
  17. /// 测试规程菜单=>设置
  18. /// </summary>
  19. internal sealed class SettingMenu : PdnMenuItem
  20. {
  21. ////测量规程管理
  22. //private PdnMenuItem menuToolsGridLine;
  23. //测量线设置
  24. private PdnMenuItem menuMeasureLineSetting;
  25. //测量区域设置
  26. private PdnMenuItem menuMeasureRectSetting;
  27. //分隔线
  28. private ToolStripSeparator menuToolsSeperator1;
  29. //标尺标定
  30. private PdnMenuItem menuRulerTools;
  31. //标尺标定子菜单
  32. //标尺标定
  33. private PdnMenuItem menuSubRulerCalibration;
  34. //应用当前
  35. private PdnMenuItem menuSubApplyCurrent;
  36. //应用全部
  37. private PdnMenuItem menuSubApplyAll;
  38. //分隔线
  39. private ToolStripSeparator menuToolsSeperator7;
  40. //模块管理
  41. private PdnMenuItem menuModulesManager;
  42. //自定义软件界面
  43. private PdnMenuItem menuCustomToolBar;
  44. //分隔线
  45. private ToolStripSeparator menuToolsSeperator8;
  46. //基本信息设置
  47. private PdnMenuItem menuBasicInfoSetting;
  48. //基本设置
  49. private PdnMenuItem menuBasicSetting;
  50. //基本设置
  51. private PdnMenuItem fileNamingRules;
  52. //基本设置
  53. private PdnMenuItem auxiliaryLineSetting;
  54. //测试规程导入导出
  55. private PdnMenuItem measureProcedureImport;
  56. public SettingMenu(int menuId)
  57. {
  58. InitializeComponent();
  59. this.MenuId = menuId;
  60. }
  61. private void InitializeComponent()
  62. {
  63. //this.menuToolsGridLine = new PdnMenuItem(ActionType.GridLine, true);
  64. this.menuMeasureLineSetting = new PdnMenuItem(ActionType.MenuMeasureLineSetting);
  65. this.menuMeasureRectSetting = new PdnMenuItem(ActionType.MenuMeasureRectSetting);
  66. this.menuToolsSeperator1 = new ToolStripSeparator();
  67. this.menuRulerTools = new PdnMenuItem(ActionType.MenuRulerTools);
  68. this.menuToolsSeperator7 = new ToolStripSeparator();
  69. this.menuModulesManager = new PdnMenuItem(ActionType.ModuleSetting);
  70. this.menuCustomToolBar = new PdnMenuItem(ActionType.CustomToolBar);
  71. this.menuToolsSeperator8 = new ToolStripSeparator();
  72. this.menuBasicInfoSetting = new PdnMenuItem(ActionType.BasicInfoSetting);
  73. this.menuBasicSetting = new PdnMenuItem(ActionType.BasicSetting);
  74. this.menuSubRulerCalibration = new PdnMenuItem(ActionType.SubRulerCalibration);
  75. this.menuSubApplyCurrent = new PdnMenuItem(ActionType.SubApplyCurrent);
  76. this.menuSubApplyAll = new PdnMenuItem(ActionType.SubApplyAll);
  77. this.fileNamingRules = new PdnMenuItem(ActionType.FileNamingRules);
  78. this.auxiliaryLineSetting = new PdnMenuItem(ActionType.AuxiliaryLineSetting);
  79. this.measureProcedureImport = new PdnMenuItem(ActionType.MeasureProcedureImport);
  80. //
  81. // 标尺标定
  82. //
  83. //this.menuRulerCalibration.NeedWaitKey = true;
  84. this.menuRulerTools.DropDownItems.AddRange(new ToolStripItem[] {
  85. this.menuSubRulerCalibration,
  86. this.menuSubApplyCurrent,
  87. this.menuSubApplyAll
  88. });
  89. //
  90. // MeasureManagerMenu
  91. //
  92. this.DropDownItems.AddRange(
  93. new ToolStripItem[]
  94. {
  95. //this.menuToolsGridLine,
  96. this.menuMeasureLineSetting,
  97. this.menuMeasureRectSetting,
  98. this.menuToolsSeperator1,
  99. this.menuRulerTools,
  100. this.menuToolsSeperator7,
  101. this.menuModulesManager,
  102. this.menuCustomToolBar,
  103. this.menuToolsSeperator8,
  104. this.menuBasicInfoSetting,
  105. this.menuBasicSetting,
  106. this.fileNamingRules,
  107. this.auxiliaryLineSetting,
  108. this.measureProcedureImport
  109. });
  110. this.Name = "Menu.Tools";
  111. this.Text = PdnResources.GetString("NewSetting");
  112. //
  113. // 标尺标定(子菜单)
  114. //
  115. this.menuSubRulerCalibration.Text = PdnResources.GetString("Menu.MeasureAction.RulerCalibration.Text");
  116. this.menuSubRulerCalibration.NeedWaitKey = true;
  117. this.menuSubRulerCalibration.Click += new EventHandler(MenuToolsViewRuler_Click);
  118. this.menuSubRulerCalibration.Image = PdnResources.GetImageResource("Icons.MenuRulerCalibration.png").Reference;
  119. //
  120. // 应用当前
  121. //
  122. this.menuSubApplyCurrent.Text = PdnResources.GetString("Menu.Imagement.Rulersetting.current.text");
  123. this.menuSubApplyCurrent.NeedWaitKey = true;
  124. this.menuSubApplyCurrent.Click += new EventHandler(MenuSubApplyCurrent_Click);
  125. this.menuSubApplyCurrent.Image = PdnResources.GetImageResource("Icons.MenuNow.png").Reference;
  126. //
  127. // 应用全部
  128. //
  129. this.menuSubApplyAll.Text = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Applytoall.text");
  130. this.menuSubApplyAll.NeedWaitKey = true;
  131. this.menuSubApplyAll.Click += new EventHandler(MenuSubApplyAll_Click);
  132. this.menuSubApplyAll.Image = PdnResources.GetImageResource("Icons.MenuAll.png").Reference;
  133. //
  134. // 测量线设置
  135. //
  136. this.menuMeasureLineSetting.Click += new EventHandler(MenuToolsAuxiliaryLine_Click);
  137. this.menuMeasureLineSetting.Text = PdnResources.GetString("NewMeasureLineSetting");
  138. this.menuMeasureLineSetting.Image = PdnResources.GetImageResource("Icons.MeasureLineSetting.png").Reference;
  139. //
  140. // 测量区域设置
  141. //
  142. this.menuMeasureRectSetting.Click += new EventHandler(MenuToolsCustomInterface_Click);
  143. this.menuMeasureRectSetting.Text = PdnResources.GetString("NewMeasureRectSetting");
  144. this.menuMeasureRectSetting.Image = PdnResources.GetImageResource("Icons.MeasureRectSetting.png").Reference;
  145. //
  146. // 标尺标定
  147. //
  148. //this.menuRulerTools.Click += new EventHandler(MenuToolsViewRuler_Click);
  149. this.menuRulerTools.Text = PdnResources.GetString("NewRulerTools");
  150. this.menuRulerTools.Image = PdnResources.GetImageResource("Icons.RulerTools.png").Reference;
  151. //
  152. // 模块管理
  153. //
  154. this.menuModulesManager.Click += new EventHandler(MenuToolsTemplateManager_Click);
  155. this.menuModulesManager.Text = PdnResources.GetString("NewModulesManager");
  156. this.menuModulesManager.Image = PdnResources.GetImageResource("Icons.ModulesManager.png").Reference;
  157. //
  158. // 自定义软件界面
  159. //
  160. this.menuCustomToolBar.Click += new EventHandler(MenuToolsCreateReport_Click);
  161. this.menuCustomToolBar.Text = PdnResources.GetString("NewCustomToolBar");
  162. this.menuCustomToolBar.Image = PdnResources.GetImageResource("Icons.CustomToolBar.png").Reference;
  163. //
  164. // 基本信息设置
  165. //
  166. this.menuBasicInfoSetting.Click += new EventHandler(MenuToolsSelfRestart_Click);
  167. this.menuBasicInfoSetting.Text = PdnResources.GetString("NewBasicInfoSetting");
  168. this.menuBasicInfoSetting.Image = PdnResources.GetImageResource("Icons.BasicInfoSetting.png").Reference;
  169. //
  170. // 基本设置
  171. //
  172. this.menuBasicSetting.Click += new EventHandler(MenuBasic_Click);
  173. this.menuBasicSetting.Text = PdnResources.GetString("Menu.BasicSetting");
  174. this.menuBasicSetting.Image = PdnResources.GetImageResource("Icons.baseSheZhi.png").Reference;
  175. //
  176. // 命名规则
  177. //
  178. this.fileNamingRules.Text = PdnResources.GetString("Menu.FileNamingRules");
  179. this.fileNamingRules.Click += new EventHandler(MenuFileNamingRules_Click);
  180. this.fileNamingRules.Image = PdnResources.GetImageResource("Icons.FileNameRole.png").Reference;
  181. //
  182. // 辅助线设置
  183. //
  184. this.auxiliaryLineSetting.Text = PdnResources.GetString("Menu.AuxiliaryLineSetting");
  185. this.auxiliaryLineSetting.Click += new EventHandler(MenuAuxiliaryLineSetting_Click);
  186. this.auxiliaryLineSetting.Image = PdnResources.GetImageResource("Icons.FileNameRole.png").Reference;
  187. //
  188. //
  189. //
  190. this.measureProcedureImport.Text = PdnResources.GetString("ImportAndExportSet");
  191. this.measureProcedureImport.Click += new EventHandler(MenuMeasureProcedureImport_Click);
  192. this.measureProcedureImport.Image = PdnResources.GetImageResource("Icons.FileNameRole.png").Reference;
  193. ////
  194. //// 加载菜单的文字和icon
  195. ////
  196. //this.LoadNames(this.Name);
  197. this.namesLoaded = true;
  198. this.LoadIcons();
  199. }
  200. protected override void OnDropDownOpening(EventArgs e)
  201. {
  202. //this.menuToolsGridLine.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.GridLineEnabled : false;
  203. //this.menuMeasureRectSetting.Checked = Settings.CurrentUser.GetBoolean(SettingNames.Rulers, true);
  204. base.OnDropDownOpening(e);
  205. }
  206. /// <summary>
  207. /// 测量线设置
  208. /// </summary>
  209. /// <param name="sender"></param>
  210. /// <param name="e"></param>
  211. private void MenuToolsAuxiliaryLine_Click(object sender, EventArgs e)
  212. {
  213. using (Measure.MeasureSettingDialog af = new Measure.MeasureSettingDialog(AppWorkspace))
  214. {
  215. af.StartPosition = FormStartPosition.CenterScreen;
  216. af.ShowDialog(AppWorkspace);
  217. }
  218. }
  219. /// <summary>
  220. /// 标尺标定
  221. /// </summary>
  222. /// <param name="sender"></param>
  223. /// <param name="e"></param>
  224. private void MenuToolsViewRuler_Click(object sender, EventArgs e)
  225. {
  226. AppWorkspace.Widgets.RuleListForm.Visible = !AppWorkspace.Widgets.RuleListForm.Visible;
  227. if (AppWorkspace.ActiveDocumentWorkspace != null)
  228. {
  229. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.RuleListForm.Visible, "RulerCalibration");
  230. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.RuleListForm.Visible, "RulerCalibration");
  231. this.menuRulerTools.Checked = AppWorkspace.Widgets.RuleListForm.Visible;
  232. }
  233. }
  234. /// <summary>
  235. /// 测量区域设置
  236. /// </summary>
  237. /// <param name="sender"></param>
  238. /// <param name="e"></param>
  239. private void MenuToolsCustomInterface_Click(object sender, EventArgs e)
  240. {
  241. using (MeasureAreaDialog af = new MeasureAreaDialog(AppWorkspace))
  242. {
  243. af.StartPosition = FormStartPosition.CenterScreen;
  244. af.ShowDialog(AppWorkspace);
  245. }
  246. }
  247. /// <summary>
  248. ///
  249. /// </summary>
  250. /// <param name="sender"></param>
  251. /// <param name="e"></param>
  252. private void MenuToolsSelfRestart_Click(object sender, EventArgs e)
  253. {
  254. using (BasicInformationSettings af = new BasicInformationSettings())
  255. {
  256. af.StartPosition = FormStartPosition.CenterScreen;
  257. af.ShowDialog();
  258. }
  259. }
  260. /// <summary>
  261. ///
  262. /// </summary>
  263. /// <param name="sender"></param>
  264. /// <param name="e"></param>
  265. private void MenuBasic_Click(object sender, EventArgs e)
  266. {
  267. using (BasicMeasureDialog af = new BasicMeasureDialog(AppWorkspace))
  268. {
  269. af.StartPosition = FormStartPosition.CenterScreen;
  270. af.ShowDialog();
  271. }
  272. }
  273. /// <summary>
  274. /// 模块管理
  275. /// </summary>
  276. /// <param name="sender"></param>
  277. /// <param name="e"></param>
  278. private void MenuToolsTemplateManager_Click(object sender, EventArgs e)
  279. {
  280. using (ModuleManageDialog af = new ModuleManageDialog(AppWorkspace))
  281. {
  282. af.StartPosition = FormStartPosition.CenterScreen;
  283. af.ShowDialog(AppWorkspace);
  284. }
  285. }
  286. /// <summary>
  287. /// 命名规则
  288. /// </summary>
  289. /// <param name="sender"></param>
  290. /// <param name="e"></param>
  291. private void MenuFileNamingRules_Click(object sender, EventArgs e)
  292. {
  293. using (FileNamingRules af = new FileNamingRules(AppWorkspace))
  294. {
  295. af.StartPosition = FormStartPosition.CenterScreen;
  296. af.ShowDialog(AppWorkspace);
  297. }
  298. }
  299. /// <summary>
  300. /// 辅助线设置
  301. /// </summary>
  302. /// <param name="sender"></param>
  303. /// <param name="e"></param>
  304. private void MenuAuxiliaryLineSetting_Click(object sender, EventArgs e)
  305. {
  306. using (AuxiliaryLineSetting af = new AuxiliaryLineSetting())
  307. {
  308. af.StartPosition = FormStartPosition.CenterScreen;
  309. af.ShowDialog();
  310. }
  311. }
  312. /// <summary>
  313. /// 自定义软件界面
  314. /// </summary>
  315. /// <param name="sender"></param>
  316. /// <param name="e"></param>
  317. private void MenuToolsCreateReport_Click(object sender, EventArgs e)
  318. {
  319. CustomInterfaceDialog dialog = new CustomInterfaceDialog(AppWorkspace);
  320. dialog.ShowDialog();
  321. }
  322. /// <summary>
  323. /// 应用当前
  324. /// </summary>
  325. /// <param name="sender"></param>
  326. /// <param name="e"></param>
  327. private void MenuSubApplyCurrent_Click(object sender, EventArgs e)
  328. {
  329. AppWorkspace.Widgets.RuleListForm.MenuSubApplyCurrent();
  330. }
  331. /// <summary>
  332. /// 应用全部
  333. /// </summary>
  334. /// <param name="sender"></param>
  335. /// <param name="e"></param>
  336. private void MenuSubApplyAll_Click(object sender, EventArgs e)
  337. {
  338. AppWorkspace.Widgets.RuleListForm.MenuSubApplyAll();
  339. }
  340. /// <summary>
  341. ///
  342. /// </summary>
  343. /// <param name="sender"></param>
  344. /// <param name="e"></param>
  345. private void MenuMeasureProcedureImport_Click(object sender, EventArgs e)
  346. {
  347. using (MeasureProcedureImport af = new MeasureProcedureImport(AppWorkspace))
  348. {
  349. af.StartPosition = FormStartPosition.CenterScreen;
  350. af.ShowDialog(AppWorkspace);
  351. }
  352. }
  353. }
  354. }