<Controls:MetroWindow x:Class="Vulnerator.View.UI.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      xmlns:Converters="clr-namespace:Vulnerator.View.Converter"
                      xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
                      xmlns:IconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
                      xmlns:Notifications="clr-namespace:Enterwell.Clients.Wpf.Notifications.Controls;assembly=Enterwell.Clients.Wpf.Notifications"
                      xmlns:Validation="clr-namespace:Vulnerator.View.Validation"
                      xmlns:ViewHelpers="clr-namespace:Vulnerator.View.ViewHelper"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
                      xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
                      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                      xmlns:local="clr-namespace:Vulnerator.View.UI"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
                      xmlns:v="clr-namespace:Vulnerator.View"
                      xmlns:vm="clr-namespace:Vulnerator.ViewModel"
                      Title="Vulnerator"
                      MinWidth="750"
                      MinHeight="300"
                      HorizontalContentAlignment="Stretch"
                      VerticalContentAlignment="Stretch"
                      d:DesignHeight="800"
                      d:DesignWidth="800"
                      BorderBrush="{DynamicResource AccentColorBrush}"
                      BorderThickness="1"
                      DataContext="{Binding Main, Source={StaticResource Locator}}"
                      Icon="/Vulnerator;component/Resources/vulnerator.ico"
                      KeyboardNavigation.TabNavigation="Continue"
                      ResizeMode="CanResize"
                      Style="{DynamicResource CustomCleanWindowStyleKey}"
                      TitlebarHeight="48"
                      mc:Ignorable="d">

    <!--  Window Icon Template  -->
    <Controls:MetroWindow.IconTemplate>
        <DataTemplate>
            <Border Width="48"
                    Background="{DynamicResource GrayBrush10}">
                <IconPacks:PackIconFontAwesomeBrands Width="24"
                                                     Height="24"
                                                     Margin="4"
                                                     HorizontalAlignment="Center"
                                                     VerticalAlignment="Center"
                                                     Flip="Horizontal"
                                                     Foreground="{DynamicResource BlackBrush}"
                                                     Kind="Vulnerator" />
            </Border>
        </DataTemplate>
    </Controls:MetroWindow.IconTemplate>

    <!--  Window Titlebar Controls  -->
    <Controls:MetroWindow.TitleTemplate>
        <DataTemplate>
            <StackPanel HorizontalAlignment="Left"
                        Orientation="Horizontal">
                <TextBlock Margin="6,0,5,0"
                           VerticalAlignment="Center"
                           FontFamily="{DynamicResource HeaderFontFamily}"
                           FontSize="{DynamicResource WindowTitleFontSize}"
                           Text="{TemplateBinding Content}"
                           TextTrimming="CharacterEllipsis" />
                <Controls:WindowCommands DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType=Controls:MetroWindow}}"
                                         Foreground="{DynamicResource BlackBrush}"
                                         ShowLastSeparator="False">
                    <Button x:Name="projectButton"
                            Command="{Binding AboutLinksCommand}"
                            CommandParameter="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
                            Content="{IconPacks:FontAwesomeSolid Home}"
                            Foreground="{DynamicResource BlackBrush}"
                            ToolTip="GitHub Project Page" />
                    <Button x:Name="githubButton"
                            Command="{Binding AboutLinksCommand}"
                            CommandParameter="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
                            Content="{IconPacks:FontAwesomeBrand GithubAlt}"
                            Foreground="{DynamicResource BlackBrush}"
                            ToolTip="GitHub Repository" />
                    <Button x:Name="wikiButton"
                            Command="{Binding AboutLinksCommand}"
                            CommandParameter="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
                            Content="{IconPacks:FontAwesomeSolid GraduationCap}"
                            Foreground="{DynamicResource BlackBrush}"
                            ToolTip="Wiki" />
                    <Button x:Name="issueButton"
                            Command="{Binding AboutLinksCommand}"
                            CommandParameter="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
                            Content="{IconPacks:FontAwesomeSolid Bug}"
                            Foreground="{DynamicResource BlackBrush}"
                            ToolTip="Issues" />
                    <Button x:Name="gitterButton"
                            Command="{Binding AboutLinksCommand}"
                            CommandParameter="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
                            Content="{IconPacks:FontAwesomeBrand Gitter}"
                            Foreground="{DynamicResource BlackBrush}"
                            ToolTip="Gitter Chat" />
                    <Button x:Name="slackButton"
                            Command="{Binding AboutLinksCommand}"
                            CommandParameter="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
                            Content="{IconPacks:FontAwesomeBrand Slack}"
                            Foreground="{DynamicResource BlackBrush}"
                            ToolTip="Slack Workspace (Chat)" />
                </Controls:WindowCommands>
            </StackPanel>
        </DataTemplate>
    </Controls:MetroWindow.TitleTemplate>

    <!--  Window Command Button Styling  -->
    <Controls:MetroWindow.WindowButtonCommands>
        <Controls:WindowButtonCommands Template="{DynamicResource Vulnerator.Templates.WindowButtonCommands.Win10}" />
    </Controls:MetroWindow.WindowButtonCommands>

    <!--  Window-Level Resource Dictionary  -->
    <Controls:MetroWindow.Resources>
        <ViewHelpers:MyXmlDataProvider x:Key="XmlConfig"
                                       IsAsynchronous="False"
                                       IsInitialLoadEnabled="True" />
        <Converters:SelectedItemToContentConverter x:Key="SelectedItemToContentConverter" />
        <local:VulnerabilityManagementView x:Key="vulnerabilityManagementView" />
        <local:AboutView x:Key="aboutView" />
        <local:ConfigurationManagementView x:Key="configurationManagementView" />
        <local:NewsView x:Key="newsView" />
        <local:ReportingView x:Key="ReportingView" />
        <local:RmfView x:Key="rmfView" />
        <local:SettingsView x:Key="settingsView" />
        <local:ThemeView x:Key="themeView" />
        <local:UserGuideView x:Key="userGuideView" />
    </Controls:MetroWindow.Resources>

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <!-- <i:InvokeCommandAction Command="{Binding LaunchStigNotificationCommand}" /> -->
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <!--  Begin Main Window Layout  -->
    <Controls:MetroContentControl Grid.Row="0"
                                  Margin="0"
                                  HorizontalContentAlignment="Stretch"
                                  VerticalContentAlignment="Stretch"
                                  Background="{DynamicResource WindowBackgroundBrush}"
                                  KeyboardNavigation.TabNavigation="Continue">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="1*" />
                <RowDefinition Height="38" />
            </Grid.RowDefinitions>
            <Controls:HamburgerMenu x:Name="hamburgerMenu"
                                    Background="{DynamicResource WindowBackgroundBrush}"
                                    DisplayMode="CompactInline"
                                    Foreground="{DynamicResource LabelTextBrush}"
                                    ItemTemplate="{StaticResource HamburgerMenuItem}"
                                    OptionsItemTemplate="{StaticResource HamburgerMenuItem}"
                                    SelectedIndex="0"
                                    Style="{StaticResource HamburgerMenuCreatorsStyle}"
                                    VerticalScrollBarOnLeftSide="True">
                <Controls:HamburgerMenu.HamburgerMenuHeaderTemplate>
                    <DataTemplate>
                        <TextBlock Grid.Column="1"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Center"
                                   FontSize="16"
                                   Foreground="{DynamicResource LabelTextBrush}"
                                   Text="Navigation" />
                    </DataTemplate>
                </Controls:HamburgerMenu.HamburgerMenuHeaderTemplate>
                <Controls:HamburgerMenu.ItemsSource>
                    <Controls:HamburgerMenuItemCollection>
                        <Controls:HamburgerMenuIconItem Label="Vulnerability Management"
                                                        Tag="{StaticResource vulnerabilityManagementView}"
                                                        ToolTip="Vulnerability Management">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="ChartLine" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                        <Controls:HamburgerMenuIconItem Label="Configuration Management"
                                                        Tag="{StaticResource configurationManagementView}"
                                                        ToolTip="Configuration Management">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="DesktopAlt" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                        <Controls:HamburgerMenuIconItem Label="Reporting"
                                                        Tag="{StaticResource ReportingView}"
                                                        ToolTip="Reporting">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="FileDownload" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                        <!--<Controls:HamburgerMenuIconItem Label="RMF"
                                                        Tag="{StaticResource rmfView}"
                                                        ToolTip="RMF">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                            VerticalAlignment="Center"
                                                            Kind="FileCertificate" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>-->
                        <Controls:HamburgerMenuIconItem Label="News"
                                                        Tag="{StaticResource newsView}"
                                                        ToolTip="News">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="Newspaper" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                    </Controls:HamburgerMenuItemCollection>
                </Controls:HamburgerMenu.ItemsSource>
                <Controls:HamburgerMenu.OptionsItemsSource>
                    <Controls:HamburgerMenuItemCollection>
                        <!--<Controls:HamburgerMenuIconItem Label="User Guide"
                                                        Tag="{StaticResource userGuideView}"
                                                        ToolTip="User Guide">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                            VerticalAlignment="Center"
                                                            Kind="Books" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>-->
                        <Controls:HamburgerMenuIconItem Label="Settings"
                                                        Tag="{StaticResource settingsView}"
                                                        ToolTip="Settings">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="Cog" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                        <Controls:HamburgerMenuIconItem Label="Theme"
                                                        Tag="{StaticResource themeView}"
                                                        ToolTip="Theme">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="Palette" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                        <Controls:HamburgerMenuIconItem Label="About"
                                                        Tag="{StaticResource aboutView}"
                                                        ToolTip="About">
                            <Controls:HamburgerMenuIconItem.Icon>
                                <IconPacks:PackIconFontAwesomeLight HorizontalAlignment="Center"
                                                                    VerticalAlignment="Center"
                                                                    Kind="QuestionCircle" />
                            </Controls:HamburgerMenuIconItem.Icon>
                        </Controls:HamburgerMenuIconItem>
                    </Controls:HamburgerMenuItemCollection>
                </Controls:HamburgerMenu.OptionsItemsSource>
                <Controls:HamburgerMenu.Content>
                    <MultiBinding Converter="{StaticResource SelectedItemToContentConverter}">
                        <Binding Mode="OneWay"
                                 Path="SelectedItem"
                                 RelativeSource="{RelativeSource Self}" />
                        <Binding Mode="OneWay"
                                 Path="SelectedOptionsItem"
                                 RelativeSource="{RelativeSource Self}" />
                    </MultiBinding>
                </Controls:HamburgerMenu.Content>
                <Controls:HamburgerMenu.ContentTemplate>
                    <DataTemplate DataType="{x:Type Controls:HamburgerMenuItem}">
                        <ContentControl x:Name="Content"
                                        Content="{Binding Tag}"
                                        Focusable="False"
                                        Foreground="{DynamicResource LabelTextBrush}" />
                    </DataTemplate>
                </Controls:HamburgerMenu.ContentTemplate>
            </Controls:HamburgerMenu>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Notifications:NotificationMessageContainer Grid.Column="1"
                                                            Manager="{Binding NotificationMessageManager}" />
            </Grid>
            <StatusBar Grid.Row="1"
                       Height="35"
                       VerticalAlignment="Top"
                       Background="{DynamicResource ControlBackgroundBrush}"
                       BorderBrush="{DynamicResource AccentColorBrush}"
                       BorderThickness="0,1,0,0">
                <StatusBar.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </StatusBar.ItemsPanel>
                <StatusBarItem Grid.Column="0">
                    <Controls:ProgressRing Width="30"
                                           Height="30"
                                           Margin="0"
                                           Foreground="{DynamicResource AccentColorBrush}"
                                           Visibility="{Binding ProgressRingVisibility}" />
                </StatusBarItem>
                <StatusBarItem Grid.Column="1"
                               Height="35"
                               Margin="0"
                               VerticalAlignment="Top"
                               Content="{Binding ProgressLabelText}"
                               Foreground="{DynamicResource TextBrush}" />
                <StatusBarItem Width="Auto"
                               HorizontalAlignment="Stretch" />
                <StatusBarItem Grid.Column="3"
                               Height="35"
                               Margin="0,0,5,0"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Top"
                               Content="{Binding NewVersionText}"
                               Foreground="{DynamicResource TextBrush}"
                               Visibility="Visible" />
                <StatusBarItem Grid.Column="4">
                    <Button Margin="0,0,3,0"
                            Command="{Binding GetLatestVersionCommand}"
                            CommandParameter="{Binding Release.HtmlUrl}"
                            Content="{IconPacks:FontAwesomeLight Download}"
                            ToolTip="Download Now"
                            Visibility="{Binding NewVersionVisibility}" />
                </StatusBarItem>
            </StatusBar>

        </Grid>
    </Controls:MetroContentControl>
</Controls:MetroWindow>