Example #1
0
        protected override void LoadChildren()
        {
            Children.Add(new WaitingViewModel(this));

            Task.Run(() => _solutionManager.GetProjectTypes(_projectPath, _solutionPath)).ContinueWith((result) =>
            {
                Children.Clear();

                foreach (var type in result.Result.OrderBy(x => x.Name))
                {
                    if (type is InterfaceDetails id)
                    {
                        Children.Add(new InterfaceViewModel(id, this));
                    }
                    else if (type is ClassDetails cd)
                    {
                        Children.Add(new ClassViewModel(cd, this));
                    }
                    else if (type is EnumDetails ed)
                    {
                        Children.Add(new EnumViewModel(ed, this));
                    }
                    else if (type is StructDetails sd)
                    {
                        Children.Add(new StructViewModel(sd, this));
                    }
                }

                RefreshName();
            }, TaskScheduler.FromCurrentSynchronizationContext());

            base.LoadChildren();
        }