public void Dispose() { if (FDisposed) { return; } if (FSynchronizer != null) { FSynchronizer.Synced -= synchronizer_Synced; FSynchronizer.Dispose(); } if (FNamed != null) { FNamed.Renamed -= named_Renamed; } if (FDecoratable != null) { FDecoratable.DecorationChanged -= decorated_DecorationChanged; } if (FSelectable != null) { FSelectable.SelectionChanged -= selectable_SelectionChanged; } foreach (var n in FSubTree) { n.Dispose(); } FSubTree.Dispose(); FPoly.Clear(); FText.Clear(); FIcon.Clear(); FBackground.Clear(); if (FBackground.Parent != null) { FBackground.Parent.Remove(FBackground); } MouseClick -= FViewer.MouseClickHandler; MouseDoubleClick -= FViewer.MouseDoubleClickHandler; Mapper.Dispose(); FDisposed = true; }