コード例 #1
0
ファイル: FinderNode.cs プロジェクト: tekcor/vvvv-sdk
        protected override void Dispose(bool disposing)
        {
            if (!FDisposed)
            {
                if (disposing)
                {
                    // Dispose managed resources.
                    FSearchTextBox.ContextMenu.Popup -= FSearchTextBox_ContextMenu_Popup;
                    FSearchTextBox.MouseWheel        -= FSearchTextBox_MouseWheel;
                    FHDEHost.WindowSelectionChanged  -= HandleWindowSelectionChanged;
                    FTagsPin.Changed -= HandleTagsPinChanged;

                    //                    if (FSearchResult != null)
                    //                        FSearchResult.Dispose();

                    ActivePatchNode = null;

                    this.FSearchTextBox.TextChanged -= this.FSearchTextBoxTextChanged;

                    // Shutdown viewer layer
                    this.FHierarchyViewer.MouseDoubleClick -= this.FHierarchyViewerDoubleClick;
                    this.FHierarchyViewer.MouseClick       -= this.FHierarchyViewerClick;
                    this.FHierarchyViewer.KeyPress         -= this.FHierarchyViewerKeyPress;
                    this.FHierarchyViewer.Dispose();
                    this.FHierarchyViewer = null;

                    // Shutdown view layer
                    FNodeView.Dispose();
                }
            }
            FDisposed = true;
        }
コード例 #2
0
        public MapperHierarchyNode(ModelMapper mapper, ICanvas canvas, IGraphElement parent, HierarchyViewer viewer)
            : base()
        {
            Mapper  = mapper;
            FCanvas = canvas;
            FViewer = viewer;

            MouseClick       += FViewer.MouseClickHandler;
            MouseDoubleClick += FViewer.MouseDoubleClickHandler;
            Tag = mapper.Model;

            //graphelements
            FBackground = canvas.CreateRectangle(this);
            FPoly       = canvas.CreatePoly(this);
            FText       = canvas.CreateText(null, "");
            FIcon       = FCanvas.CreateRectangle(null);

            parent.Add(FBackground);
            FBackground.Add(FPoly);
            FBackground.Add(FText);
            FBackground.Add(FIcon);

            //compute level of depth
            IGraphElement p = FBackground;

            while (p.Parent != null)
            {
                FDepth++;
                p = p.Parent;
            }
            FDepth -= 1;

            //init static properties via Mapper
            if (Mapper.CanMap <ISelectable>())
            {
                FSelectable = Mapper.Map <ISelectable>();
                FSelectable.SelectionChanged += selectable_SelectionChanged;
                Selected = FSelectable.Selected;
            }

            if (Mapper.CanMap <IDecoratable>())
            {
                FDecoratable = Mapper.Map <IDecoratable>();
                FDecoratable.DecorationChanged += decorated_DecorationChanged;
            }

            if (Mapper.CanMap <ILinkSource>())
            {
                FLinkSource = Mapper.Map <ILinkSource>();

                FLinkSourceRectangle = FCanvas.CreateRectangle(null);
                FBackground.Add(FLinkSourceRectangle);
                FLinkOffset = FTextOffset;
            }

            if (Mapper.CanMap <ILinkSink>())
            {
                FLinkSink = Mapper.Map <ILinkSink>();

                FLinkSinkRectangle = FCanvas.CreateRectangle(null);
                FBackground.Add(FLinkSinkRectangle);
            }

            if (Mapper.CanMap <INamed>())
            {
                FNamed          = Mapper.Map <INamed>();
                FNamed.Renamed += named_Renamed;
                SetCaption(FNamed.Name);
            }

            if (Mapper.CanMap <IParent>())
            {
                var node = Mapper.Map <IParent>();
                if (node.Childs != null)
                {
                    // Keep Nodes and items in sync
                    FSynchronizer         = FSubTree.SyncWith(node.Childs, CreateChildNode);
                    FSynchronizer.Synced += synchronizer_Synced;
                }
            }

            //init dynamic properties via Mapper
            UpdateColors();
            UpdateIcon();
            UpdateLinkSink();
            UpdateLinkSource();
        }