Пример #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);
        }
Пример #3
0
        private static void NextCallBack2(object caller, CallbackArgs arguments)
        {
            if (windowCount >= 2)
            {
                // We already enumerated 2 window frames, we are done (0 left to enumerate)
                NextCallBack0(caller, arguments);
                return;
            }

            arguments.ReturnValue = VSConstants.S_OK;
            // Create the list of properties we expect being asked for
            Dictionary <int, object> properties = new Dictionary <int, object>();

            properties.Add((int)__VSFPROPID.VSFPROPID_Caption, "Tool Window " + windowCount.ToString());
            ++windowCount;
            properties.Add((int)__VSFPROPID.VSFPROPID_GuidPersistenceSlot, Guid.NewGuid());
            // Create the output mock object for the frame
            object o = arguments.GetParameter(1);

            IVsWindowFrame[] frame = (IVsWindowFrame[])o;
            frame[0] = MockWindowFrameProvider.GetFrameWithProperties(properties);
            // fetched 1 frame
            arguments.SetParameter(2, (uint)1);
        }