2009-06-20 79 views
2

我听说PowerShell ISE使用与VisualStudio 2010和Oslo IntelliPad相同的WPF文本编辑器。我知道你可以通过在编辑器的XAML文件中插入你自己的WPF控件来在VisualStudio中扩展这个编辑器。我现在的问题是:PowerShellISE也可以吗?有没有人试图做到这一点呢?PowerShell ISE WPF控制内联

回答

4

确实是一样的控制。我不相信你可以插入你自己的WPF控件。但是,ISE完全是程序化的,并且有一个可用于定制ISE的对象模型。您可以使用$ psise变量访问对象模型。你可以调整很多选项与$ psise.options

1 > $psise.options 


SelectedScriptPaneState  : Right 
ShowToolBar     : True 
TokenColors     : {[Attribute, #FF84A7C1], [Command, #FFFFFF60], 
           [CommandArgument, #FFFFFFFF], [CommandParameter 
           , #FFFFDE00]...} 
DefaultOptions    : Microsoft.PowerShell.Host.ISE.ISEOptions 
FontSize      : 16 
FontName      : consolas 
ErrorForegroundColor   : #FFFF0000 
ErrorBackgroundColor   : #00FFFFFF 
WarningForegroundColor  : #FFFF8C00 
WarningBackgroundColor  : #00FFFFFF 
VerboseForegroundColor  : #FF0000FF 
VerboseBackgroundColor  : #00FFFFFF 
DebugForegroundColor   : #FF0000FF 
DebugBackgroundColor   : #00FFFFFF 
OutputPaneBackgroundColor  : #FF000000 
OutputPaneTextBackgroundColor : #FF000000 
OutputPaneForegroundColor  : #FFFFFFFF 
CommandPaneBackgroundColor : #FF000000 
ScriptPaneBackgroundColor  : #FF000000 
ScriptPaneForegroundColor  : #FF000000 
ShowWarningForDuplicateFiles : True 
ShowWarningBeforeSavingOnRun : True 
UseLocalHelp     : True 
CommandPaneUp     : True 
+0

我还没有看到他们使用的.xaml文件,所以我觉得安迪是正确的,唯一的扩展点是通过$ psise对象。我认为.xaml文件已经被编译成其中一个程序集。 – 2009-06-21 16:10:18

+0

视觉工作室编辑器不是.xaml文件:) – 2010-10-09 05:13:52

+0

Andy的整体观点是正确的 - 它是相同的编辑器,但是可扩展性机制(我认为它仍然是MEF,但是它们的版本有些过期)基本上被设置为不加载其他程序集。 – 2010-10-09 05:15:30