Просмотр исходного кода

修复 空库编辑组报错的bug

cxs 2 лет назад
Родитель
Сommit
0b856d3704

+ 1 - 1
OTSPartA_STDEditor/Attributes.cs

@@ -209,7 +209,7 @@ namespace OTSPartA_STDEditor
             Grid_Attributes[8, 1].Value = m_MainForm.STDDictionary[STDId].Formula;
             Grid_Attributes[9, 1].Value = m_MainForm.STDDictionary[STDId].Element;
 
-            m_MainForm.AddSTDGroupsToAttribute();
+            //m_MainForm.AddSTDGroupsToAttribute();
             Grid_Attributes[10, 1].Value = m_MainForm.GroupIdDictionaryFromId[int.Parse(m_MainForm.STDDictionary[STDId].GroupId)];
 
             //SourceGrid.Position po = new SourceGrid.Position(1, 0);

+ 4 - 2
OTSPartA_STDEditor/Form_ConstantsEditor2.cs

@@ -1000,13 +1000,15 @@ namespace OTSPartA_STDEditor
         }
         private void ribbon_GroupNameMaintenance_Click(object sender, EventArgs e)
         {
-            STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row,0].Tag.ToString())].GroupId = GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()].ToString();
+            //STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Tag.ToString())].GroupId = GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()].ToString();
+            int selGroupId = GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()];
             Form_GroupId form_GroupId = new Form_GroupId(STDDBAddress,this);
             DialogResult dialogResult = form_GroupId.ShowDialog();
             if (dialogResult == DialogResult.Yes)
             {
                 AddSTDGroupsToAttribute();
                 //SetNonexistentGroupsToDefault();
+                m_Attributes.Grid_Attributes[10, 1].Value = GroupIdDictionaryFromId[selGroupId];
             }
         }
 
@@ -1371,7 +1373,7 @@ namespace OTSPartA_STDEditor
             m_SubMidWindow.m_STDEditor.m_sc = new SqlLiteClass(DBAddress);
 
             LoadConstants(DBAddress);
-
+            AddSTDGroupsToAttribute();
             m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text = "";
 
             if (m_STDRuleslist.Grid_Minerals.RowsCount > 1)

+ 24 - 82
OTSPartA_STDEditor/STDRuleslist.cs

@@ -81,9 +81,6 @@ namespace OTSPartA_STDEditor
                 SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
                 view.BackColor = colorHx16toRGB(kv.Value.Color);
                 Grid_Minerals[i, 1].View = view;
-                //Grid_Minerals[i, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-
-                
                 i++;
             }
 
@@ -92,7 +89,6 @@ namespace OTSPartA_STDEditor
             Grid_Minerals.Selection.FocusStyle = FocusStyle.None;
 
 
-
             button_UpOrder.Enabled = false;
             button_DownOrder.Enabled = false;
         }
@@ -126,37 +122,21 @@ namespace OTSPartA_STDEditor
             ls_gd.Focus();
             int i = ls_gd.Selection.ActivePosition.Row;
             int j = ls_gd.Selection.ActivePosition.Column;
-
+            //string jj =m_MainForm.m_Attributes.Grid_Attributes[10, 1].Value.ToString();
             /// 保证鼠标点击的GRID行和列是有效的
             if (i >= 0 && j >= 0)
             {
-                //    if (PreRow != -1&& PreRow != Grid_Minerals.Selection.ActivePosition.Row)
-                //    {
                 //规则名称不为空
                 if (Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
+                {
+                    if (m_MainForm.CheckAttributes() && m_MainForm.Checktextbox_STDEditor())
                     {
-                        if (m_MainForm.CheckAttributes()&& m_MainForm.Checktextbox_STDEditor())
-                        {
-                            //if (m_MainForm.Checktextbox_STDEditor())
-                            //{
-                                m_MainForm.SaveDataOfSelRule(PreRow, 0);
-                                m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i, 0].Tag.ToString()));
-                                m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                                PreRow = i;
-                            //}
-                            //else
-                            //{
-                            //    Position pos = new Position(PreRow, 0);
-                            //    Grid_Minerals.Selection.Focus(pos, true);
-                            //    m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                            //}
-                        }
-                        else
-                        {
-                            Position pos = new Position(PreRow, 0);
-                            Grid_Minerals.Selection.Focus(pos, true);
-                            m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                        }
+
+                        m_MainForm.SaveDataOfSelRule(PreRow, 0);
+                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i, 0].Tag.ToString()));
+                        m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
+                        PreRow = i;
+
                     }
                     else
                     {
@@ -164,13 +144,13 @@ namespace OTSPartA_STDEditor
                         Grid_Minerals.Selection.Focus(pos, true);
                         m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
                     }
