123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using PaintDotNet.Data.Param;
- using PaintDotNet.Hardware;
- using System;
- using System.Globalization;
- using System.Windows.Forms;
- namespace PaintDotNet.Menus
- {
- /// <summary>
- /// 硬件控制菜单
- /// </summary>
- 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();
- }
- }
- /// <summary>
- /// 电动偏光
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void motorizedLight_Click(object sender, EventArgs e)
- {
- using (MotorizedLightDialog af = new MotorizedLightDialog())
- {
- af.ShowDialog();
- }
- }
- /// <summary>
- /// 设置电压
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- }
- }
- }
|