<local:NodeControlBase x:Class="Serein.Workbench.Node.View.ScriptNodeControl"
                       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                       xmlns:local="clr-namespace:Serein.Workbench.Node.View"  
                       xmlns:vm="clr-namespace:Serein.Workbench.Node.ViewModel"
                       xmlns:themes="clr-namespace:Serein.Workbench.Themes"
                       xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
                       d:DataContext="{d:DesignInstance vm:ScriptNodeControlViewModel}"
                       mc:Ignorable="d"
                       MaxWidth="500">

    <Grid Background="#FEFAF4">

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Background="#E7EFF5" >
            <!--<Grid Grid.Row="0" >-->
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>

            <local:ExecuteJunctionControl  Grid.Column="0"  NodeViewModel="{Binding}" x:Name="ExecuteJunctionControl" HorizontalAlignment="Left" Grid.RowSpan="2"/>
            <Border Grid.Column="1" BorderThickness="1" HorizontalAlignment="Stretch">
                <TextBlock Text="{Binding NodeModel.DisplayName, Mode=TwoWay}"  HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Border>
            <local:NextStepJunctionControl Grid.Column="2"  NodeViewModel="{Binding}"  x:Name="NextStepJunctionControl" HorizontalAlignment="Right" Grid.RowSpan="2"/>

        </Grid>

        <Grid Grid.Row="1"   HorizontalAlignment="Stretch" Margin="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Row="0"  Grid.Column="0" Orientation="Horizontal">
                <TextBlock Text="脚本代码：" Margin="2"  HorizontalAlignment="Stretch" VerticalAlignment="Center"/>

                <Button Content="加载" Margin="3,0,1,0" Command="{Binding CommandLoadScript}" Height="17.2"></Button>
                <Button Content="执行" Margin="3,0,1,0" Command="{Binding CommandExecuting}" Height="17.2"></Button>
                <Button Content="c#代码" Margin="3,0,1,0" Command="{Binding CommandGenerateCode}" Height="17.2"></Button>
            </StackPanel>
            <themes:MethodDetailsControl Grid.Row="1"  x:Name="MethodDetailsControl" MethodDetails="{Binding NodeModel.MethodDetails}" NodeViewModel="{Binding}"/>
            <!--<TextBox Grid.Row="2" MinHeight="20" MinWidth="100"  TextWrapping="Wrap" AcceptsReturn="True"  IsEnabled="{Binding IsEnabledOnView}" Text="{Binding Script}"></TextBox>-->
            
            <avalonEdit:TextEditor Grid.Row="2" 
                      x:Name="codeEditor"
                      FontFamily="Consolas"
                      FontSize="12"
                      SyntaxHighlighting="C#"
                      TextChanged="codeEditor_TextChanged"
                      ShowLineNumbers="True"
                      Margin="10"/>
            
            <Grid Grid.Row="3"  >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0"  BorderThickness="1">
                    <TextBlock Text="result ->"  HorizontalAlignment="Center"  VerticalAlignment="Center" />
                </Border>
                <Border Grid.Column="1"  BorderThickness="1">
                    <TextBlock Text="{Binding NodeModel.MethodDetails.ReturnType, Converter={StaticResource TypeNameDisplaynConverter}}"  TextTrimming="CharacterEllipsis" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                </Border>

                <Border Grid.Column="2"  BorderThickness="1">
                    <local:ResultJunctionControl Grid.Column="2"  NodeViewModel="{Binding}" x:Name="ResultJunctionControl" HorizontalAlignment="Right"/>
                </Border>


            </Grid>


            <StackPanel Grid.Row="4" Background="Azure"  Orientation="Horizontal" Margin="3">
                <StackPanel Orientation="Horizontal">
                    <CheckBox  IsChecked="{Binding NodeModel.IsPublic, Mode=TwoWay}"/>
                    <TextBlock Text="全局公开"/>
                </StackPanel>
            </StackPanel>
            
            <!--<RichTextBox x:Name="richTextBox" VerticalScrollBarVisibility="Auto"
                              HorizontalScrollBarVisibility="Auto"
                          
                              TextChanged="RichTextBox_TextChanged"/>-->
            
            
            <!--<StackPanel Grid.Row="1"  Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Left">
            <local:ResultJunctionControl Grid.Column="2"  MyNode="{Binding NodelModel}" x:Name="ResultJunctionControl" HorizontalAlignment="Right"/>
            <TextBlock  Text="设置数据源" Margin="2"  HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
        </StackPanel>-->
        
        </Grid>
    </Grid>
</local:NodeControlBase>
