Exemplo n.º 1
0
        private void Core_ProxyCleared(Core sender)
        {
            Action method = delegate
            {
                try
                {
                    View.Nodes.Clear();
                    HighlightNodes.Clear();
                }
                catch (Exception exception)
                {
                    ShowOverlayError(exception);
                }
            };

            TryBeginInvoke(method);
        }
Exemplo n.º 2
0
        private void Core_ProxyCleared(Core sender)
        {
            void ClearNodes()
            {
                try
                {
                    View.Nodes.Clear();
                    HighlightNodes.Clear();
                }
                catch (Exception exception)
                {
                    ShowOverlayError(exception);
                }
            }

            TryBeginInvoke(ClearNodes);
        }
Exemplo n.º 3
0
        private void Core_ProxyAdded(Core sender, IEnumerable <ICOMObject> ownerPath, ICOMObject comObject)
        {
            Action method = delegate
            {
                try
                {
                    TreeNode node = FindPath(ownerPath);
                    if (null != node)
                    {
                        TreeNode newNode = node.Nodes.Add(ComObjectName(comObject));
                        newNode.Tag = comObject.GetHashCode();
                        if (HighlightNewProxies)
                        {
                            newNode.BackColor = _highlightColor;
                            HighlightNodes.Add(newNode, DateTime.Now);
                        }
                        if (AutoExpandNodes)
                        {
                            View.ExpandAll();
                        }
                    }
                    else
                    {
                        TreeNode newNode = View.Nodes.Add(ComObjectName(comObject));
                        newNode.Tag = comObject.GetHashCode();
                        if (HighlightNewProxies)
                        {
                            newNode.BackColor = _highlightColor;
                            HighlightNodes.Add(newNode, DateTime.Now);
                        }
                        if (AutoExpandNodes)
                        {
                            View.ExpandAll();
                        }
                    }
                }
                catch (Exception exception)
                {
                    ShowOverlayError(exception);
                }
            };

            TryBeginInvoke(method);
        }
Exemplo n.º 4
0
        private void Core_ProxyRemoved(Core sender, IEnumerable <ICOMObject> ownerPath, ICOMObject comObject)
        {
            Action method = delegate
            {
                try
                {
                    int      objectHashCode = comObject.GetHashCode();
                    TreeNode node           = FindPath(ownerPath);
                    if (null != node)
                    {
                        TreeNode targetNode = null;
                        foreach (TreeNode item in node.Nodes)
                        {
                            if (null == item.Tag)
                            {
                                continue;
                            }
                            int itemHashCode = (int)item.Tag;
                            if (itemHashCode == objectHashCode)
                            {
                                targetNode = item;
                                break;
                            }
                        }
                        if (null != targetNode)
                        {
                            HighlightNodes.Remove(targetNode);
                            node.Nodes.Remove(targetNode);
                        }
                    }
                    else
                    {
                        TreeNode targetNode = null;
                        foreach (TreeNode item in View.Nodes)
                        {
                            if (null == item.Tag)
                            {
                                continue;
                            }
                            int itemHashCode = (int)item.Tag;
                            if (itemHashCode == objectHashCode)
                            {
                                targetNode = item;
                                break;
                            }
                        }
                        if (null != targetNode)
                        {
                            HighlightNodes.Remove(targetNode);
                            View.Nodes.Remove(targetNode);
                        }
                    }
                }
                catch (Exception exception)
                {
                    ShowOverlayError(exception);
                }
            };

            TryBeginInvoke(method);
        }