惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
Cisco Talos Blog
Cisco Talos Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
Project Zero
Project Zero
E
Exploit-DB.com RSS Feed
S
Secure Thoughts
K
Kaspersky official blog
L
Lohrmann on Cybersecurity
NISL@THU
NISL@THU
WordPress大学
WordPress大学
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
小众软件
小众软件
P
Privacy & Cybersecurity Law Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
Hacker News: Ask HN
Hacker News: Ask HN
AWS News Blog
AWS News Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hacker News: Front Page
F
Full Disclosure
Latest news
Latest news
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
T
Troy Hunt's Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
G
GRAHAM CLULEY
Forbes - Security
Forbes - Security
V
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
P
Privacy International News Feed
C
Check Point Blog
N
News and Events Feed by Topic

博客园 - winkingzhang

Build 2016概览 WinRT开发系列之编程语言:功能和效率 WinRT开发系列之基础概念:WinRT不是…… [VS2010 Extension]PowerExtension.GoToDefinition VS2010 Extension实践(2) VS2010 Extension实践 如何通过反射调用带有ref或者out的参数的方法[迁移] Win7硬盘安装和移动硬盘访问出错的修复办法[迁移] zt. Windows Mobile开发文章收藏 [WPF]在Style中设置ToolTip的问题分析 [WPF]RadioButton在Group的Header区部分不响应鼠标选择的bug分析 WPF模式思考 (zt) How to Get IIS Web Sites Information Programmatically Visual Studio 调试器 Application Request Routing and the IIS 7.0 Web Management Service - winkingzhang Reference Resources for MOSS and WSS - winkingzhang FileSystemWatcher事件多次触发的解决方法 - winkingzhang ASP.NET Application Life Cycle - winkingzhang CAS and Native Code - winkingzhang
VS2010 Extension实践(3)——实现自定义配置
winkingzhang · 2010-06-13 · via 博客园 - winkingzhang

在之前的两篇曾提到通过VSSDK(MSDN也叫VSX)来拓宽思路,实现一些MEF Extension所不能做到的功能,比如获取IVsUIShell服务来执行Command等等,这里我给各位看官展示如何通过VSX提供自定义配置到IDE里面。

首先创建一个Package工程,找到里面的XX_Package.cs,要提供自定义配置到IDE,需要在这里通过ProviderProfile和ProviderOptionPage告诉Package两个重要信息:此Package有配置信息(Profiler)以及对应该配置信息的界面,这里我从我的GotoDef extension工程里截了一张图:

ProvideProfiler/ProvideOptionPage attributes usage, click to enlarge

其中ProvideProfile告诉Package提供的Profiler的相关信息:关联的提供该Profiler的类型、分类名称、页面名称、资源ID等等,VS在需要时会把保存的信息(默认在注册表里)读取并反序列化成关联的类型的对象,在关闭Option对话框或者确认应用配置时,会把配置信息对象序列化保存(默认在注册表)。

另一个ProvideOptionPage来指定配置信息对象和界面,它是从DialogPage派生,需要注意的是需要为它提供Guid和ClassInterface类型;默认情况下,显示该配置对象使用PropertyGrid,当然,可以通过override Window属性来自定义自己的UI,比如GoToDef中的配置UI,如下图:

GoToDefOptPage

完成以后在VS Extension工程中引用这个Package并添加到VSIX输出中,这样就可以使用配置了:

Use_GoToDef_Opt

Use_GoToDef_Opt2

至此,为VS Extension提供自定义配置的工作就完成了,具体效果可以参考我的上一篇帖子:

http://www.cnblogs.com/winkingzhang/archive/2010/02/26/1673995.html
Visual Studio .NET 2010 Options