-                //    }
-                //    else
-                //    {
-                //        m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i, 0].Tag.ToString()));
-                //        PreRow = i;
-                //        m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                //    }
+                }
+                else
+                {
+                    Position pos = new Position(PreRow, 0);
+                    Grid_Minerals.Selection.Focus(pos, true);
+                    m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
+                }
             }
 
             SetOrderButtonsStatus();
@@ -327,21 +307,13 @@ namespace OTSPartA_STDEditor
                     //规则名称不为空
                     if (Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
                     {
-                        if (m_MainForm.CheckAttributes()&& m_MainForm.Checktextbox_STDEditor())
+                        if (m_MainForm.CheckAttributes() && m_MainForm.Checktextbox_STDEditor())
                         {
-                            //if (m_MainForm.Checktextbox_STDEditor())
-                            //{
-                                m_MainForm.SaveDataOfSelRule(i, 0);
-                                m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i - 1, 0].Tag.ToString()));
-                                m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                                PreRow = i;
-                            //}
-                            //else
-                            //{
-                            //    Position pos = new Position(i + 1, 0);
-                            //    Grid_Minerals.Selection.Focus(pos, true);
-                            //    m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                            //}
+
+                            m_MainForm.SaveDataOfSelRule(i, 0);
+                            m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i - 1, 0].Tag.ToString()));
+                            m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
+                            PreRow = i;
                             if (i == 2)
                             {
                                 button_UpOrder.Enabled = false;
@@ -368,29 +340,7 @@ namespace OTSPartA_STDEditor
             }
             if (e.KeyCode == Keys.Down)
             {
-                //SourceGrid.Grid ls_gd = (SourceGrid.Grid)sender;
-                //ls_gd.Focus();
-                //int i = ls_gd.Selection.ActivePosition.Row;
-                //int j = ls_gd.Selection.ActivePosition.Column;
-
-                //if (i == 1)
-                //{
-                //    button_UpOrder.Enabled = false;
-                //}
-                //else
-                //{
-                //    button_UpOrder.Enabled = true;
-                //}
-                //if (i == ls_gd.RowsCount - 1)
-                //{
-                //    button_DownOrder.Enabled = false;
-                //}
-                //else
-                //{
-                //    button_DownOrder.Enabled = true;
-                //}
-
-                /// 保证鼠标点击的GRID行和列是有效的
+                
                 if (i < ls_gd.RowsCount - 1 && j >= 0)
                 {
                     //规则名称不为空
@@ -398,20 +348,12 @@ namespace OTSPartA_STDEditor
                     {
                         if (m_MainForm.CheckAttributes()&& m_MainForm.Checktextbox_STDEditor())
                         {
-                            //if (m_MainForm.Checktextbox_STDEditor())
-                            //{
+                           
                                 m_MainForm.SaveDataOfSelRule(i, 0);
                                 m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i + 1, 0].Tag.ToString()));
                                 PreRow = i;
                                 m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
 
-                            //}
-                            //else
-                            //{
-                            //    Position pos = new Position(i - 1, 0);
-                            //    Grid_Minerals.Selection.Focus(pos, true);
-                            //    m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                            //}
                             if (i == 1)
                             {
                                 button_UpOrder.Enabled = true;