Commit 9bbbd8c5 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 IsInPushValue, 当PropertyChanged 被触发,能知道是否远程推送过来,导致的改变

parent 52fa4a1a
......@@ -17,7 +17,13 @@ namespace FLY.OBJComponents.Client
IFConn mConn;
UInt32 mServerID;
public event PropertyChangedEventHandler PropertyChanged;
//public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// 当前 INotifyPropertyChanged 对象 引发了 PropertyChanged, 是由于 接收到数据导致的
/// </summary>
public bool IsInPushValue { get;protected set; }
public SyncPropServiceClient(UInt32 serverID, Dictionary<string, INotifyPropertyChanged> objnames)
{
......@@ -105,17 +111,20 @@ namespace FLY.OBJComponents.Client
{
string json = Misc.Converter.BytesToString(infodata);
Dictionary<string, Dictionary<string, object>> DsDso = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, object>>>(json);
IsInPushValue = true;
foreach (var Dso in DsDso)
{
INotifyPropertyChanged obj = ObjNames[Dso.Key] as INotifyPropertyChanged;
obj.PropertyChanged -= Data_PropertyChanged;
foreach (var dv in Dso.Value)
{
PropertiesManager_JSON.SetValue(obj, dv.Key, dv.Value);
}
obj.PropertyChanged += Data_PropertyChanged;
}
IsInPushValue = false;
}
break;
}
......@@ -129,7 +138,7 @@ namespace FLY.OBJComponents.Client
{
string json = Misc.Converter.BytesToString(retdata);
Dictionary<string, Dictionary<string, object>> DsDso = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, object>>>(json);
IsInPushValue = true;
foreach (var Dso in DsDso)
{
INotifyPropertyChanged obj = ObjNames[Dso.Key] as INotifyPropertyChanged;
......@@ -140,6 +149,7 @@ namespace FLY.OBJComponents.Client
}
obj.PropertyChanged += Data_PropertyChanged;
}
IsInPushValue = false;
}
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment