void Restore(SerializableData data) { var backData = new Dictionary <string, string>(); data.Items.ForEach(e => backData.Add(e.K, e.V)); for (int index = Items.Count - 1; index >= 0; index--) { var item = Items[index]; if (backData.ContainsKey(item.K)) { if (item.V != backData[item.K]) { item.V = backData[item.K]; OnPropertyChanged(item.K); } } else { Items.RemoveAt(index); OnPropertyChanged(item.K); } } S = data.S; }
public static void EntityManager(SerializableData data, EntityOperater entiotyOperator) { if (null != EntityMananged) { EntityMananged(new EntityManagerArg(data, entiotyOperator)); } }
public void CopyFrom(SerializableData source) { SerializableData s = source.DeepClone(); Items.Clear(); Items.AddRange(s.Items); foreach (var item in Items) { OnPropertyChanged(item.K); } }
public SerializableData DeepClone() { var result = new SerializableData(); foreach (var item in Items) { result.Items.Add(item.DeepColne()); } result._ES = this._ES; return(result); }
public void Undo() { if (_Baskup.Count <= 0) { return; } SerializableData bak = _Baskup.Pop(); if (bak != null) { Restore(bak); } }
//如,为所有需要的组件装配日志管理器 public static void SetProperty(IList objs, string propertyName, object proValue) { object[] args = { proValue }; foreach (object target in objs) { Type t = target.GetType(); ; // if (t.GetProperty(propertyName) == null) if (SerializableData.GetObjPro(propertyName, t) == null) { continue; } t.InvokeMember(propertyName, BindingFlags.Default | BindingFlags.SetProperty, null, target, args); } }
public EntityManagerArg(SerializableData data, EntityOperater entityOperater) { Data = data; EntityOperater = entityOperater; }