本文整理汇总了C#中Microsoft.VsSDK.UnitTestLibrary.CallbackArgs类的典型用法代码示例。如果您正苦于以下问题:C# CallbackArgs类的具体用法?C# CallbackArgs怎么用?C# CallbackArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallbackArgs类属于Microsoft.VsSDK.UnitTestLibrary命名空间,在下文中一共展示了CallbackArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentSelectionCallback
private static void GetCurrentSelectionCallback(object caller, CallbackArgs arguments)
{
// Read the current selection data
VSITEMSELECTION[] selection = (VSITEMSELECTION[])((BaseMock)caller)["Selection"];
// Initialize output parameters for empty selection
arguments.SetParameter(0, IntPtr.Zero); // hierarchyPtr
arguments.SetParameter(1, VSConstants.VSITEMID_NIL); // itemid
arguments.SetParameter(2, null); // multiItemSelect
arguments.SetParameter(3, IntPtr.Zero); // selectionContainer
if (selection != null)
{
if (selection.Length == 1)
{
if (selection[0].pHier != null)
{
IntPtr ptrHier = Marshal.GetComInterfaceForObject(selection[0].pHier, typeof(IVsHierarchy));
arguments.SetParameter(0, ptrHier); // hierarchyPtr
}
arguments.SetParameter(1, selection[0].itemid); // itemid
}
else
{
// Multiple selection, return IVsMultiItemSelect interface
arguments.SetParameter(1, VSConstants.VSITEMID_SELECTION); // itemid
arguments.SetParameter(2, caller as IVsMultiItemSelect); // multiItemSelect
}
}
arguments.ReturnValue = VSConstants.S_OK;
}
示例2: OutputWindowPaneCallback
private void OutputWindowPaneCallback(object sender, CallbackArgs args) {
callbackExecuted = true;
string expectedText = "Global SrcML Service Function called.\n";
string inputText = (string)args.GetParameter(0);
Assert.AreEqual(expectedText, inputText, "OutputString called with wrong text.");
args.ReturnValue = 0;
}
示例3: CreateToolWindowNegativeTestCallBack
private static void CreateToolWindowNegativeTestCallBack(object caller, CallbackArgs arguments)
{
arguments.ReturnValue = VSConstants.S_OK;
//set the windowframe object to null
arguments.SetParameter(9, null);
}
示例4: CreateInstanceCallBack
private static void CreateInstanceCallBack(object caller, CallbackArgs arguments)
{
// Create the output mock object for the frame
IVsTextLines textLines = (IVsTextLines)GetIVsTextLinesInstance();
///GCHandle handle = GCHandle.Alloc(textLines);
arguments.SetParameter(4, Marshal.GetComInterfaceForObject(textLines, typeof(IVsTextLines)));
arguments.ReturnValue = VSConstants.S_OK;
}
示例5: CreateToolWindowCallBack
private static void CreateToolWindowCallBack(object caller, CallbackArgs arguments)
{
arguments.ReturnValue = VSConstants.S_OK;
// Create the output mock object for the frame
IVsWindowFrame frame = WindowFrameMock.GetBaseFrame();
arguments.SetParameter(9, frame);
}
示例6: GetPropertyCallBack2
private static void GetPropertyCallBack2(object caller, CallbackArgs arguments)
{
if ((int)arguments.GetParameter(0) == (int)__VSSPROPID.VSSPROPID_IsInCommandLineMode)
{
arguments.SetParameter(1, false);
arguments.ReturnValue = VSConstants.S_OK;
return;
}
arguments.ReturnValue = VSConstants.E_NOTIMPL;
}
示例7: GetPropertyCallBack
private static void GetPropertyCallBack(object caller, CallbackArgs arguments)
{
__VSSPROPID propertyID = (__VSSPROPID)arguments.GetParameter(0);
switch(propertyID)
{
case __VSSPROPID.VSSPROPID_IsInCommandLineMode:
arguments.SetParameter(1, true);
break;
default:
break;
}
arguments.ReturnValue = VSConstants.S_OK;
}
示例8: ReadCallback
private static void ReadCallback(object caller, CallbackArgs arguments)
{
string propertyName = (string)arguments.GetParameter(0);
if (propertyName == strSolutionControlledProperty)
{
arguments.SetParameter(1, true);
arguments.ReturnValue = VSConstants.S_OK;
return;
}
else if (propertyName == strSolutionBindingsProperty)
{
arguments.SetParameter(1, "Solution's location");
arguments.ReturnValue = VSConstants.S_OK;
return;
}
arguments.ReturnValue = VSConstants.E_NOTIMPL;
}
示例9: FindConnectionPointCallback
private static void FindConnectionPointCallback(object sender, CallbackArgs args)
{
BaseMock mock = (BaseMock)sender;
Dictionary<Guid, IConnectionPoint> connectionPoints =
(Dictionary<Guid, IConnectionPoint>)mock[connectionPointsCollection];
Guid eventGuid = (Guid)args.GetParameter(0);
IConnectionPoint connectionPoint;
if (!connectionPoints.TryGetValue(eventGuid, out connectionPoint))
{
// This container does not contain a connection point for this event type,
// so set the out parameter to null and return an error.
args.SetParameter(1, null);
args.ReturnValue = Microsoft.VisualStudio.VSConstants.E_NOINTERFACE;
return;
}
// The connection point is handled.
args.SetParameter(1, connectionPoint);
args.ReturnValue = Microsoft.VisualStudio.VSConstants.S_OK;
}
示例10: GetToolWindowEnumCallBack2
private static void GetToolWindowEnumCallBack2(object caller, CallbackArgs arguments)
{
arguments.ReturnValue = VSConstants.S_OK;
// Create the output mock object
if (enumWindowsFactory2 == null)
enumWindowsFactory2 = new GenericMockFactory("EnumWindows2", new Type[] { typeof(IEnumWindowFrames) });
BaseMock enumWindows = enumWindowsFactory2.GetInstance();
// Add support for Next
string name = string.Format("{0}.{1}", typeof(IEnumWindowFrames).FullName, "Next");
enumWindows.AddMethodCallback(name, new EventHandler<CallbackArgs>(NextCallBack2));
windowCount = 0;
arguments.SetParameter(0, enumWindows);
}
示例11: CreateToolWindowCallBack
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);
}
}
示例12: ShowMessageBoxCallBack
private static void ShowMessageBoxCallBack(object caller, CallbackArgs arguments)
{
arguments.ReturnValue = VSConstants.S_OK;
arguments.SetParameter(10, (int)System.Windows.Forms.DialogResult.Yes);
}
示例13: SetWaitCursorCallBack
private static void SetWaitCursorCallBack(object caller, CallbackArgs arguments)
{
arguments.ReturnValue = VSConstants.S_OK;
}
示例14: SaveDocDataToFileCallBack
private static void SaveDocDataToFileCallBack(object caller, CallbackArgs arguments)
{
arguments.ReturnValue = VSConstants.S_OK;
}
示例15: IncludeDebugInformationCallBack
private static void IncludeDebugInformationCallBack(object caller, CallbackArgs arguments)
{
BaseMock compiler = (BaseMock)caller;
compiler["IncludeDebugInformation"] = arguments.GetParameter(0);
}