<local:NodeControlBase x:Class="Serein.Workbench.Node.View.ActionNodeControl"
                       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:converter="clr-namespace:Serein.Workbench.Converters"
                       xmlns:themes="clr-namespace:Serein.Workbench.Themes"
                       d:DataContext="{d:DesignInstance vm:ActionNodeControlViewModel}"
                       mc:Ignorable="d"
                       MaxWidth="500">

    <UserControl.Resources>
        <!--<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />-->
        <converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
        <!--<ResourceDictionary Source="/Serein.Workbench;Node/View/NodeExecuteJunctionControl.xaml" x:Key="NodeExecuteJunctionControl"/>-->

    </UserControl.Resources>


    <Border BorderBrush="#8DE9FD"  BorderThickness="1">
        <Grid>
            <Grid.ToolTip>
                <ToolTip Background="LightYellow" Foreground="#071042" Content="{Binding NodeModel.MethodDetails}" />
            </Grid.ToolTip>
            
            <!--<TextBlock Text="{Binding NodelModel.DebugSetting.IsInterrupt}}"></TextBlock>-->
            <!--DataContext="{Binding}-->


            <Border x:Name="InterruptBorder" Tag="{Binding NodeModel.DebugSetting.IsInterrupt}">
                <Border.Style>
                    <Style TargetType="Border">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=Tag,RelativeSource={RelativeSource Mode=Self}}" Value="True">
                                <Setter Property="BorderBrush" Value="Red" />
                                <Setter Property="BorderThickness" Value="2" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=Tag,RelativeSource={RelativeSource Mode=Self}}" Value="False">
                                <Setter Property="BorderBrush" Value="Transparent" />
                                <Setter Property="BorderThickness" Value="0" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Border.Style>


                <Grid Background="#8DE9FD" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <Grid Grid.Row="0" >
                        <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"/>
                        <StackPanel Grid.Column="1" Grid.RowSpan="2" >
                            <TextBlock Text="{Binding NodeModel.DisplayName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center"/>
                        </StackPanel>
                        <local:NextStepJunctionControl Grid.Column="2"  NodeViewModel="{Binding}"  x:Name="NextStepJunctionControl" HorizontalAlignment="Right" Grid.RowSpan="2"/>

                    </Grid>
                    
                    <themes:MethodDetailsControl Grid.Row="2"  x:Name="MethodDetailsControl" MethodDetails="{Binding NodeModel.MethodDetails}" NodeViewModel="{Binding}"/>
                    
                    <Border Grid.Row="2" x:Name="ParameterProtectionMask" Background="#40508D" Opacity="0.5" BorderThickness="0" 
                        Visibility="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay, 
                                            Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Normal}" />
                    
                    <Grid Grid.Row="3"  Background="#D5F0FC" >
                        <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 Orientation="Horizontal">
                            <CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsEnable, Mode=TwoWay}"/>
                            <TextBlock Text="是否使能"/>
                        </StackPanel>


                        <StackPanel Orientation="Horizontal">
                            <CheckBox  IsChecked="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay}"/>
                            <TextBlock Text="参数保护"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <CheckBox  IsChecked="{Binding NodeModel.DebugSetting.IsInterrupt, Mode=TwoWay}"/>
                            <TextBlock Text="中断节点"/>
                        </StackPanel>
                        
                        
                    </StackPanel>

                </Grid>

            </Border>
        </Grid>
    </Border>
</local:NodeControlBase>
