Browse Source

fix bug which stdeditor saveas error

cxs 2 weeks ago
parent
commit
8fe01ecbf7

+ 6 - 7
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -392,7 +392,6 @@ namespace OTSIncAReportGrids
                     .Select(row => row["TypeName"].ToString()));
                     .Select(row => row["TypeName"].ToString()));
             }
             }
         }
         }
-
         // 新增:为 userSTDDbData 建立索引以加速查找
         // 新增:为 userSTDDbData 建立索引以加速查找
         private Dictionary<string, DataRow> BuildUserStdLookup()
         private Dictionary<string, DataRow> BuildUserStdLookup()
         {
         {
@@ -729,7 +728,7 @@ namespace OTSIncAReportGrids
         private void ProcessParticleImageColumn(int rowIndex, int gridRowIndex, int columnIndex, Dictionary<string, Bitmap> fieldPics)
         private void ProcessParticleImageColumn(int rowIndex, int gridRowIndex, int columnIndex, Dictionary<string, Bitmap> fieldPics)
         {
         {
             string subParticleString = Convert.ToString(particlesFilter.Rows[rowIndex]["SubParticles"]);
             string subParticleString = Convert.ToString(particlesFilter.Rows[rowIndex]["SubParticles"]);
-            dgV_ParticlesDevidePage.Rows[gridRowIndex].Height = 150;
+            dgV_ParticlesDevidePage.Rows[gridRowIndex].Height = 70;
             dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Style.BackColor = Color.Azure;
             dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Style.BackColor = Color.Azure;
 
 
             Bitmap bmap = null;
             Bitmap bmap = null;
@@ -885,6 +884,10 @@ namespace OTSIncAReportGrids
 
 
 
 
         #endregion
         #endregion
+
+
+
+
         #region 健壮性判断
         #region 健壮性判断
         private bool IsNumericColumn(string columnName)
         private bool IsNumericColumn(string columnName)
         {
         {
@@ -1057,7 +1060,7 @@ namespace OTSIncAReportGrids
             if (src != null)
             if (src != null)
             {
             {
                 var bmap = fldImgAccess.CapturePic(src, rectangle);
                 var bmap = fldImgAccess.CapturePic(src, rectangle);
-                dgV_ParticlesDevidePage.Rows[0].Height = bmap.Height + 20;
+                //dgV_ParticlesDevidePage.Rows[0].Height = bmap.Height + 20;
                 return bmap;
                 return bmap;
             }
             }
 
 
@@ -1243,10 +1246,6 @@ namespace OTSIncAReportGrids
             if (columnName== "Element") return;
             if (columnName== "Element") return;
             var cellValue = particlesFilter.Rows[rowIndex][columnName];
             var cellValue = particlesFilter.Rows[rowIndex][columnName];
             if (cellValue == null) return;
             if (cellValue == null) return;
-
-            
-            
-            
             if (double.TryParse(cellValue.ToString(), out double num))
             if (double.TryParse(cellValue.ToString(), out double num))
             {
             {
                 dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Value = Math.Round(num, 2);
                 dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Value = Math.Round(num, 2);

+ 7 - 0
OTSPartA_STDEditor/BaseClass/STDInfo.cs

@@ -484,6 +484,7 @@ namespace OTSPartA_STDEditor.BaseClass
             //{
             //{
             //    STDDictionary[(int)m_STDRuleslist.Grid_Minerals[i, 0].Tag].ListNum = i.ToString();
             //    STDDictionary[(int)m_STDRuleslist.Grid_Minerals[i, 0].Tag].ListNum = i.ToString();
             //}
             //}
+
             try
             try
             {
             {
                 System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
                 System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
@@ -655,6 +656,7 @@ namespace OTSPartA_STDEditor.BaseClass
                 m_dataAdapter_grp.Update(ds_grp, "STDGroups");
                 m_dataAdapter_grp.Update(ds_grp, "STDGroups");
 
 
                 m_dbConnection.Close();
                 m_dbConnection.Close();
+                UpdateDBAddress(DBAddress);
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
@@ -679,5 +681,10 @@ namespace OTSPartA_STDEditor.BaseClass
                 }
                 }
             }
             }
         }
         }
+
+        public void UpdateDBAddress(string DBAddress)
+        {
+            _DBAddress = DBAddress;
+        }
     }
     }
 }
 }

