Bläddra i källkod

fix a bug which Repeatedly dragging the.prj file results in an error

cxs 2 månader sedan
förälder
incheckning
345a4cde30
1 ändrade filer med 22 tillägg och 11 borttagningar
  1. 22 11
      OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

+ 22 - 11
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -484,6 +484,7 @@ namespace OTSMeasureApp
                     }
                     else if (lsdr == DialogResult.No)
                     {
+                        
                         //不保存,直接退出
                         Application.ExitThread();
                     }
@@ -577,14 +578,14 @@ namespace OTSMeasureApp
         {
             List<CTreeSampleParam> TSampleParamList = new List<CTreeSampleParam>();
             List<SampleMeasurePara> SampleMeasureParaList = new List<SampleMeasurePara>();
-
-
-
             int iSampleCount = m_ProjRstData.GetSampleList().Count;
+            
             if (0 == iSampleCount)
             {
                 return false;
             }
+
+
             for (int i = 0; i < iSampleCount; i++)
             {
                 CTreeSampleParam CTSampleParam = new CTreeSampleParam();
@@ -593,9 +594,6 @@ namespace OTSMeasureApp
                 CTSampleParam.sSampleTitleName = m_ProjRstData.GetFileName();
                 CTSampleParam.sWorkSampleName = SampleClr.GetName();
                 CTSampleParam.bSwitch = SampleClr.GetSwitch();
-
-
-
                 TSampleParamList.Add(CTSampleParam);
             }
 
@@ -1757,14 +1755,21 @@ namespace OTSMeasureApp
                     string prjFile = files.FirstOrDefault(f =>!string.IsNullOrEmpty(Path.GetExtension(f)) &&Path.GetExtension(f).ToLower() == ".prj");
                     if (!string.IsNullOrEmpty(prjFile))
                     {
-                        this.Cursor = Cursors.WaitCursor;
-                        try
+                        if(menuOpenprj.Enabled)
                         {
-                            OpenMeasureProjectFile(prjFile);
+                            this.Cursor = Cursors.WaitCursor;
+                            try
+                            {
+                                OpenMeasureProjectFile(prjFile);
+                            }
+                            finally
+                            {
+                                this.Cursor = Cursors.Default;
+                            }
                         }
-                        finally
+                        else
                         {
-                            this.Cursor = Cursors.Default;
+                            MessageBox.Show("测量程序只能打开一个 .prj 项目文件", "提示",MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                     }
                     else
@@ -1796,6 +1801,12 @@ namespace OTSMeasureApp
             hintLabel.ForeColor = Color.White;
             hintLabel.Dock = DockStyle.Fill;
             hintLabel.BackColor = Color.Transparent;
+
+
+
+
+
+
             Label subLabel = new Label();
             subLabel.Text = "Release mouse button to open the file";
             subLabel.AutoSize = false;