예제 #1
0
        private static void CreateToolWindowCallBack(object caller, CallbackArgs arguments)
        {
            arguments.ReturnValue = VSConstants.S_OK;

            // Create the output mock object for the frame
            IVsWindowFrame frame = MockWindowFrameProvider.GetBaseFrame();

            arguments.SetParameter(9, frame);

            // The window pane (if one is provided) needs to be sited
            IVsWindowPane pane = arguments.GetParameter(2) as IVsWindowPane;

            if (pane != null)
            {
                // Create a service provider to site the window pane
                OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();
                // It needs to provide STrackSelection
                GenericMockFactory trackSelectionFactory = MockWindowFrameProvider.TrackSelectionFactory;
                serviceProvider.AddService(typeof(STrackSelection), trackSelectionFactory.GetInstance(), false);
                // Add support for output window
                serviceProvider.AddService(typeof(SVsOutputWindow), new OutputWindowService(), false);
                // Finally we need support for FindToolWindow
                serviceProvider.AddService(typeof(SVsUIShell), GetWindowEnumerator0(), false);

                pane.SetSite(serviceProvider);
            }
        }
예제 #2
0
        private static void FindToolWindowCallBack(object caller, CallbackArgs arguments)
        {
            arguments.ReturnValue = VSConstants.S_OK;

            // Create the output mock object for the frame
            IVsWindowFrame frame = MockWindowFrameProvider.GetBaseFrame();

            arguments.SetParameter(2, frame);
        }