141 lines
5.5 KiB
Plaintext
141 lines
5.5 KiB
Plaintext
|
|
<UserControl
|
||
|
|
x:Class="ScriptPad.CodeEditor"
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
|
|
xmlns:editor="http://icsharpcode.net/sharpdevelop/avalonedit"
|
||
|
|
xmlns:local="clr-namespace:ScriptPad"
|
||
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
|
|
d:DesignHeight="450"
|
||
|
|
d:DesignWidth="800"
|
||
|
|
mc:Ignorable="d">
|
||
|
|
<UserControl.Resources>
|
||
|
|
<ResourceDictionary>
|
||
|
|
<ResourceDictionary.MergedDictionaries>
|
||
|
|
<ResourceDictionary Source="Resource/ImageResource.xaml" />
|
||
|
|
</ResourceDictionary.MergedDictionaries>
|
||
|
|
</ResourceDictionary>
|
||
|
|
</UserControl.Resources>
|
||
|
|
<Grid>
|
||
|
|
<Grid.RowDefinitions>
|
||
|
|
<RowDefinition Height="auto" />
|
||
|
|
<RowDefinition Height="*" />
|
||
|
|
<RowDefinition Height="auto" />
|
||
|
|
<RowDefinition Height="20" MaxHeight="500" />
|
||
|
|
</Grid.RowDefinitions>
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<ColumnDefinition Width="*" />
|
||
|
|
<ColumnDefinition Width="auto" />
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
|
||
|
|
<ToolBar
|
||
|
|
Grid.Row="0"
|
||
|
|
Height="36"
|
||
|
|
Background="LightGray"
|
||
|
|
ToolBarTray.IsLocked="True">
|
||
|
|
<ToolBar.Template>
|
||
|
|
<ControlTemplate TargetType="ToolBar">
|
||
|
|
<ToolBarPanel Background="{TemplateBinding Background}" IsItemsHost="True" />
|
||
|
|
</ControlTemplate>
|
||
|
|
</ToolBar.Template>
|
||
|
|
<ToolBar.Resources>
|
||
|
|
<Style TargetType="{x:Type Image}">
|
||
|
|
|
||
|
|
<Setter Property="Height" Value="16" />
|
||
|
|
<Setter Property="Margin" Value="1" />
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ButtonBase}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
|
||
|
|
<Setter Property="Opacity" Value="0.30" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</ToolBar.Resources>
|
||
|
|
|
||
|
|
<Button
|
||
|
|
Name="OpenFile_btn"
|
||
|
|
Margin="3"
|
||
|
|
Click="OpenFile_btn_Click"
|
||
|
|
ToolTip="从文件加载">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/OpenFile_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Button
|
||
|
|
Name="SaveFile_btn"
|
||
|
|
Click="SaveFile_btn_Click"
|
||
|
|
ToolTip="Save">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/Save_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Button Command="Undo" ToolTip="Undo">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/Undo_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Button Command="Redo" ToolTip="Redo">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/Redo_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Separator />
|
||
|
|
<Button
|
||
|
|
Name="runBtn"
|
||
|
|
Click="runBtn_Click"
|
||
|
|
ToolTip="Run">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/Run_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Separator />
|
||
|
|
<Button Name="formatBtn" Click="formatBtn_Click">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/FormatDocument_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Button Name="CommentBtn" Click="CommentBtn_Click">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/CommentCode_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Button Name="UnCommentBtn" Click="UnCommentBtn_Click">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/UnCommentCode_16x.png" />
|
||
|
|
</Button>
|
||
|
|
<Separator />
|
||
|
|
<Button
|
||
|
|
Name="AddReference"
|
||
|
|
Click="Reference_Click"
|
||
|
|
ToolTip="引用">
|
||
|
|
<Image Source="/ScriptPad;component/Resource/Images/Reference_16x.png" />
|
||
|
|
</Button>
|
||
|
|
</ToolBar>
|
||
|
|
|
||
|
|
<editor:TextEditor
|
||
|
|
x:Name="codeEditor"
|
||
|
|
Grid.Row="1"
|
||
|
|
FontFamily="Consolas"
|
||
|
|
FontSize="14"
|
||
|
|
ShowLineNumbers="True"
|
||
|
|
SyntaxHighlighting="C#">
|
||
|
|
<editor:TextEditor.ContextMenu>
|
||
|
|
<ContextMenu>
|
||
|
|
<MenuItem
|
||
|
|
Command="Find"
|
||
|
|
Header="Find"
|
||
|
|
Icon="{StaticResource Search}" />
|
||
|
|
<Separator />
|
||
|
|
<MenuItem
|
||
|
|
Command="Cut"
|
||
|
|
Header="Cut"
|
||
|
|
Icon="{StaticResource CutImage}" />
|
||
|
|
<MenuItem
|
||
|
|
Command="Copy"
|
||
|
|
Header="Copy"
|
||
|
|
Icon="{StaticResource CopyImage}" />
|
||
|
|
<MenuItem
|
||
|
|
Command="Paste"
|
||
|
|
Header="Paste"
|
||
|
|
Icon="{StaticResource PasteImage}" />
|
||
|
|
</ContextMenu>
|
||
|
|
</editor:TextEditor.ContextMenu>
|
||
|
|
</editor:TextEditor>
|
||
|
|
<GridSplitter
|
||
|
|
Grid.Row="2"
|
||
|
|
Height="6"
|
||
|
|
HorizontalAlignment="Stretch" />
|
||
|
|
<RichTextBox
|
||
|
|
Name="outTextbox"
|
||
|
|
Grid.Row="3"
|
||
|
|
FontFamily="Consolas"
|
||
|
|
FontSize="14"
|
||
|
|
VerticalScrollBarVisibility="Visible">
|
||
|
|
<FlowDocument Name="flowDocument" />
|
||
|
|
</RichTextBox>
|
||
|
|
</Grid>
|
||
|
|
</UserControl>
|