浏览代码

去掉弹出框

ruanzl 2 周之前
父节点
当前提交
15085de63b
共有 1 个文件被更改,包括 22 次插入11 次删除
  1. 22 11
      CameraModel/Form1.cs

+ 22 - 11
CameraModel/Form1.cs

@@ -160,8 +160,13 @@ namespace CameraModel
                         devices.Add(ModelName, input1.Text);
                     }
                 }
+                else
+                {
+                    LogListBox("输入型号!!!");
+
+                }
+
 
-                
             }
             else //断开
             {
@@ -201,13 +206,13 @@ namespace CameraModel
 
             if (!devices.TryGetValue(ModelName, out string value) && string.IsNullOrEmpty(input1.Text))
             {
-                AntdUI.Input input = new AntdUI.Input() { Size = new Size(300, 80), MaxLength = 15 };
-                if (AntdUI.Modal.open(new AntdUI.Modal.Config(ParentForm, "输入型号", input) { CancelText = null,MaskClosable = false }) == DialogResult.No)
-                {
-                    return "";
-                }
-                return input.Text;
-
+                //AntdUI.Input input = new AntdUI.Input() { Size = new Size(300, 80), MaxLength = 15 };
+                //if (AntdUI.Modal.open(new AntdUI.Modal.Config(ParentForm, "输入型号", input) { CancelText = null,MaskClosable = false }) == DialogResult.No)
+                //{
+                //    return "";
+                //}
+                //return input.Text;
+                return "";
             }
             if (!string.IsNullOrEmpty(input1.Text))
             {
@@ -348,7 +353,7 @@ namespace CameraModel
                 bool accessible = DeviceEnumerator.IsDeviceAccessible(devInfoList[cbDeviceList.SelectedIndex], DeviceAccessMode.AccessExclusive);
                 if (accessible)
                 {
-                    nRet = _IGigEDevice.Open();
+                    nRet = _IGigEDevice.Open(DeviceAccessMode.AccessControl,0);
                     if (MvError.MV_OK != nRet)
                     {
                         nRet = _IGigEDevice.SetIpConfig(IpConfigType.Static);
@@ -362,7 +367,7 @@ namespace CameraModel
                         if (SetIp(_IGigEDevice))
                         {
                             // 打开并修改
-                            nRet = _IGigEDevice.Open();
+                            nRet = _IGigEDevice.Open(DeviceAccessMode.AccessControl, 0);
 
                             if (MvError.MV_OK != nRet)
                             {
@@ -485,7 +490,13 @@ namespace CameraModel
 
             // 查找型号
             string ModelName = _device.DeviceInfo.ModelName;
-            input1.Text = GetDeviceId(ModelName);
+            string UserName = GetDeviceId(ModelName);
+            if(String.IsNullOrEmpty(UserName) || UserName.Length > 15)
+            {
+                LogListBox("输入型号!!!");
+                return;
+            }
+            input1.Text = UserName;
             //m_MyCamera.MV_CC_SetDeviceUserID_NET(input1.Text);
             int nRet = _device.Parameters.SetStringValue("DeviceUserID", input1.Text);
             if (nRet != MvError.MV_OK)