using Resources;
using SmartCoalApplication.Annotation.Enum;
using SmartCoalApplication.Core;
using SmartCoalApplication.Instrument;
using SmartCoalApplication.Measure;
using SmartCoalApplication.MeasureProcedure;
using SmartCoalApplication.Rule;
using SmartCoalApplication.Setup;
using SmartCoalApplication.SystemLayer;
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace SmartCoalApplication.Menus
{
///
/// 测试规程菜单=>设置
///
internal sealed class SettingMenu : PdnMenuItem
{
////测量规程管理
//private PdnMenuItem menuToolsGridLine;
//测量线设置
private PdnMenuItem menuMeasureLineSetting;
//测量区域设置
private PdnMenuItem menuMeasureRectSetting;
//分隔线
private ToolStripSeparator menuToolsSeperator1;
//标尺标定
private PdnMenuItem menuRulerTools;
//标尺标定子菜单
//标尺标定
private PdnMenuItem menuSubRulerCalibration;
//应用当前
private PdnMenuItem menuSubApplyCurrent;
//应用全部
private PdnMenuItem menuSubApplyAll;
//分隔线
private ToolStripSeparator menuToolsSeperator7;
//模块管理
private PdnMenuItem menuModulesManager;
//自定义软件界面
private PdnMenuItem menuCustomToolBar;
//分隔线
private ToolStripSeparator menuToolsSeperator8;
//基本信息设置
private PdnMenuItem menuBasicInfoSetting;
//基本设置
private PdnMenuItem menuBasicSetting;
//基本设置
private PdnMenuItem fileNamingRules;
//基本设置
private PdnMenuItem auxiliaryLineSetting;
//测试规程导入导出
private PdnMenuItem measureProcedureImport;
public SettingMenu(int menuId)
{
InitializeComponent();
this.MenuId = menuId;
}
private void InitializeComponent()
{
//this.menuToolsGridLine = new PdnMenuItem(ActionType.GridLine, true);
this.menuMeasureLineSetting = new PdnMenuItem(ActionType.MenuMeasureLineSetting);
this.menuMeasureRectSetting = new PdnMenuItem(ActionType.MenuMeasureRectSetting);
this.menuToolsSeperator1 = new ToolStripSeparator();
this.menuRulerTools = new PdnMenuItem(ActionType.MenuRulerTools);
this.menuToolsSeperator7 = new ToolStripSeparator();
this.menuModulesManager = new PdnMenuItem(ActionType.ModuleSetting);
this.menuCustomToolBar = new PdnMenuItem(ActionType.CustomToolBar);
this.menuToolsSeperator8 = new ToolStripSeparator();
this.menuBasicInfoSetting = new PdnMenuItem(ActionType.BasicInfoSetting);
this.menuBasicSetting = new PdnMenuItem(ActionType.BasicSetting);
this.menuSubRulerCalibration = new PdnMenuItem(ActionType.SubRulerCalibration);
this.menuSubApplyCurrent = new PdnMenuItem(ActionType.SubApplyCurrent);
this.menuSubApplyAll = new PdnMenuItem(ActionType.SubApplyAll);
this.fileNamingRules = new PdnMenuItem(ActionType.FileNamingRules);
this.auxiliaryLineSetting = new PdnMenuItem(ActionType.AuxiliaryLineSetting);
this.measureProcedureImport = new PdnMenuItem(ActionType.MeasureProcedureImport);
//
// 标尺标定
//
//this.menuRulerCalibration.NeedWaitKey = true;
this.menuRulerTools.DropDownItems.AddRange(new ToolStripItem[] {
this.menuSubRulerCalibration,
this.menuSubApplyCurrent,
this.menuSubApplyAll
});
//
// MeasureManagerMenu
//
this.DropDownItems.AddRange(
new ToolStripItem[]
{
//this.menuToolsGridLine,
this.menuMeasureLineSetting,
this.menuMeasureRectSetting,
this.menuToolsSeperator1,
this.menuRulerTools,
this.menuToolsSeperator7,
this.menuModulesManager,
this.menuCustomToolBar,
this.menuToolsSeperator8,
this.menuBasicInfoSetting,
this.menuBasicSetting,
this.fileNamingRules,
this.auxiliaryLineSetting,
this.measureProcedureImport
});
this.Name = "Menu.Tools";
this.Text = PdnResources.GetString("NewSetting");
//
// 标尺标定(子菜单)
//
this.menuSubRulerCalibration.Text = PdnResources.GetString("Menu.MeasureAction.RulerCalibration.Text");
this.menuSubRulerCalibration.NeedWaitKey = true;
this.menuSubRulerCalibration.Click += new EventHandler(MenuToolsViewRuler_Click);
this.menuSubRulerCalibration.Image = PdnResources.GetImageResource("Icons.MenuRulerCalibration.png").Reference;
//
// 应用当前
//
this.menuSubApplyCurrent.Text = PdnResources.GetString("Menu.Imagement.Rulersetting.current.text");
this.menuSubApplyCurrent.NeedWaitKey = true;
this.menuSubApplyCurrent.Click += new EventHandler(MenuSubApplyCurrent_Click);
this.menuSubApplyCurrent.Image = PdnResources.GetImageResource("Icons.MenuNow.png").Reference;
//
// 应用全部
//
this.menuSubApplyAll.Text = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Applytoall.text");
this.menuSubApplyAll.NeedWaitKey = true;
this.menuSubApplyAll.Click += new EventHandler(MenuSubApplyAll_Click);
this.menuSubApplyAll.Image = PdnResources.GetImageResource("Icons.MenuAll.png").Reference;
//
// 测量线设置
//
this.menuMeasureLineSetting.Click += new EventHandler(MenuToolsAuxiliaryLine_Click);
this.menuMeasureLineSetting.Text = PdnResources.GetString("NewMeasureLineSetting");
this.menuMeasureLineSetting.Image = PdnResources.GetImageResource("Icons.MeasureLineSetting.png").Reference;
//
// 测量区域设置
//
this.menuMeasureRectSetting.Click += new EventHandler(MenuToolsCustomInterface_Click);
this.menuMeasureRectSetting.Text = PdnResources.GetString("NewMeasureRectSetting");
this.menuMeasureRectSetting.Image = PdnResources.GetImageResource("Icons.MeasureRectSetting.png").Reference;
//
// 标尺标定
//
//this.menuRulerTools.Click += new EventHandler(MenuToolsViewRuler_Click);
this.menuRulerTools.Text = PdnResources.GetString("NewRulerTools");
this.menuRulerTools.Image = PdnResources.GetImageResource("Icons.RulerTools.png").Reference;
//
// 模块管理
//
this.menuModulesManager.Click += new EventHandler(MenuToolsTemplateManager_Click);
this.menuModulesManager.Text = PdnResources.GetString("NewModulesManager");
this.menuModulesManager.Image = PdnResources.GetImageResource("Icons.ModulesManager.png").Reference;
//
// 自定义软件界面
//
this.menuCustomToolBar.Click += new EventHandler(MenuToolsCreateReport_Click);
this.menuCustomToolBar.Text = PdnResources.GetString("NewCustomToolBar");
this.menuCustomToolBar.Image = PdnResources.GetImageResource("Icons.CustomToolBar.png").Reference;
//
// 基本信息设置
//
this.menuBasicInfoSetting.Click += new EventHandler(MenuToolsSelfRestart_Click);
this.menuBasicInfoSetting.Text = PdnResources.GetString("NewBasicInfoSetting");
this.menuBasicInfoSetting.Image = PdnResources.GetImageResource("Icons.BasicInfoSetting.png").Reference;
//
// 基本设置
//
this.menuBasicSetting.Click += new EventHandler(MenuBasic_Click);
this.menuBasicSetting.Text = PdnResources.GetString("Menu.BasicSetting");
this.menuBasicSetting.Image = PdnResources.GetImageResource("Icons.baseSheZhi.png").Reference;
//
// 命名规则
//
this.fileNamingRules.Text = PdnResources.GetString("Menu.FileNamingRules");
this.fileNamingRules.Click += new EventHandler(MenuFileNamingRules_Click);
this.fileNamingRules.Image = PdnResources.GetImageResource("Icons.FileNameRole.png").Reference;
//
// 辅助线设置
//
this.auxiliaryLineSetting.Text = PdnResources.GetString("Menu.AuxiliaryLineSetting");
this.auxiliaryLineSetting.Click += new EventHandler(MenuAuxiliaryLineSetting_Click);
this.auxiliaryLineSetting.Image = PdnResources.GetImageResource("Icons.FileNameRole.png").Reference;
//
//
//
this.measureProcedureImport.Text = PdnResources.GetString("ImportAndExportSet");
this.measureProcedureImport.Click += new EventHandler(MenuMeasureProcedureImport_Click);
this.measureProcedureImport.Image = PdnResources.GetImageResource("Icons.FileNameRole.png").Reference;
////
//// 加载菜单的文字和icon
////
//this.LoadNames(this.Name);
this.namesLoaded = true;
this.LoadIcons();
}
protected override void OnDropDownOpening(EventArgs e)
{
//this.menuToolsGridLine.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.GridLineEnabled : false;
//this.menuMeasureRectSetting.Checked = Settings.CurrentUser.GetBoolean(SettingNames.Rulers, true);
base.OnDropDownOpening(e);
}
///
/// 测量线设置
///
///
///
private void MenuToolsAuxiliaryLine_Click(object sender, EventArgs e)
{
using (Measure.MeasureSettingDialog af = new Measure.MeasureSettingDialog(AppWorkspace))
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog(AppWorkspace);
}
}
///
/// 标尺标定
///
///
///
private void MenuToolsViewRuler_Click(object sender, EventArgs e)
{
AppWorkspace.Widgets.RuleListForm.Visible = !AppWorkspace.Widgets.RuleListForm.Visible;
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.RuleListForm.Visible, "RulerCalibration");
this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.RuleListForm.Visible, "RulerCalibration");
this.menuRulerTools.Checked = AppWorkspace.Widgets.RuleListForm.Visible;
}
}
///
/// 测量区域设置
///
///
///
private void MenuToolsCustomInterface_Click(object sender, EventArgs e)
{
using (MeasureAreaDialog af = new MeasureAreaDialog(AppWorkspace))
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog(AppWorkspace);
}
}
///
///
///
///
///
private void MenuToolsSelfRestart_Click(object sender, EventArgs e)
{
using (BasicInformationSettings af = new BasicInformationSettings())
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog();
}
}
///
///
///
///
///
private void MenuBasic_Click(object sender, EventArgs e)
{
using (BasicMeasureDialog af = new BasicMeasureDialog(AppWorkspace))
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog();
}
}
///
/// 模块管理
///
///
///
private void MenuToolsTemplateManager_Click(object sender, EventArgs e)
{
using (ModuleManageDialog af = new ModuleManageDialog(AppWorkspace))
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog(AppWorkspace);
}
}
///
/// 命名规则
///
///
///
private void MenuFileNamingRules_Click(object sender, EventArgs e)
{
using (FileNamingRules af = new FileNamingRules(AppWorkspace))
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog(AppWorkspace);
}
}
///
/// 辅助线设置
///
///
///
private void MenuAuxiliaryLineSetting_Click(object sender, EventArgs e)
{
using (AuxiliaryLineSetting af = new AuxiliaryLineSetting())
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog();
}
}
///
/// 自定义软件界面
///
///
///
private void MenuToolsCreateReport_Click(object sender, EventArgs e)
{
CustomInterfaceDialog dialog = new CustomInterfaceDialog(AppWorkspace);
dialog.ShowDialog();
}
///
/// 应用当前
///
///
///
private void MenuSubApplyCurrent_Click(object sender, EventArgs e)
{
AppWorkspace.Widgets.RuleListForm.MenuSubApplyCurrent();
}
///
/// 应用全部
///
///
///
private void MenuSubApplyAll_Click(object sender, EventArgs e)
{
AppWorkspace.Widgets.RuleListForm.MenuSubApplyAll();
}
///
///
///
///
///
private void MenuMeasureProcedureImport_Click(object sender, EventArgs e)
{
using (MeasureProcedureImport af = new MeasureProcedureImport(AppWorkspace))
{
af.StartPosition = FormStartPosition.CenterScreen;
af.ShowDialog(AppWorkspace);
}
}
}
}