+ 2 - 9
OTSPartA_STDEditor/UI/Form_Main.cs

@@ -1,6 +1,5 @@
 using OTS.WinFormsUI.Docking;
 using OTS.WinFormsUI.Docking;
 using OTSPartA_STDEditor.BaseClass;
 using OTSPartA_STDEditor.BaseClass;
-using SourceGrid;
 using System;
 using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
@@ -8,9 +7,6 @@ using System.Data;
 using System.Drawing;
 using System.Drawing;
 using System.Linq;
 using System.Linq;
 using System.Windows.Forms;
 using System.Windows.Forms;
-using System.Xml;
-using System.Xml.Linq;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 
 
 namespace OTSPartA_STDEditor
 namespace OTSPartA_STDEditor
 {
 {
@@ -89,6 +85,7 @@ namespace OTSPartA_STDEditor
 
 
 
 
 
 
+        
         private void rbBackup_Click(object sender, EventArgs e)
         private void rbBackup_Click(object sender, EventArgs e)
         {
         {
             if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
             if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
@@ -482,11 +479,7 @@ namespace OTSPartA_STDEditor
             _sTDEditor.STDDictionary.Remove(STDId);
             _sTDEditor.STDDictionary.Remove(STDId);
         }
         }
 
 
-        public void ChangeStrName(int RowNum, string NewStrName)
-        {
-            //_sTDEditor.STDDictionary[((STDdata)m_STDRuleslist.Grid_Minerals[RowNum, 0].Tag).STDId].StrName = NewStrName;
-            //m_Attributes.Grid_Attributes[2, 1].Value = NewStrName;
-        }
+        
 
 
         
         
         
         

+ 10 - 18
OTSPartA_STDEditor/UI/STDRuleslist.cs

@@ -58,7 +58,6 @@ namespace OTSPartA_STDEditor
 
 
 
 
 
 
-
         public class ValueChangedEvent : SourceGrid.Cells.Controllers.ControllerBase
         public class ValueChangedEvent : SourceGrid.Cells.Controllers.ControllerBase
         {
         {
             protected STDRuleslist m_parentWnd = null;
             protected STDRuleslist m_parentWnd = null;
@@ -69,32 +68,25 @@ namespace OTSPartA_STDEditor
             public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e)
             public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e)
             {
             {
                 base.OnValueChanged(sender, e);
                 base.OnValueChanged(sender, e);
-                if (sender.Value != null&& sender.Value.ToString().Replace(" ", "").Trim() != "")
-                {
-                    m_parentWnd.ChangeStrName(sender.Position.Row, sender.Value.ToString());
-                }
-                else
-                {
-                    m_parentWnd.ChangeStrName(sender.Position.Row, "NewRuleName");
-                }
             }
             }
         }
         }
-        public void ChangeStrName(int RowNum, string NewStrName)
-        {
-            m_MainForm.ChangeStrName(RowNum, NewStrName);
-        }
-
-
-
-
         private void Grid_Minerals_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
         private void Grid_Minerals_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
         {
         {
-            
             if (e.KeyCode == Keys.Delete)
             if (e.KeyCode == Keys.Delete)
             {
             {
                 ToolStripMenuItem_Del_Click(null, null);
                 ToolStripMenuItem_Del_Click(null, null);
             }
             }
         }
         }
+
+
+
+
+
+
+
+
+
+
         public int ChangeSTDRulesLISTBackColor()
         public int ChangeSTDRulesLISTBackColor()
         {
         {
             if (treeView_G.SelectedNode.Level == 0)
             if (treeView_G.SelectedNode.Level == 0)