2009-06-20 42 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