Exemplo n.º 1
0
        private void RemoteFolder_ChildRemoved(RemoteObject sender, RemoteFolderChildEventArgs args)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(delegate { this.RemoteFolder_ChildRemoved(sender, args); }));

                return;
            }


            var removedItem = args.Target;

            if (!mObjectsNodes.TryGetValue(removedItem.InternalId, out var nodes))
            {
                return;
            }

            //copy it, as the DeleteTreeNodes_r will change it
            var nodesArray = nodes.ToArray();

            foreach (var node in nodesArray)
            {
                DeleteTreeNodes_r(node);
            }
        }
Exemplo n.º 2
0
        internal void OnChildDestroyed(RemoteObject child)
        {
            //if children not cached, nothing to do...
            if (mChildren == null)
            {
                return;
            }

            mChildren.Remove(child.Name);

            if (ChildRemoved != null)
            {
                var args = new RemoteFolderChildEventArgs(child);
                ChildRemoved(this, args);
            }
        }
Exemplo n.º 3
0
        internal void OnChildCreated(JsonValue data)
        {
            //Are we tracking children?
            if (mChildren == null)
            {
                //No, so just ignore
                return;
            }

            var obj = RemoteObjectManager.LoadObject(data);

            mChildren.Add(obj.Name, obj);

            if (ChildAdded != null)
            {
                var args = new RemoteFolderChildEventArgs(obj);
                ChildAdded(this, args);
            }
        }
Exemplo n.º 4
0
        private void RemoteFolder_ChildAdded(RemoteObject sender, RemoteFolderChildEventArgs args)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(delegate { this.RemoteFolder_ChildAdded(sender, args); }));
            }
            else
            {
                var addedItem = args.Target;

                if (!mObjectsNodes.TryGetValue(addedItem.ParentInternalId, out var nodes))
                {
                    return;
                }

                foreach (var node in nodes)
                {
                    AddNewNode(addedItem, node);
                }
            }
        }