Beispiel #1
0
 public abstract Task SetViewModelAsync(PropertyPageViewModel propertyPageViewModel);
Beispiel #2
0
#pragma warning disable CA1725 // Parameter names should match base declaration
        public void SetObjects(uint cObjects, object[] ppUnk)
#pragma warning restore CA1725 // Parameter names should match base declaration
        {
            if (cObjects == 0)
            {
                return;
            }
#if DEBUG
            if (ppUnk == null)
            {
                throw new ArgumentNullException(nameof(ppUnk));
            }

            if (ppUnk.Length < cObjects)
            {
                throw new ArgumentOutOfRangeException(nameof(cObjects));
            }
#endif
            ThreadHelper.ThrowIfNotOnUIThread();

            for (int i = 0; i < cObjects; i++)
            {
                var unk = ppUnk[i];

                var context = unk as IVsBrowseObjectContext;

                if (context == null && unk is IVsBrowseObject browseObject)
                {
                    int hr = browseObject.GetProjectItem(out var hierarchy, out uint itemId);

                    if (hr == VSConstants.S_OK && itemId == VSConstants.VSITEMID_ROOT)
                    {
                        if (hierarchy != null)
                        {
                            if (ErrorHandler.Succeeded(hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ExtObject, out var extObject)))
                            {
                                context = extObject as IVsBrowseObjectContext;

                                if (context == null)
                                {
                                    if (extObject is EnvDTE.Project dteProject)
                                    {
                                        context = dteProject.Object as IVsBrowseObjectContext;
                                    }
                                }
                            }
                        }
                    }
                }

                if (context != null)
                {
                    _unconfiguredProject     = context.UnconfiguredProject;
                    _projectThreadingService = _unconfiguredProject.ProjectService.Services.ThreadingPolicy;
                }
            }

            if (_unconfiguredProject == null)
            {
                throw new Exception("Couldn't find UnconfiguredProject!");
            }

            _propertyPageViewModel = CreatePropertyPageViewModel(_unconfiguredProject, _projectThreadingService);

            _propertyPageViewModel.ProjectPropertyChanged  += PropertyChanged;
            _propertyPageViewModel.ProjectPropertyChanging += PropertyChanging;
        }
Beispiel #3
0
 public virtual Task SetViewModelAsync(PropertyPageViewModel propertyPageViewModel)
 {
     return(Task.CompletedTask);
 }