123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using Metis.AutoAnalysis;
- using PaintDotNet.Camera;
- using PaintDotNet.Data.Param;
- using PaintDotNet.GeneralAnalysis;
- using PaintDotNet.GeneralAnalysis.Special;
- using StageController;
- using System;
- using System.Globalization;
- using System.Windows.Forms;
- namespace PaintDotNet.Menus
- {
- /// <summary>
- /// 通用分析
- /// </summary>
- internal sealed class AutoAnalysisMenu : PdnMenuItem
- {
- //样品台管理
- private PdnMenuItem menuSampleStageMananger;
- //自动分析
- private PdnMenuItem menuAutoAnalysis;
- public AutoAnalysisMenu(int menuId)
- {
- InitializeComponent();
- this.MenuId = menuId;
- }
- protected override void OnAppWorkspaceChanged()
- {
- base.OnAppWorkspaceChanged();
- }
- private void InitializeComponent()
- {
- this.menuSampleStageMananger = new PdnMenuItem(ActionType.SampleStageMananger);
- this.menuAutoAnalysis = new PdnMenuItem(ActionType.AutoAnalysis);
- //
- // 主菜单
- //
- this.DropDownItems.AddRange(new ToolStripItem[] {
- this.menuSampleStageMananger,
- this.menuAutoAnalysis
- });
- this.Name = "Menu.AutoAnalysis";
- this.Text = PdnResources.GetString("Menu.AutoAnalysis.Text");
- //
- //
- //
- this.menuSampleStageMananger.Name = "SampleStageMananger";
- menuSampleStageMananger.Click += MenuSampleStageMananger_Click;
- this.menuSampleStageMananger.Image = PdnResources.GetImageResource("Icons.SampleStageMananger.png").Reference;
- //
- //
- //
- this.menuAutoAnalysis.Name = "AutoAnalysis";
- menuAutoAnalysis.Click += MenuAutoAnalysis_Click;
- this.menuAutoAnalysis.Image = PdnResources.GetImageResource("Icons.AutoAnalysis.png").Reference;
- //
- //
- // 加载菜单的文字和icon
- //
- this.LoadNames(this.Name);
- this.LoadIcons();
- }
- private void MenuAutoAnalysis_Click(object sender, EventArgs e)
- {
- /*if (!CameraManager.IsLive)
- {
- MessageBox.Show(PdnResources.GetString("AvailableCameras"));
- return;
- }
- if (!AxisController.GetInstance().IsOpen)
- {
- MessageBox.Show(PdnResources.GetString("Console"));
- return;
- }*/
- Form form = Application.OpenForms["AutoAnalysisDialog"];//尝试获取已经弹出的窗口对象
- if (form == null || form.IsDisposed)
- {
- form = new AutoAnalysisDialog(AppWorkspace);
- // form.TopMost = true;
- form.Show();
- }
- else
- {
- form.Focus();
- }
- }
- private void MenuSampleStageMananger_Click(object sender, EventArgs e)
- {
- using (var form = new SampleStageManageDialog())
- {
- form.ShowDialog();
- }
- }
- }
- }
|