<controls:MetroWindow x:Class="Memenim.Framework.MainWindow"
                      d:DataContext="{d:DesignInstance local:MainWindow}"
                      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:Memenim.Framework"
                      xmlns:flyouts="clr-namespace:Memenim.Framework.Flyouts"
                      xmlns:markupLocalization="clr-namespace:RIS.Localization.UI.WPF.Markup;assembly=RIS.Localization.UI.WPF"
                      xmlns:indicatorsLoading="clr-namespace:RIS.Graphics.Controls;assembly=RIS.Graphics"
                      xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
                      xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
                      mc:Ignorable="d"
                      MinWidth="900" MinHeight="550"
                      Width="900" Height="550"
                      WindowTitleBrush="{DynamicResource Window.Main.TitleBackground}"
                      NonActiveWindowTitleBrush="{DynamicResource Window.Main.NonActiveTitleBackground}"
                      GlowBrush="{DynamicResource MahApps.Brushes.Accent}"
                      Title="MEMENIM Desktop"
                      TitleForeground="Transparent"
                      ShowTitleBar="True"
                      ShowIconOnTitleBar="False"
                      dialogs:DialogParticipation.Register="{Binding}"
                      Closed="MainWindow_Closed">

    <controls:MetroWindow.LeftWindowCommands>
        <controls:WindowCommands>
            <controls:WindowCommandsItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Foreground="{DynamicResource MahApps.Brushes.IdealForeground}"
                               Text="MEMENIM DESKTOP"
                               FontSize="16"
                               FontWeight="Thin"
                               TextAlignment="Center"
                               HorizontalAlignment="Left" VerticalAlignment="Center"
                               Margin="5 0 10 0"/>
                </StackPanel>
            </controls:WindowCommandsItem>
            <controls:WindowCommandsItem IsSeparatorVisible="False">
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="OpenLinkButton"
                            HorizontalAlignment="Center" VerticalAlignment="Center"
                            Click="OpenLinkButton_Click">
                        <iconPacks:PackIconModern Width="15" Height="15"
                                                  Kind="Link"
                                                  Foreground="{DynamicResource MahApps.Brushes.IdealForeground}"
                                                  HorizontalAlignment="Center" VerticalAlignment="Center"
                                                  Margin="3 0 3 0"/>
                    </Button>
                </StackPanel>
            </controls:WindowCommandsItem>
        </controls:WindowCommands>
    </controls:MetroWindow.LeftWindowCommands>

    <controls:MetroWindow.Flyouts>
        <controls:FlyoutsControl>
            <!--<flyouts:SettingsFlyout x:Name="SettingsFlyout"
                                    MinWidth="300" MaxWidth="300"
                                    Position="Right"
                                    Theme="Adapt"/>-->
        </controls:FlyoutsControl>
    </controls:MetroWindow.Flyouts>

    <Grid x:Name="RootLayout">
        <Grid Grid.Row="0" Grid.Column="0"
              x:Name="LoadingGrid"
              Background="{DynamicResource MahApps.Brushes.Window.Background}"
              ZIndex="2147483646"
              Visibility="Collapsed">
            <Rectangle Fill="{DynamicResource Window.Main.Background}"
                       HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <Image x:Name="LoadingBackgroundImage"
                   Stretch="Uniform"
                   HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <Image x:Name="LoadingForegroundImage"
                   Width="256" Height="256"
                   Stretch="Uniform"
                   HorizontalAlignment="Center" VerticalAlignment="Center"/>
            <indicatorsLoading:LoadingIndicator x:Name="LoadingIndicator"
                                                Mode="Arcs"
                                                SpeedRatio="2"
                                                IsActive="False"
                                                Visibility="Visible"
                                                Margin="30"/>
        </Grid>
        <Grid Grid.Row="0" Grid.Column="0"
              x:Name="ConnectionFailedGrid"
              Background="{DynamicResource MahApps.Brushes.Window.Background}"
              ZIndex="2147483647"
              Visibility="Collapsed">
            <Rectangle Fill="{DynamicResource Window.Main.Background}"
                       HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <Image x:Name="ConnectionFailedBackgroundImage"
                   Stretch="Uniform"
                   HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <Image x:Name="ConnectionFailedForegroundImage"
                   Width="256" Height="256"
                   Stretch="Uniform"
                   HorizontalAlignment="Center" VerticalAlignment="Center"/>
            <StackPanel Orientation="Vertical"
                        VerticalAlignment="Top">
                <controls:MetroProgressBar MinHeight="4"
                                           Height="4"
                                           Style="{DynamicResource MahApps.Styles.ProgressBar}"
                                           IsIndeterminate="True"
                                           BorderThickness="0"/>
                <TextBlock MinHeight="20"
                           Foreground="{DynamicResource MahApps.Brushes.IdealForeground}"
                           Text="{markupLocalization:LocalizedString AttemptingRestoreConnection}"
                           FontSize="15"
                           TextWrapping="Wrap"
                           TextAlignment="Center"
                           Margin="10 5 10 5"/>
            </StackPanel>
            <indicatorsLoading:LoadingIndicator x:Name="ConnectionFailedIndicator"
                                                Mode="Arcs"
                                                SpeedRatio="2"
                                                IsActive="False"
                                                Visibility="Visible"
                                                Margin="30"/>
        </Grid>
    </Grid>
</controls:MetroWindow>
