IVsUserSettingsQuery.NeedExport 方法
命名空间: Microsoft.VisualStudio.Shell.Interop
程序集: Microsoft.VisualStudio.Shell.Interop.8.0(在 Microsoft.VisualStudio.Shell.Interop.8.0.dll 中)
语法
声明
Function NeedExport ( _
szCategoryGUID As String, _
<OutAttribute> ByRef pfNeedExport As Integer _
) As Integer
int NeedExport(
string szCategoryGUID,
out int pfNeedExport
)
参数
- szCategoryGUID
类型:System.String
[in] 标识特定设置类别的 GUID (定义由自定义下落点) 的查询。
- pfNeedExport
类型:System.Int32%
[out] 布尔值返回指示 IDE 是否应调用 VSPackage 中导出设置实现。
返回值
类型:System.Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。
备注
唯一 VSPackage 中支持多个自定义下落点 (设置类别)。 因此, NeedExport 的实现必须检查已提供的自定义下落点的标识的 GUID 或设置类别参数,确定设置的一组特定是否需要保存。
示例
在此示例中, VSPackage 始终请求其命令栏状态保存,但是,仅请求约束状态保存该标志设置为它的键。
STDMETHOD(NeedExport)(WCHAR* pszCategoryGUID, BOOL *pfNeedExport)
{
if (!pfNeedExport)
return E_INVALIDARG;
CLSID clsidCategory;
HRESULT hr= S_OK;
hr = CLSIDFromString(pszCategoryGUID, &clsidCategory);
IfFailGo(hr);
if (GUID_Profiles_CommandBars == clsidCategory) {
*pfNeedExport = TRUE; //Always export Command Bar Configuration
}else if (GUID_Profiles_KeyBindings == clsidCategory) {
*pfNeedExport = FALSE; //By Default don't export key bindings
if (m_fMake_Permanent)
*pfNeedExport = TRUE; //Export if user wants current configuration saved.
}else{
hr = E_UNEXPECTED;
}
Error:
return hr;
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualStudio.Shell.Interop 命名空间