private void GrabImageButtonClick(object sender, RoutedEventArgs e)
 {
     Camera.GrabImage();
     viewController1.addIconicVar(Camera.CurrentImage);
     viewController1.repaint();
 }
        private void OperateButtonCommandExecute(object obj)
        {
            switch (obj.ToString())
            {
            case "0":
                if (EStopIsChecked)
                {
                    //急停按钮按下
                    AddMessage("急停按钮按下");
                    try
                    {
                        Mysql mysql = new Mysql();
                        if (mysql.Connect())
                        {
                            string stm    = $"UPDATE avilinestate SET M1State = -1";
                            int    result = mysql.executeQuery(stm);
                            if (result < 1)
                            {
                                AddMessage("数据库更新失败");
                                StatusDataBase = false;
                            }
                            else
                            {
                                StatusDataBase = true;
                            }
                        }
                        else
                        {
                            AddMessage("数据库未连接");
                            StatusDataBase = false;
                        }
                        mysql.DisConnect();
                    }
                    catch (Exception ex)
                    {
                        AddMessage($"数据库连接失败{ex.Message}");
                        StatusDataBase = false;
                    }
                }
                else
                {
                    //急停按钮抬起
                    AddMessage("急停按钮抬起");
                    try
                    {
                        Mysql mysql = new Mysql();
                        if (mysql.Connect())
                        {
                            string stm    = $"UPDATE avilinestate SET M1State = 0,M2State = 0,M3State = 0,M4State = 0";
                            int    result = mysql.executeQuery(stm);
                            if (result < 1)
                            {
                                AddMessage("数据库更新失败");
                                StatusDataBase = false;
                            }
                            else
                            {
                                StatusDataBase = true;
                            }
                        }
                        else
                        {
                            AddMessage("数据库未连接");
                            StatusDataBase = false;
                        }
                        mysql.DisConnect();
                    }
                    catch (Exception ex)
                    {
                        AddMessage($"数据库连接失败{ex.Message}");
                        StatusDataBase = false;
                    }
                }
                break;

            case "1":
                //Inifile.INIWriteValue(iniParameterPath, "System", "CameraName", "[0] Integrated Camera");
                //Inifile.INIWriteValue(iniParameterPath, "System", "CameraInterface", "DirectShow");
                //AddMessage("待添加内容");
                if (mycam.GrabImage(0, false))
                {
                    AddMessage("拍照成功");
                    CameraIamge = mycam.CurrentImage;
                }
                else
                {
                    AddMessage("拍照失败");
                }
                break;

            case "2":
                break;

            default:
                break;
            }
        }