<Page x:Class="ThickTcpUiInWindow.UIModule.FixGraph"
             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:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
             xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
            xmlns:local="clr-namespace:ThickTcpUiInWindow.UIModule"      
      mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="782" 
            Loaded="Page_Loaded" Unloaded="Page_Unloaded"
      >
    <Page.Resources>
        <ResourceDictionary>


                <ControlTemplate x:Key="picture_button" TargetType="Button">
                    <Border Name="border" BorderThickness="1" CornerRadius="5">
                        <ContentPresenter Content="{TemplateBinding Content}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="border" Property="Background" Value="LightGray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            <local:AnaylzeButtonVisibilityConverter x:Key="anaylzebuttonconv"/>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                    <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/MaterialDesignIcons.xaml"/>
                    <ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Converter/Dictionary_MyConv.xaml"/>
                <!--<ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Culture/StringResource.zh-CN.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    
    <Grid Name="grid" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="258*" />
        </Grid.RowDefinitions>

        <Rectangle Name="rectangle" Fill="{StaticResource Color_theme_activity}" Margin="0,0,0,4" >
            <Rectangle.Style>
                <Style TargetType="Rectangle" >
                    <Setter Property="Effect">
                        <Setter.Value>
                            <DropShadowEffect Color="Black" Direction="270" ShadowDepth="1" Opacity="0.23" />
                        </Setter.Value>
                    </Setter>
                </Style>
            </Rectangle.Style>
        </Rectangle>
        <StackPanel Orientation="Horizontal" Name="stackpanel_state">

            <StackPanel Orientation="Horizontal" >
                <StackPanel.Resources>
                    <Style TargetType="{x:Type Path}" x:Key="PathStyle_icon">
                        <Setter Property="Fill" Value="White"/>
                        <Setter Property="Stretch" Value="Uniform"/>
                        <Setter Property="Width" Value="30"/>
                        <Setter Property="Height" Value="30"/>
                        <Setter Property="SnapsToDevicePixels" Value="True"/>
                    </Style>
                </StackPanel.Resources>
                <Button Click="button_info_Click" Template="{StaticResource ResourceKey=picture_button}" Background="Transparent">
                    <Grid >
                        <Path Data="M0,0 L100,0 90,50 0,50 Z M110,0 L120,0 110,50 100,50 Z" Fill="White"  HorizontalAlignment="Left" Stretch="Fill" Width="81" Opacity="0.3"/>
                        <Path Style="{StaticResource PathStyle_icon}" Data="{StaticResource Geometry_information-outline}" HorizontalAlignment="Left" Margin="15,0" />
                    </Grid>
                </Button>
                <Button  Click="button_pause_Click"  Template="{StaticResource ResourceKey=picture_button}" Margin="10,0">
                    <Grid >
                        <Path Data="{StaticResource Geometry_stop}"  Style="{StaticResource PathStyle_icon}" Visibility="{Binding IsPaused,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=HiddenWhenTrue}" Width="20" Height="20"/>
                        <Path Data="{StaticResource Geometry_play}"  Style="{StaticResource PathStyle_icon}" Visibility="{Binding IsPaused,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Hidden}"/>
                    </Grid>
                </Button>
                <Button Click="button_save_Click"  Template="{StaticResource ResourceKey=picture_button}" Visibility="{Binding IsPaused,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Hidden}" Margin="10,0">
                    <Grid >
                        <Path Data="{StaticResource Geometry_floppy}" Style="{StaticResource PathStyle_icon}"  />
                    </Grid>
                </Button>
                <Button Name="button_analyze" Click="button_analyze_Click"  Template="{StaticResource ResourceKey=picture_button}" Margin="10,0">
                    <Button.Visibility>
                        <MultiBinding Converter="{StaticResource anaylzebuttonconv}" Mode="OneWay" >
                            <Binding Path="HasAnalyze" />
                            <Binding Path="DataContext.IsPaused" ElementName="stackpanel_state"/>
                        </MultiBinding>
                    </Button.Visibility>
                    <Grid >
                        <Path Data="{StaticResource Geometry_chart-line}" Style="{StaticResource PathStyle_icon}"  />
                    </Grid>
                </Button>
            </StackPanel>

            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" Margin="5">
                <TextBlock.Inlines>
                    <Run Name="run_title" Text="{DynamicResource strFixGraph}" FontWeight="SemiBold" FontSize="24" />
                    <Run Name="run_title2" Text="{Binding State}"  FontSize="18" />
                </TextBlock.Inlines>
            </TextBlock>
        </StackPanel>
        <WindowsFormsHost Grid.Row="1">
            <Chr:Chart x:Name="chart1" />
        </WindowsFormsHost>


    </Grid>
</Page>
