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

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

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