using PaintDotNet.Data.Param; using PaintDotNet.Hardware; using System; using System.Globalization; using System.Windows.Forms; namespace PaintDotNet.Menus { /// /// 硬件控制菜单 /// internal sealed class HardwareControlMenu : PdnMenuItem { private PdnMenuItem menuLocationNavigation; private PdnMenuItem menuStageSetting; private PdnMenuItem menuSetVoltage; private PdnMenuItem menuMotorizedLight; public HardwareControlMenu(int menuId) { InitializeComponent(); this.MenuId = menuId; } protected override void OnAppWorkspaceChanged() { base.OnAppWorkspaceChanged(); } private void InitializeComponent() { this.menuLocationNavigation = new PdnMenuItem(ActionType.LocationNavigation); this.menuLocationNavigation.AutomaticScript = false; this.menuStageSetting = new PdnMenuItem(ActionType.StageSetting); this.menuStageSetting.AutomaticScript = false; this.menuSetVoltage = new PdnMenuItem(ActionType.SetVoltage); this.menuSetVoltage.AutomaticScript = false; this.menuMotorizedLight = new PdnMenuItem(ActionType.MotorizedLight); this.menuMotorizedLight.AutomaticScript = false; // // 主菜单 // this.DropDownItems.AddRange(new ToolStripItem[] { this.menuLocationNavigation, //menuStageSetting, this.menuSetVoltage, this.menuMotorizedLight }); this.Name = "Menu.HardwareControl"; this.Text = PdnResources.GetString("Menu.HardwareControl.Text"); // // 位置导航 // this.menuLocationNavigation.Click += new System.EventHandler(this.locationNavigation_Click); // // 设置电压 // this.menuSetVoltage.Click += new System.EventHandler(this.setVoltage_Click); // // 电动偏光 // this.menuMotorizedLight.Click += new System.EventHandler(this.motorizedLight_Click); // // 机台设置 // this.menuStageSetting.Click += MenuStageSetting_Click; // // 加载菜单的文字和icon // this.LoadNames(this.Name); this.LoadIcons(); } private void MenuStageSetting_Click(object sender, EventArgs e) { using (var form = new ParamSetingDialog(null)) { form.ShowDialog(); } } /// /// 电动偏光 /// /// /// private void motorizedLight_Click(object sender, EventArgs e) { using (MotorizedLightDialog af = new MotorizedLightDialog()) { af.ShowDialog(); } } /// /// 设置电压 /// /// /// private void setVoltage_Click(object sender, EventArgs e) { using (SetVoltageDialog af = new SetVoltageDialog()) { af.ShowDialog(); } } private void locationNavigation_Click(object sender, System.EventArgs e) { //new SCC().Show(); Form form = Application.OpenForms["LocationNavigationDialog"]; FloatingFormMethod.ShowFloatForm(form, form == null ? new LocationNavigationDialog(AppWorkspace)/*没有弹出的窗口对象则创建*/ : null, AppWorkspace); } private string GetCultureInfoName(CultureInfo ci) { CultureInfo en_US = new CultureInfo("en-US"); if (ci.Equals(en_US)) { return GetCultureInfoName(ci.Parent); } else { return ci.NativeName; } } } }