Commit d3e677c0 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 修复 COMMON.NodeDispose 当子property不是INotifyProperty 会出错

2. 修复 刚连接成功,当全部properties 太多,导致下载慢,此时服务器有属性改变了,新改变很快的到达客户端,但之前的 GetProperty 后来才到达。 数据都不同步了。
parent 1b294c14
...@@ -91,7 +91,7 @@ namespace WSCF ...@@ -91,7 +91,7 @@ namespace WSCF
var list = node.Obj as System.Collections.IList; var list = node.Obj as System.Collections.IList;
if (list != null && list.Count>0) if (list != null && list.Count > 0)
{ {
InitSubPropertyPushs(list, node, sub_PropertyChanged); InitSubPropertyPushs(list, node, sub_PropertyChanged);
} }
...@@ -164,8 +164,10 @@ namespace WSCF ...@@ -164,8 +164,10 @@ namespace WSCF
} }
public static string GetNodePath(SubPropertyNode node) { public static string GetNodePath(SubPropertyNode node)
if (string.IsNullOrEmpty(node.Name)) { {
if (string.IsNullOrEmpty(node.Name))
{
//已经是最上级 //已经是最上级
return null; return null;
} }
...@@ -173,13 +175,15 @@ namespace WSCF ...@@ -173,13 +175,15 @@ namespace WSCF
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(node.Name); sb.Append(node.Name);
while (node.Parent != null) { while (node.Parent != null)
{
node = node.Parent; node = node.Parent;
if (string.IsNullOrEmpty(node.Name)) { if (string.IsNullOrEmpty(node.Name))
{
//到了最上级 //到了最上级
break; break;
} }
sb.Insert(0, node.Name+"."); sb.Insert(0, node.Name + ".");
} }
return sb.ToString(); return sb.ToString();
} }
...@@ -192,13 +196,16 @@ namespace WSCF ...@@ -192,13 +196,16 @@ namespace WSCF
var nodes = rootNode.Children; var nodes = rootNode.Children;
//分解路径 //分解路径
string[] names = path.Split('.'); string[] names = path.Split('.');
foreach (string name in names) { foreach (string name in names)
if (string.IsNullOrEmpty(name)) { {
if (string.IsNullOrEmpty(name))
{
//这个不算 //这个不算
continue; continue;
} }
node = nodes.Find(n => n.Name == name); node = nodes.Find(n => n.Name == name);
if (node == null) { if (node == null)
{
//异常 //异常
return null; return null;
} }
...@@ -217,7 +224,7 @@ namespace WSCF ...@@ -217,7 +224,7 @@ namespace WSCF
{ {
if (!node.IsArray) if (!node.IsArray)
{ {
if(node.Obj!=null) if (node.Obj != null && node.Obj is INotifyPropertyChanged)
((INotifyPropertyChanged)(node.Obj)).PropertyChanged -= node.PropertyChanged; ((INotifyPropertyChanged)(node.Obj)).PropertyChanged -= node.PropertyChanged;
} }
...@@ -286,7 +293,8 @@ namespace WSCF ...@@ -286,7 +293,8 @@ namespace WSCF
public PropertyChangedEventHandler PropertyChanged; public PropertyChangedEventHandler PropertyChanged;
public SubPropertyChangedEventHandler SubPropertyChanged; public SubPropertyChangedEventHandler SubPropertyChanged;
public SubPropertyNode() { public SubPropertyNode()
{
PropertyChanged = new PropertyChangedEventHandler(_PropertyChanged); PropertyChanged = new PropertyChangedEventHandler(_PropertyChanged);
} }
public void _PropertyChanged(object sender, PropertyChangedEventArgs e) public void _PropertyChanged(object sender, PropertyChangedEventArgs e)
......
...@@ -13,6 +13,7 @@ namespace WSCF ...@@ -13,6 +13,7 @@ namespace WSCF
/// </summary> /// </summary>
public class PushAttribute : Attribute public class PushAttribute : Attribute
{ {
public const string DefaultTriggerNameHeader = "Trigger_";
public Type EventArgsType; public Type EventArgsType;
public string TriggerName; public string TriggerName;
public PushAttribute(Type eventArgsType) public PushAttribute(Type eventArgsType)
......
This diff is collapsed.
This diff is collapsed.
...@@ -175,7 +175,7 @@ namespace WSCF ...@@ -175,7 +175,7 @@ namespace WSCF
public void Dispose() public virtual void Dispose()
{ {
ws.Close(); ws.Close();
FObjServiceClientManager.Instance.ObjClientDisponse(this); FObjServiceClientManager.Instance.ObjClientDisponse(this);
......
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