<local:MyPageRight
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" x:Class="PCL.PageSetupGameLink"
    PanScroll="{Binding ElementName=PanBack}">
    <local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
        <StackPanel x:Name="PanMain" Margin="25,10">
            <local:MyCard Margin="0,15" Title="EasyTier">
                <StackPanel Margin="25,40,25,15" Orientation="Vertical">
                    <local:MyHint Text="{DynamicResource Setup.GameLink.RestartRequired}" Theme="Yellow" Margin="0,0,0,10" />
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" SharedSizeGroup="TextBlock" />
                            <ColumnDefinition Width="8" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="28" />
                            <RowDefinition Height="8" />
                            <!--<RowDefinition Height="28" />
                        <RowDefinition Height="8" />
                        <RowDefinition Height="Auto" MinHeight="28"/>
                        <RowDefinition Height="8" />
                        <RowDefinition Height="28" />
                        <RowDefinition Height="8" />
                        <RowDefinition Height="28" />
                        <RowDefinition Height="8" />-->
                            <RowDefinition Height="28" />
                            <RowDefinition Height="4" />
                            <RowDefinition Height="28" />
                            <RowDefinition Height="28" />
                            <RowDefinition Height="28" />
                            <RowDefinition Height="28" />
                            <!--<RowDefinition Height="4" />
                        <RowDefinition Height="35" />-->
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{DynamicResource Setup.GameLink.Username}"
                                   Margin="0,0,25,0" />
                        <local:MyTextBox x:Name="TextLinkUsername" Grid.Row="0" Grid.ColumnSpan="2" Tag="LinkUsername"
                                         Grid.Column="2" TextChanged="TextBoxChange"
                                         ToolTip="{DynamicResource Setup.GameLink.Username.ToolTip}" />
                        <!--<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="自定义节点" Margin="0,0,25,0" />
                    <local:MyTextBox x:Name="TextLinkRelay" Grid.Row="2" Grid.ColumnSpan="2" Tag="LinkRelayServer" Grid.Column="2" HintText="一般应以 tcp:// 或 udp:// 开头；若有多个，请使用英文分号分割">
                        <local:MyTextBox.ValidateRules>
                            <local:ValidateNullable />
                            <local:ValidateNullOrWhiteSpace />
                        </local:MyTextBox.ValidateRules>
                    </local:MyTextBox>
                    <TextBlock Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Text="预设节点"/>
                    <TextBlock x:Name="TextRelays" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="正在获取..." TextWrapping="WrapWithOverflow"/>
                    <TextBlock Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Left" Text="中继行为"/>
                    <local:MyComboBox x:Name="ComboRelayType" Tag="LinkRelayType" Grid.Row="6" Grid.Column="2">
                        <local:MyComboBoxItem Content="自动决定（推荐）" ToolTip="让 EasyTier 自行决定连接方式，适用于绝大多数用户。&#xa;EasyTier 将会尽可能建立 P2P 连接，仅在 P2P 连接未能建立时使用中继。"/>
                        <local:MyComboBoxItem Content="仅中继" ToolTip="数据将仅通过中继节点进行转发，仅推荐在完全无法连接或极端卡顿的情况下尝试。"/>
                    </local:MyComboBox>
                    <TextBlock Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Left" Text="节点行为"/>
                    <local:MyComboBox x:Name="ComboServerType" Tag="LinkServerType" Grid.Row="8" Grid.Column="2">
                        <local:MyComboBoxItem Content="仅自有节点协助中继" ToolTip="仅通过 PCL CE 自有节点通信。&#xa;自有节点由 PCL CE 官方部署，一般情况下此选项已经足够使用。"/>
                        <local:MyComboBoxItem Content="自有节点 + 社区节点 协助中继" ToolTip="除自有节点外，添加由 PCL CE 挑选的部分 EasyTier 社区提供的节点。&#xa;这些节点由社区志愿者部署，可能可以提供更快的连接速度。"/>
                        <local:MyComboBoxItem Content="不使用预设节点中继 (谨慎选择)" ToolTip="不使用任何预设节点中继数据。&#xa;联机双方将需要添加至少一个相同的自定义节点才可以连接。&#xa;这要求你具备一定技术能力且有特殊需要，在绝大多数情况下不要选择此选项！"/>
                    </local:MyComboBox>-->
                        <TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{DynamicResource Setup.GameLink.Protocol.Preference}" />
                        <local:MyComboBox x:Name="ComboPreferProtocol" Tag="LinkProtocolPreference" Grid.Row="2"
                                          SelectionChanged="LinkProtocolPerferenceChange"
                                          Grid.Column="2">
                            <local:MyComboBoxItem Content="{DynamicResource Setup.GameLink.Protocol.Tcp}" ToolTip="{DynamicResource Setup.GameLink.Protocol.Tcp.ToolTip}" />
                            <local:MyComboBoxItem Content="{DynamicResource Setup.GameLink.Protocol.Udp}" ToolTip="{DynamicResource Setup.GameLink.Protocol.Udp.ToolTip}" />
                        </local:MyComboBox>
                        <local:MyCheckBox x:Name="CheckLatencyFirstMode" Tag="LinkLatencyFirstMode" Grid.Row="4"
                                          Grid.ColumnSpan="3" Text="{DynamicResource Setup.GameLink.LatencyFirstMode}" Change="CheckBoxChange"
                                          ToolTip="{DynamicResource Setup.GameLink.LatencyFirstMode.ToolTip}" />
                        <local:MyCheckBox x:Name="CheckTryPunchSym" Tag="LinkTryPunchSym" Grid.Row="5"
                                          Grid.ColumnSpan="3" Text="{DynamicResource Setup.GameLink.PortGuessNat}" Change="CheckBoxChange"
                                          ToolTip="{DynamicResource Setup.GameLink.PortGuessNat.ToolTip}" />
                        <local:MyCheckBox x:Name="CheckEnableIPv6" Tag="LinkEnableIPv6" Grid.Row="6"
                                          Grid.ColumnSpan="3" Text="{DynamicResource Setup.GameLink.EnableIPv6}" Change="CheckBoxChange"
                                          ToolTip="{DynamicResource Setup.GameLink.EnableIPv6.ToolTip}" />
                        <local:MyCheckBox x:Name="CheckEnableCliOutput" Tag="LinkEnableCliOutput" Grid.Row="7"
                                          Grid.ColumnSpan="3" Text="{DynamicResource Setup.GameLink.CliDebugOutput}" Change="CheckBoxChange"
                                          ToolTip="{DynamicResource Setup.GameLink.CliDebugOutput.ToolTip}" />
                        <!--<local:MyButton Grid.Row="17" HorizontalAlignment="Left" Grid.ColumnSpan="3" Width="120" Text="社区节点列表" EventType="打开网页" EventData="https://uptime.easytier.cn/" ColorType="Highlight" ToolTip="查看 EasyTier 社区提供的节点。&#xa;你也可以在此页面提交自己的节点，以帮助整个社区优化连接。"/>-->
                    </Grid>
                </StackPanel>
            </local:MyCard>
            <local:MyCard Margin="10" Title="{DynamicResource Setup.GameLink.NetworkTest.Title}" Visibility="Collapsed">
                <StackPanel Margin="25,40,25,15" Orientation="Vertical">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="8" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="8" />
                            <RowDefinition Height="30" />
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="TextUdpNatType"
                                   Text="{DynamicResource Setup.GameLink.NetworkTest.UdpNatType.NotTested}"
                                   Grid.Row="0" />
                        <TextBlock x:Name="TextTcpNatType"
                                   Text="{DynamicResource Setup.GameLink.NetworkTest.TcpNatType.NotTested}"
                                   Grid.Row="1" />
                        <TextBlock x:Name="TextIpv6Status"
                                   Text="{DynamicResource Setup.GameLink.NetworkTest.Ipv6Status.NotTested}"
                                   Grid.Row="2" />
                        <local:MyButton x:Name="BtnNetTest" Text="{DynamicResource Setup.GameLink.NetworkTest.Start}" Grid.Row="4" ColorType="Highlight"
                                        Click="BtnNetTest_Click"
                                        VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                    </Grid>
                </StackPanel>
            </local:MyCard>
        </StackPanel>
    </local:MyScrollViewer>
</local:MyPageRight>