Отрефактори и оптимизируй этот код (и напиши полностью отрефактореный и оптимизированный вариант код, ВАЖНО, ЧТОБЫ ТЫ ПОЛНОСТЬЮ НАПИСАЛ ОБНОВЛЁННЫЙ КОД):
<Window x:Class="EmailSoftWare.AuthWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:EmailSoftWare"
        mc:Ignorable="d"
        Height="459" Width="744"
        WindowStyle="None" ResizeMode="NoResize"
        Background="Transparent" AllowsTransparency="True"
        Title="AuthWindow"
        Loaded="AuthWindow_Loaded">

    <!--Костыль, чтобы рамка не заходила за края дисплея-->
    <Grid x:Name="Compensator" Margin="10">
        <Grid.BitmapEffect>
            <DropShadowBitmapEffect ShadowDepth="1.5" Softness="500" Opacity="0.5"/>
        </Grid.BitmapEffect>
        <Border BorderThickness="1"
                CornerRadius="5"
                Background="{DynamicResource Gradient.Window.Background}"
                BorderBrush="{DynamicResource Gradient.Window.BorderBrush.Colored}"
                ClipToBounds="True">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Border Background="{DynamicResource Logo.FullImage}"
                        BorderBrush="{DynamicResource Gradient.Panel.BorderBrush.Colorless}"
                        CornerRadius="4.5,0,0,4.5"
                        BorderThickness="0,0,1,0"
                        MouseLeftButtonDown="TitleBar_OnMouseLeftButtonDown">
                    <Grid Margin="10">
                        <TextBlock Style="{DynamicResource TextBlock.Big}"
                                   Text="{DynamicResource Application.TextBlock.Name}"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Bottom"
                                   Margin="0,0,0,90"/>
                        <TextBlock Style="{DynamicResource TextBlock.Small}"
                                   Text="{DynamicResource Application.TextBlock.Version}"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Bottom">
                            <TextBlock.Foreground>
                                <SolidColorBrush Color="{DynamicResource Text.Basic}"/>
                            </TextBlock.Foreground>
                        </TextBlock>
                        <TextBlock Style="{DynamicResource TextBlock.Small}"
                                   Text="{DynamicResource Application.TextBlock.Developer}"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Top">
                            <TextBlock.Foreground>
                                <SolidColorBrush Color="{DynamicResource Text.Basic}"/>
                            </TextBlock.Foreground>
                        </TextBlock>
                    </Grid>
                </Border>
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Border Background="{DynamicResource Gradient.Panel.Background}"
                            CornerRadius="0,4.5,0,0"
                            BorderThickness="0"
                            MouseLeftButtonDown="TitleBar_OnMouseLeftButtonDown">
                        <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Margin="0,0,1.5,0">
                            <ComboBox Margin="0,0,178,0" Height="26"
                                      x:Name="ComboBox_Languages"
                                      SelectionChanged="ComboBox_Language_OnSelectionChanged">
                                <ComboBoxItem Content="English"/>
                                <ComboBoxItem Content="Русский"/>
                            </ComboBox>
                            <Button Style="{DynamicResource IconButton.Window.Minimize}" Cursor="Hand"
                                        Click="Button_MinimizeWindow_OnClick"/>
                            <Button Style="{DynamicResource IconButton.Window.Close}"
                                        Click="Button_CloseApplication_OnClick"/>
                        </StackPanel>
                    </Border>

                    <Grid Grid.Row="1" Margin="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="2*"/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>


                        <TextBlock Style="{DynamicResource TextBlock.Big}"
                                       Text="{DynamicResource AuthWindow.TextBlock.Title.Authorization}"
                                       HorizontalAlignment="Center"
                                   Margin="0,30,0,0"/>
                        <Grid Grid.Row="1">
                            <TextBox x:Name="TextBox_Authorization_UserName"
                                         ToolTip="{DynamicResource AuthWindow.ToolTip.TextBox.Username}"
                                         GotFocus="TextBox_Watermark_OnGotFocus"
                                         LostFocus="TextBox_Watermark_OnLostFocus"
                                         Loaded="TextBox_Watermark_Loaded"/>
                            <TextBlock x:Name="Watermark_Authorization_UserName"
                                           Text="{DynamicResource AuthWindow.TextBlock.Watermark.UserName}"
                                           Style="{StaticResource Watermark}"
                                           HorizontalAlignment="Center"/>
                        </Grid>
                        <Grid Grid.Row="2">
                            <TextBox x:Name="TextBox_Authorization_Hwid"
                                         ToolTip="{DynamicResource AuthWindow.ToolTip.TextBox.Hwid}"
                                         IsReadOnly="True"
                                         MouseDoubleClick="TextBox_Authorization_HWID_OnMouseDoubleClick"
                                         Loaded="TextBox_Watermark_Loaded"/>
                            <TextBlock x:Name="Watermark_Authorization_Hwid"
                                           Text="{DynamicResource AuthWindow.TextBlock.Watermark.HWID}"
                                           Style="{StaticResource Watermark}"
                                           HorizontalAlignment="Center"/>
                        </Grid>
                        <Grid Grid.Row="3">
                            <TextBox x:Name="TextBox_Authorization_PersonalKey"
                                         ToolTip="{DynamicResource AuthWindow.ToolTip.TextBox.PersonalKey}"
                                         GotFocus="TextBox_Watermark_OnGotFocus"
                                         LostFocus="TextBox_Watermark_OnLostFocus"
                                         Loaded="TextBox_Watermark_Loaded"/>
                            <TextBlock x:Name="Watermark_Authorization_PersonalKey"
                                           Text="{DynamicResource AuthWindow.TextBlock.Watermark.PersonalKey}"
                                           Style="{StaticResource Watermark}"
                                           HorizontalAlignment="Center"/>
                        </Grid>
                        <Button Grid.Row="4"
                                    Style="{DynamicResource IconTextButton.Auth.LogIn}"
                                    Click="Button_LogIn_OnClick"/>
                    </Grid>

                </Grid>
            </Grid>
        </Border>
    </Grid>
</Window>