public PackageManagerControl(PackageManagerModel model, IUserInterfaceService ui)
        {
            UI = ui;
            Model = model;

            InitializeComponent();

            var factory = ServiceLocator.GetGlobalService<SVsWindowSearchHostFactory, IVsWindowSearchHostFactory>();
            _windowSearchHost = factory.CreateWindowSearchHost(_searchControlParent);
            _windowSearchHost.SetupSearch(this);
            _windowSearchHost.IsVisible = true;

            _filter.Items.Add(Resx.Resources.Filter_All);
            _filter.Items.Add(Resx.Resources.Filter_Installed);
            _filter.Items.Add(Resx.Resources.Filter_UpdateAvailable);

            // TODO: Relocate to v3 API.
            _packageRestoreManager = ServiceLocator.GetInstance<IPackageRestoreManager>();
            AddRestoreBar();

            _packageDetail.Control = this;

            var outputConsoleProvider = ServiceLocator.GetInstance<IOutputConsoleProvider>();
            _outputConsole = outputConsoleProvider.CreateOutputConsole(requirePowerShellHost: false);

            InitSourceRepoList();
            _initialized = true;

            Model.Sources.PackageSourcesChanged += Sources_PackageSourcesChanged;
        }
        public int CreateEditorInstance(
            uint grfCreateDoc,
            string pszMkDocument,
            string pszPhysicalView,
            IVsHierarchy pvHier,
            uint itemid,
            System.IntPtr punkDocDataExisting,
            out System.IntPtr ppunkDocView,
            out System.IntPtr ppunkDocData,
            out string pbstrEditorCaption,
            out Guid pguidCmdUI,
            out int pgrfCDW)
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} CreateEditorInstace()", this.ToString()));

            // Initialize to null
            ppunkDocView       = IntPtr.Zero;
            ppunkDocData       = IntPtr.Zero;
            pguidCmdUI         = Guid.Empty;
            pgrfCDW            = 0;
            pbstrEditorCaption = "Package Manager";

            // Validate inputs
            if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
            {
                return(VSConstants.E_INVALIDARG);
            }
            if (punkDocDataExisting != IntPtr.Zero)
            {
                return(VSConstants.VS_E_INCOMPATIBLEDOCDATA);
            }

            // Create the Document (editor)
            object project;

            ErrorHandler.ThrowOnFailure(pvHier.GetProperty(
                                            VSConstants.VSITEMID_ROOT,
                                            (int)__VSHPROPID.VSHPROPID_ExtObject,
                                            out project));

            var myDoc = new PackageManagerModel(
                _context.SourceManager,
                _context.GetCurrentVsSolution().GetProject((Project)project));
            var NewEditor = new PackageManagerWindowPane(myDoc, _ui);

            ppunkDocView = Marshal.GetIUnknownForObject(NewEditor);
            ppunkDocData = Marshal.GetIUnknownForObject(myDoc);

            return(VSConstants.S_OK);
        }
 /// <summary>
 /// Initializes a new instance of the EditorPane class.
 /// </summary>
 public PackageManagerWindowPane(PackageManagerModel myDoc, IUserInterfaceService ui)
     : base(null)
 {
     PackageManagerControl control = new PackageManagerControl(myDoc, ui);
     _content = control;
 }
        public int CreateEditorInstance(
                        uint grfCreateDoc,
                        string pszMkDocument,
                        string pszPhysicalView,
                        IVsHierarchy pvHier,
                        uint itemid,
                        System.IntPtr punkDocDataExisting,
                        out System.IntPtr ppunkDocView,
                        out System.IntPtr ppunkDocData,
                        out string pbstrEditorCaption,
                        out Guid pguidCmdUI,
                        out int pgrfCDW)
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} CreateEditorInstace()", this.ToString()));

            // Initialize to null
            ppunkDocView = IntPtr.Zero;
            ppunkDocData = IntPtr.Zero;
            pguidCmdUI = Guid.Empty;
            pgrfCDW = 0;
            pbstrEditorCaption = "Package Manager";

            // Validate inputs
            if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
            {
                return VSConstants.E_INVALIDARG;
            }
            if (punkDocDataExisting != IntPtr.Zero)
            {
                return VSConstants.VS_E_INCOMPATIBLEDOCDATA;
            }

            // Create the Document (editor)
            object project;
            ErrorHandler.ThrowOnFailure(pvHier.GetProperty(
                VSConstants.VSITEMID_ROOT,
                (int)__VSHPROPID.VSHPROPID_ExtObject,
                out project));

            var myDoc = new PackageManagerModel(
                _context.SourceManager,
                _context.GetCurrentVsSolution().GetProject((Project)project));
            var NewEditor = new PackageManagerWindowPane(myDoc, _ui);
            ppunkDocView = Marshal.GetIUnknownForObject(NewEditor);
            ppunkDocData = Marshal.GetIUnknownForObject(myDoc);

            return VSConstants.S_OK;
        }