Przeglądaj źródła

分组删除前不能有对应引用

CXS 3 lat temu
rodzic
commit
7dd82504d7

+ 3 - 2
OTSPartA_STDEditor/Form_ConstantsEditor2.cs

@@ -1332,12 +1332,13 @@ namespace OTSPartA_STDEditor
         }
         private void ribbon_GroupNameMaintenance_Click(object sender, EventArgs e)
         {
-            Form_GroupId form_GroupId = new Form_GroupId(STDDBAddress);
+            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();
+            Form_GroupId form_GroupId = new Form_GroupId(STDDBAddress,this);
             DialogResult dialogResult = form_GroupId.ShowDialog();
             if (dialogResult == DialogResult.Yes)
             {
                 AddSTDGroupsToAttribute();
-                SetNonexistentGroupsToDefault();
+                //SetNonexistentGroupsToDefault();
             }
         }
 

+ 14 - 3
OTSPartA_STDEditor/Form_GroupId.cs

@@ -13,6 +13,7 @@ namespace OTSPartA_STDEditor
 {
     public partial class Form_GroupId : Form
     {
+        public Form_ConstantsEditor2 m_MainForm = null;
         //国际化
         Language lan;
         System.Collections.Hashtable table_GroupId;
@@ -229,10 +230,11 @@ namespace OTSPartA_STDEditor
             m_dbConnection.Close();
         }
 
-        public Form_GroupId(string DBAddress)
+        public Form_GroupId(string DBAddress, Form_ConstantsEditor2 mainForm)
         {
             InitializeComponent();
             MineralGroupDBAddress = DBAddress;
+            m_MainForm = mainForm;
         }
 
         private void Form_GroupId_Load(object sender, EventArgs e)
@@ -404,9 +406,18 @@ namespace OTSPartA_STDEditor
             int y = Grid_FroupId.Selection.ActivePosition.Column;
             if (x > 0 && (y == 0|| y == 1))
             {
-                if(x==1)
+                bool bexist = false;
+                foreach (KeyValuePair<int, STDdata> kv in m_MainForm.STDDictionary)
                 {
-                    MessageBox.Show("Group by default,can not be deleted!");
+                    if(kv.Value.GroupId.ToString()== Grid_FroupId[x, 0].Tag.ToString())
+                    {
+                        bexist = true;
+                        break;
+                    }
+                }
+                if(bexist)
+                {
+                    MessageBox.Show("There is a grouping in the user standard library that you want to delete!");
                     return;
                 }
                 RemoveMineralGroupDictionaryItem((int)Grid_FroupId[x, 0].Tag);