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 { /// /// 通用分析 /// 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(); } } } }