private void ExpandSymbolTreeViewModelRecursive(SymbolTreeViewModel svm)
        {
            svm.IsExpanded = true;

            foreach (var item in svm.Children)
            {
                ExpandSymbolTreeViewModelRecursive(item);
            }
        }
        public SymbolGroupViewModel(SymbolViewModelWrapper rootSymbol)
        {
            var rootSymbol1 = new SymbolTreeViewModel(rootSymbol);

            _firstGeneration = new ReadOnlyCollection <SymbolTreeViewModel>(
                new[]
            {
                rootSymbol1
            });
        }
        public SymbolGroupViewModel(SymbolViewModelWrapper rootSymbol)
        {
            var rootSymbol1 = new SymbolTreeViewModel(rootSymbol);

            _firstGeneration = new ReadOnlyCollection<SymbolTreeViewModel>(
                new[]
                {
                    rootSymbol1
                });
        }
        private void SetAllLeavesToDraggable(SymbolTreeViewModel stvm)
        {
            stvm.HasBeenDragged = false;

            if (stvm.Children != null && stvm.Children.Count > 0)
            {
                foreach (var stvm2 in stvm.Children)
                {
                    SetAllLeavesToDraggable(stvm2);
                }
            }
        }
        /// <summary>
        /// Method finds the first child node with the given GUID
        /// </summary>
        /// <param name="stvm"></param>
        /// <param name="guid"></param>
        /// <returns>Tree Symbol object with the given GUID</returns>
        private SymbolTreeViewModel FindChildWithGuid(SymbolTreeViewModel stvm, string guid)
        {
            if (stvm == null)
            {
                return(null);
            }

            if (stvm.GUID.CompareTo(guid) == 0)
            {
                return(stvm);
            }
            else
            {
                return(stvm.Children.Select(stvm2 => FindChildWithGuid(stvm2, guid)).FirstOrDefault(result => result != null));
            }
        }
        private SymbolTreeViewModel(SymbolViewModelWrapper symbolWrapper, SymbolTreeViewModel parent)
        {
            if (String.IsNullOrWhiteSpace(symbolWrapper.Id))
            {
                _guid = Guid.NewGuid().ToString("D");
            }
            else
            {
                _guid = symbolWrapper.Id;
            }
            _symbolWrapper = symbolWrapper;
            _parent        = parent;

            _children = new ReadOnlyCollection <SymbolTreeViewModel>(
                (from child in _symbolWrapper.Children
                 select new SymbolTreeViewModel(child, this))
                .ToList <SymbolTreeViewModel>());
        }
        private void SetAllLeavesToDraggable(SymbolTreeViewModel stvm)
        {
            stvm.HasBeenDragged = false;

            if (stvm.Children != null && stvm.Children.Count > 0)
            {
                foreach (var stvm2 in stvm.Children)
                {
                    SetAllLeavesToDraggable(stvm2);
                }
            }
        }
        /// <summary>
        /// Method finds the first child node with the given GUID
        /// </summary>
        /// <param name="stvm"></param>
        /// <param name="guid"></param>
        /// <returns>Tree Symbol object with the given GUID</returns>
        private SymbolTreeViewModel FindChildWithGuid(SymbolTreeViewModel stvm, string guid)
        {
            if (stvm == null)
            {
                return null;
            }

            if (stvm.GUID.CompareTo(guid) == 0)
            {
                return stvm;
            }
            else
            {
                return stvm.Children.Select(stvm2 => FindChildWithGuid(stvm2, guid)).FirstOrDefault(result => result != null);
            }
        }
        private void ExpandSymbolTreeViewModelRecursive(SymbolTreeViewModel svm)
        {
            svm.IsExpanded = true;

            foreach (var item in svm.Children)
            {
                ExpandSymbolTreeViewModelRecursive(item);
            }
        }
        private SymbolTreeViewModel(SymbolViewModelWrapper symbolWrapper, SymbolTreeViewModel parent)
        {
            if (String.IsNullOrWhiteSpace(symbolWrapper.Id))
            {
                _guid = Guid.NewGuid().ToString("D");
            }
            else
            {
                _guid = symbolWrapper.Id;
            }
            _symbolWrapper = symbolWrapper;
            _parent = parent;

            _children = new ReadOnlyCollection<SymbolTreeViewModel>(
                (from child in _symbolWrapper.Children
                 select new SymbolTreeViewModel(child, this))
                 .ToList<SymbolTreeViewModel>());
        }