static DebugPropertyViewModel From(IExpandablePropertyInfo debugPropertyInfo)
        {
            DebugPropertyViewModel vm = new DebugPropertyViewModel()
            {
                Name      = debugPropertyInfo.Name,
                Value     = "Expandable",
                ValueType = debugPropertyInfo.ValueType,
                FullName  = debugPropertyInfo.FullName,
                Parents   = ListParents(debugPropertyInfo)
            };

            return(vm);
        }
        private void IterateThrueProperty(IExpressionEvaluatorProvider expressionEvaluatorProvider)
        {
            ErrorMessage = null;
            _visibleProperties.Clear();

            StatusBarText = "Searching...";

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            if (_property != null)
            {
                IPropertyVisitor propertyVisitor = new ActionBasedPropertyVisitor(
                    expandableProperty =>
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        _visibleProperties.AddRange(expandableProperty.Select(item => DebugPropertyViewModel.From(item)));
                    });
                    _logger.Info(String.Join("\n", expandableProperty));
                },
                    valueProperty =>
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        _visibleProperties.AddRange(valueProperty.Select(item => DebugPropertyViewModel.From(item)));
                    });
                    _logger.Info(String.Join("\n", valueProperty));
                });

                PropertyIterator propertyIterator = new PropertyIterator(
                    expressionEvaluatorProvider,
                    propertyVisitor,
                    _searchStatus);

                _cancelSearch.Action = propertyIterator.Cancel;

                var searchTask = Task.Run(
                    () =>
                {
                    IsSearchInProgress = true;
                    propertyIterator.TraversPropertyTree(_property, _searchText);
                })
                                 .ContinueWith(t =>
                {
                    IsSearchInProgress = false;
                    stopwatch.Stop();
                    if (t.Exception != null)
                    {
                        if (t.Exception.InnerExceptions.First() is TaskCanceledException)
                        {
                            _logger.Info("Search canceled");
                            PostSearchCompleteMessage(stopwatch.Elapsed, true);
                        }
                        else     // Error
                        {
                            _logger.Error(t.Exception.ToString());
                            StatusBarText = "Error during evaluation. " + t.Exception.ToString();
                            throw t.Exception;
                        }
                    }
                    else
                    {
                        _logger.Info("Search finished");
                        PostSearchCompleteMessage(stopwatch.Elapsed, false);
                    }

                    _cancelSearch.Action = null;
                },
                                               _taskSchedulerProvider.GetCurrentScheduler());
            }
            else
            {
                _logger.Info("ExpressionEvaluator is not initialized");
                ErrorMessage = "ExpressionEvaluator is not initialized";
            }
        }