<local:MyPageRight x:Class="PCL.PageToolsTest"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:local="clr-namespace:PCL"
                   xmlns:val="https://ce.pclc.cc/core/utils/validate"
                   xmlns:sys="clr-namespace:System;assembly=mscorlib"
                   PanScroll="{Binding ElementName=PanBack}">
    <local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
        <StackPanel x:Name="PanMain" Margin="25,10" Grid.IsSharedSizeScope="True">
            <local:MyCard Margin="0,15" Title="{DynamicResource Tools.Test.Title}">
                <WrapPanel Margin="25,40,21,5" ItemHeight="50">
                    <local:MyButton x:Name="BtnClear" MinWidth="120" Text="{DynamicResource Tools.Test.Clean.Title}"
                                    ToolTip="{DynamicResource Tools.Test.Clean.ToolTip}" Margin="0,0,15,15"
                                    Click="BtnClear_Click" />
                    <local:MyButton MinWidth="100" Text="{DynamicResource Tools.Test.Luck.Title}" Margin="0,0,15,15"
                                    Click="BtnLuck_Click" />
                    <local:MyButton MinWidth="100" Text="{DynamicResource Tools.Test.Crash.Title}"
                                    ToolTip="{DynamicResource Tools.Test.Crash.ManualCrash}" ColorType="Red"
                                    Margin="0,0,15,15" Click="BtnCrash_Click"
                                    Visibility="Collapsed" x:Name="BtnCrash" />
                    <local:MyButton MinWidth="120" Text="{DynamicResource Tools.Test.Shortcut.Title}"
                                    ToolTip="{DynamicResource Tools.Test.Shortcut.ToolTip}" Margin="0,0,15,15"
                                    Click="BtnCreateShortcut_Click" />
                    <local:MyButton MinWidth="120" Text="{DynamicResource Tools.Test.LaunchCount.Title}"
                                    Margin="0,0,15,15" Click="BtnLaunchCount_Click" />
                </WrapPanel>
            </local:MyCard>
            <local:MyCard Margin="0,0,0,15" Title="{DynamicResource Tools.Test.CustomDownload.Title}">
                <StackPanel Orientation="Vertical" Margin="25,40,25,20">
                    <TextBlock Text="{DynamicResource Tools.Test.CustomDownload.Description}"
                               TextWrapping="Wrap" />
                    <Grid Margin="0,10,0,0">
                        <Grid.Resources>
                            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BasedOnTextBlock}">
                                <Setter Property="VerticalAlignment" Value="Center" />
                                <Setter Property="Margin" Value="0,0,25,0" />
                            </Style>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource Tools.Test.CustomDownload.Url}" />
                        <local:MyTextBox x:Name="TextDownloadUrl" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2"
                                         TextChanged="TextDownloadUrl_TextChanged"
                                         ValidatedTextChanged="TextDownloadUrl_ValidateChanged">
                            <local:MyTextBox.ValidateRules>
                                <val:HttpAndUncValidator />
                            </local:MyTextBox.ValidateRules>
                        </local:MyTextBox>

                        <TextBlock Grid.Column="0" Grid.Row="2"
                                   Text="{DynamicResource Tools.Test.CustomDownload.SaveTo}" />
                        <local:MyTextBox x:Name="TextDownloadFolder" Grid.Column="1" Grid.Row="2" Margin="0,10"
                                         ValidatedTextChanged="TextDownloadFolder_OnValidatedTextChanged">
                            <local:MyTextBox.ValidateRules>
                                <val:FolderPathValidator />
                            </local:MyTextBox.ValidateRules>
                        </local:MyTextBox>
                        <local:MyTextButton Grid.Column="2" Grid.Row="2" Margin="10,0,5,0" VerticalAlignment="Center"
                                            Text="{DynamicResource Tools.Test.CustomDownload.Select}"
                                            Click="MyTextButton_Click" />

                        <TextBlock Grid.Column="0" Grid.Row="3"
                                   Text="{DynamicResource Tools.Test.CustomDownload.FileName}" />
                        <local:MyTextBox x:Name="TextDownloadName" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2">
                            <local:MyTextBox.ValidateRules>
                                <val:FileNameValidator />
                            </local:MyTextBox.ValidateRules>
                        </local:MyTextBox>
                    </Grid>
                    <Grid Margin="0,15,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <local:MyButton x:Name="BtnDownloadStart" Grid.Column="0" Width="140"
                                        Text="{DynamicResource Tools.Test.CustomDownload.Start}"
                                        ColorType="Highlight" Margin="0,0,15,0" HorizontalAlignment="Right"
                                        Click="BtnDownloadStart_Click" />
                        <local:MyButton x:Name="BtnDownloadOpen" Grid.Column="1" Width="140"
                                        Text="{DynamicResource Common.Action.OpenFolder}"
                                        Margin="0,0,15,0" HorizontalAlignment="Left" Click="BtnDownloadOpen_Click" />
                    </Grid>
                </StackPanel>
            </local:MyCard>
            <local:MyCard x:Name="CardSkin" Margin="0,0,0,15" Title="{DynamicResource Tools.Test.Skin.Title}">
                <StackPanel Margin="25,40,25,15">
                    <Grid x:Name="PanSkinID" Margin="0,14,0,2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" SharedSizeGroup="Name" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Text="{DynamicResource Tools.Test.Skin.PlayerName}" Margin="0,0,25,0" />
                        <local:MyTextBox x:Name="TextSkinID" Grid.Column="1" MaxLength="50" />
                        <Grid Height="35" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,14,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
                            </Grid.ColumnDefinitions>
                            <local:MyButton x:Name="BtnSkinSave" Text="{DynamicResource Tools.Test.Skin.Save}"
                                            MinWidth="140" Padding="13,0"
                                            Margin="0,0,20,0" Grid.Row="1" Click="BtnSkinSave_Click" />
                        </Grid>
                    </Grid>
                </StackPanel>
            </local:MyCard>
            <local:MyCard Margin="0,0,0,15" Title="{DynamicResource Tools.Test.ServerQuery.Title}">
                <local:MinecraftServerQuery Margin="15,40,15,15" />
            </local:MyCard>
            <local:MyCard Margin="0,0,0,15" Title="{DynamicResource Tools.Test.Achievement.Title}" CanSwap="True"
                          IsSwapped="True">
                <StackPanel Margin="25,30,25,15">
                    <Grid Margin="0,4,0,2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Text="{DynamicResource Tools.Test.Achievement.ItemId}" Margin="0,0,25,0" />
                        <local:MyTextBox Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2"
                                         x:Name="AchievementBlockTextBox" MaxLength="50" Margin="0,10">
                            <local:MyTextBox.ValidateRules>
                                <val:RegexValidator Pattern="^[a-z0-9_]+$"
                                                    ErrorKey="Tools.Test.Achievement.InvalidId" />
                            </local:MyTextBox.ValidateRules>
                        </local:MyTextBox>

                        <TextBlock Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Text="{DynamicResource Tools.Test.Achievement.Name}" Margin="0,0,25,0" />
                        <local:MyTextBox Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"
                                         x:Name="AchievementTitleTextBox" MaxLength="50">
                            <local:MyTextBox.ValidateRules>
                                <val:NullOrEmptyValidator />
                            </local:MyTextBox.ValidateRules>
                        </local:MyTextBox>

                        <TextBlock Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Text="{DynamicResource Tools.Test.Achievement.Line1}" Margin="0,0,25,0" />
                        <local:MyTextBox Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2"
                                         x:Name="AchievementString1TextBox" MaxLength="50" Margin="0,10">
                            <local:MyTextBox.ValidateRules>
                                <val:NullOrEmptyValidator />
                            </local:MyTextBox.ValidateRules>
                        </local:MyTextBox>

                        <TextBlock Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Text="{DynamicResource Tools.Test.Achievement.Line2}" Margin="0,0,25,0" />
                        <local:MyTextBox Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2"
                                         x:Name="AchievementString2TextBox" MaxLength="50" />
                    </Grid>
                    <Grid Margin="0,15,0,10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <local:MyButton x:Name="BtnAchievementPreview" Grid.Column="0" Width="140"
                                        Text="{DynamicResource Tools.Test.Achievement.Preview}"
                                        ColorType="Highlight" Margin="0,0,15,0" HorizontalAlignment="Right"
                                        Click="BtnAchievementPreview_Click" />
                        <local:MyButton x:Name="BtnAchievementSave" Grid.Column="1" Width="140"
                                        Text="{DynamicResource Tools.Test.Achievement.Save}"
                                        Margin="0,0,15,0" HorizontalAlignment="Left" Click="BtnAchievementSave_Click" />
                    </Grid>
                    <Image x:Name="AchievementImage" Width="320" Height="64" Stretch="Uniform" Visibility="Collapsed" />
                </StackPanel>
            </local:MyCard>
            <local:MyCard Margin="0,0,0,15" Title="{DynamicResource Tools.Test.Avatar.Title}" CanSwap="True"
                          IsSwapped="True">
                <StackPanel Orientation="Vertical" Margin="25,40,25,20">
                    <Grid Margin="0,0,0,10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{DynamicResource Tools.Test.Avatar.Size}" VerticalAlignment="Center"
                                   Margin="0,0,10,0" />
                        <local:MyComboBox x:Name="CmbHeadSize" Grid.Column="1" Height="26" SelectedIndex="0">
                            <sys:String>64x64</sys:String>
                            <sys:String>96x96</sys:String>
                            <sys:String>128x128</sys:String>
                        </local:MyComboBox>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <local:MyButton x:Name="BtnSelectSkin" Grid.Column="1"
                                        Text="{DynamicResource Tools.Test.Avatar.SelectSkin}" Width="140" Height="35"
                                        Margin="0,0,10,0" />
                        <local:MyButton Grid.Column="2" Text="{DynamicResource Tools.Test.Avatar.Save}" Width="140"
                                        Height="35" Click="BtnSaveHead_Click" />
                    </Grid>
                    <Border x:Name="SkinPreviewBorder" Margin="0,15,0,0" HorizontalAlignment="Center" Padding="10"
                            Visibility="Collapsed">
                        <Grid x:Name="SkinPreviewContainer" Width="80" Height="80">
                            <Image x:Name="ImgFace" Stretch="Uniform" RenderOptions.BitmapScalingMode="NearestNeighbor" />
                            <Image x:Name="ImgHair" Stretch="Uniform" RenderOptions.BitmapScalingMode="NearestNeighbor" />
                        </Grid>
                    </Border>
                </StackPanel>
            </local:MyCard>
        </StackPanel>
    </local:MyScrollViewer>
</local:MyPageRight>