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

    <UserControl.Resources>
        <vm:TypeToStringConverter x:Key="TypeToStringConverter"/>
        <!--<themes:ConditionControl x:Key="ConditionControl"/>-->
        <converter:InvertableBooleanToVisibilityConverter x:Key="InvertedBoolConverter"/>
    </UserControl.Resources>

    <Border  BorderBrush="#FCB334" BorderThickness="1">
        <Grid>
            <Grid.ToolTip>
                <ToolTip Background="LightYellow" Foreground="#071042" Content="{Binding NodeModel.MethodDetails, UpdateSourceTrigger=PropertyChanged}" />
            </Grid.ToolTip>

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

            <Grid Grid.Row="0" Background="#FCB334" >
                <!--<Grid Grid.Row="0" >-->
                <Grid.RowDefinitions>
                    <RowDefinition Height="3*"/>
                    <RowDefinition/>
                </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"/>
                <StackPanel Grid.Column="1" Grid.RowSpan="2" >
                    <TextBlock   Text="{Binding NodeModel.DisplayName, Mode=TwoWay}" HorizontalAlignment="Center"/>
                </StackPanel>
                <local:NextStepJunctionControl Grid.Column="2"  NodeViewModel="{Binding}"  x:Name="NextStepJunctionControl" HorizontalAlignment="Right" Grid.RowSpan="2"/>

            </Grid>
            
            <!--方法描述-->
            <themes:MethodDetailsControl x:Name="MethodDetailsControl" Grid.Row="1" MethodDetails="{Binding NodeModel.MethodDetails}" NodeViewModel="{Binding}"/>

            <Border Grid.Row="2" x:Name="ParameterProtectionMask" Background="#40508D" Opacity="0.5" BorderBrush="#0A4651" BorderThickness="0" 
                Visibility="{Binding NodeModel.DebugSetting.IsProtectionParameter, Converter={StaticResource InvertedBoolConverter},ConverterParameter=Normal}" />
            <!--<Border  Grid.Row="0"  Background="#FCB334" >
               
            </Border>-->
            <!--<themes:ExplicitDataControl Grid.Row="1" ExplicitDatas="{Binding ExplicitDatas}" />-->
            <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" Margin="2,1,2,1">
                    <CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsEnable, Mode=TwoWay}"/>
                    <TextBlock Text="是否使能" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                </StackPanel>


                <StackPanel Orientation="Horizontal" Margin="2,1,2,1">
                    <CheckBox  IsChecked="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay}"/>
                    <TextBlock Text="参数保护" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="2,1,2,1">
                    <CheckBox  IsChecked="{Binding NodeModel.DebugSetting.IsInterrupt, Mode=TwoWay}"/>
                    <TextBlock Text="中断节点" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                </StackPanel>

            </StackPanel>
            <!--<themes:ConditionControl Grid.Row="2" ></themes:ConditionControl>-->
        </Grid>
    </Border>
</local:NodeControlBase>
