private void ControlDone(object sender, EventArgs e) { //Correct the item orders of all definition categories. List <Def> listDefUpdates = new List <Def>(); foreach (KeyValuePair <DefCat, List <Def> > kvp in Defs.GetDeepCopy()) { for (int i = 0; i < kvp.Value.Count; i++) { if (kvp.Value[i].ItemOrder != i) { kvp.Value[i].ItemOrder = i; listDefUpdates.Add(kvp.Value[i]); } } } listDefUpdates.ForEach(x => Defs.Update(x)); if (_isDefChanged || listDefUpdates.Count > 0) { DataValid.SetInvalid(InvalidType.Defs); } }
private void RefreshDefs() { Defs.RefreshCache(); _listDefsAll = Defs.GetDeepCopy().SelectMany(x => x.Value).ToList(); }