Exemplo n.º 1
0
        private static void GetPropertyCallBack(object caller, CallbackArgs arguments)
        {
            __VSSPROPID propertyID = (__VSSPROPID)arguments.GetParameter(0);

            switch (propertyID)
            {
            case __VSSPROPID.VSSPROPID_IsInCommandLineMode:
                // fake that we are running in command line mode in order to load normally (security)
                arguments.SetParameter(1, true);
                break;

            default:
                break;
            }
            arguments.ReturnValue = VSConstants.S_OK;
        }
Exemplo n.º 2
0
        private static void GetToolWindowEnumCallBack0(object caller, CallbackArgs arguments)
        {
            arguments.ReturnValue = VSConstants.S_OK;

            // Create the output mock object
            if (enumWindowsFactory0 == null)
            {
                enumWindowsFactory0 = new GenericMockFactory("EnumWindows", new Type[] { typeof(IEnumWindowFrames) });
            }
            BaseMock enumWindows = enumWindowsFactory0.GetInstance();
            // Add support for Next
            string name = string.Format("{0}.{1}", typeof(IEnumWindowFrames).FullName, "Next");

            enumWindows.AddMethodCallback(name, new EventHandler <CallbackArgs>(NextCallBack0));

            arguments.SetParameter(0, enumWindows);
        }
Exemplo n.º 3
0
        private static void GetLineTextCallbackForConsoleTextOfLine(object sender, CallbackArgs args)
        {
            BaseMock mock         = (BaseMock)sender;
            int      expectedLine = (int)mock["ExpectedLine"];

            Assert.IsTrue(expectedLine == (int)args.GetParameter(0));
            Assert.IsTrue(expectedLine == (int)args.GetParameter(2));

            int expectedStart = (int)mock["ExpectedStart"];

            Assert.IsTrue(expectedStart == (int)args.GetParameter(1));

            int expectedEnd = (int)mock["ExpectedEnd"];

            Assert.IsTrue(expectedEnd == (int)args.GetParameter(3));

            args.SetParameter(4, (string)mock["LineText"]);

            args.ReturnValue = Microsoft.VisualStudio.VSConstants.S_OK;
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 private static void ShowMessageBoxCallBack(object caller, CallbackArgs arguments)
 {
     arguments.ReturnValue = VSConstants.S_OK;
     arguments.SetParameter(10, (int)System.Windows.Forms.DialogResult.Yes);
 }
Exemplo n.º 6
0
 private static void ShowMessageBoxCancel(object caller, CallbackArgs arguments)
 {
     arguments.SetParameter(10, (int)DialogResult.Cancel);
     arguments.ReturnValue = VSConstants.S_OK;
 }
Exemplo n.º 7
0
 private static void NextCallBack0(object caller, CallbackArgs arguments)
 {
     arguments.ReturnValue = VSConstants.S_FALSE;
     arguments.SetParameter(2, (uint)0);
 }
Exemplo n.º 8
0
 private static void GetLocalRegistryRoot(object caller, CallbackArgs arguments)
 {
     arguments.SetParameter(0, @"SOFTWARE\Microsoft\VisualStudio\9.0");
     arguments.ReturnValue = VSConstants.S_OK;
 }
Exemplo n.º 9
0
 private static void GetLocalRegistryRoot(object caller, CallbackArgs arguments)
 {
     // this is required for fetch MSBuildPath key value
     arguments.SetParameter(0, @"SOFTWARE\Microsoft\VisualStudio\9.0"); // pbstrRoot
     arguments.ReturnValue = VSConstants.S_OK;
 }
Exemplo n.º 10
0
 private static void OpenCopyOfStandardEditorCallBack(object caller, CallbackArgs arguments)
 {
     arguments.ReturnValue = VSConstants.S_OK;
     arguments.SetParameter(2, (IVsWindowFrame)GetWindowFrameInstance());
 }
Exemplo n.º 11
0
        private static void QuerySaveFileCallBack(object caller, CallbackArgs arguments)
        {
            arguments.ReturnValue = VSConstants.S_OK;

            arguments.SetParameter(3, (uint)tagVSQuerySaveResult.QSR_SaveOK);   //set result
        }
Exemplo n.º 12
0
 private static void GetLocalRegistryRootCallBack(object caller, CallbackArgs arguments)
 {
     arguments.SetParameter(0, MockILocalRegistry3.LocalRegistryRoot);
     arguments.ReturnValue = VSConstants.S_OK;
 }