<Window xmlns="https://github.com/avaloniaui"
        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:windows="clr-namespace:Aaru.Gui.ViewModels.Windows"
        xmlns:models="clr-namespace:Aaru.Gui.Models"
        xmlns:localization="clr-namespace:Aaru.Localization;assembly=Aaru.Localization"
        xmlns:ic="clr-namespace:FluentIcons.Avalonia;assembly=FluentIcons.Avalonia"
        mc:Ignorable="d"
        d:DesignWidth="1280"
        d:DesignHeight="720"
        Width="1280"
        Height="720"
        x:Class="Aaru.Gui.Views.Windows.MainWindow"
        Icon="/Assets/aaru.png"
        x:DataType="windows:MainWindowViewModel"
        Title="{Binding Title, Mode=OneWay}">
    <Design.DataContext>
        <windows:MainWindowViewModel />
    </Design.DataContext>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{x:Static localization:UI.Menu_File}">
                <MenuItem Header="{x:Static localization:UI.Menu_Open}"
                          InputGesture="{OnPlatform 'Ctrl+O', macOS='Meta+O'}"
                          HotKey="{OnPlatform 'Ctrl+O', macOS='Meta+O'}"
                          Command="{Binding OpenCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="FolderOpen" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static localization:UI.Menu_Open_MHDD_log}"
                          InputGesture="Ctrl+M"
                          HotKey="Ctrl+M"
                          Command="{Binding OpenMhddLogCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="ClipboardPulse" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static localization:UI.Menu_Open_IMGBurn_log}"
                          InputGesture="Ctrl+I"
                          HotKey="Ctrl+I"
                          Command="{Binding OpenIbgLogCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="ClipboardDataBar" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static localization:UI.Menu_Connect_to_AaruRemote}"
                          InputGesture="{OnPlatform 'Ctrl+R', macOS='Meta+R'}"
                          HotKey="{OnPlatform 'Ctrl+R', macOS='Meta+R'}"
                          Command="{Binding ConnectToRemoteCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="DesktopSignal" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static localization:UI.Menu_Open_device}"
                          InputGesture="{OnPlatform 'Ctrl+D', macOS='Meta+D'}"
                          HotKey="{OnPlatform 'Ctrl+D', macOS='Meta+D'}"
                          Command="{Binding OpenDeviceCommand, Mode=OneWay}"
                          IsVisible="{Binding DevicesSupported, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="UsbPlug" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="{x:Static localization:UI.Menu_Settings}"
                          InputGesture="{OnPlatform 'Ctrl+Alt+S', macOS='Meta+OemComma'}"
                          HotKey="{OnPlatform 'Ctrl+Alt+S', macOS='Meta+OemComma'}"
                          IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
                          Command="{Binding SettingsCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="Settings" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="{x:Static localization:UI.Menu_Exit}"
                          InputGesture="{OnPlatform 'Alt+F4', macOS='Meta+Q'}"
                          HotKey="{OnPlatform 'Alt+F4', macOS='Meta+Q'}"
                          IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
                          Command="{Binding ExitCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="Power" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Image}"
                      IsEnabled="{Binding ImageLoaded, Mode=OneWay}">
                <MenuItem Command="{Binding CalculateEntropyCommand, Mode=OneWay}"
                          InputGesture="Ctrl+E"
                          HotKey="Ctrl+E"
                          Header="{x:Static localization:UI.ButtonLabel_Calculate_entropy}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="CalculatorArrowClockwise" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding VerifyImageCommand, Mode=OneWay}"
                          InputGesture="{OnPlatform 'Ctrl+Shift+V', macOS='Meta+Shift+V'}"
                          HotKey="{OnPlatform 'Ctrl+Shift+V', macOS='Meta+Shift+V'}"
                          Header="{x:Static localization:UI.ButtonLabel_Verify}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="Stethoscope" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding ChecksumImageCommand, Mode=OneWay}"
                          InputGesture="Ctrl+K"
                          HotKey="Ctrl+K"
                          Header="{x:Static localization:UI.ButtonLabel_Checksum}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="ShieldAdd" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding ConvertImageCommand, Mode=OneWay}"
                          InputGesture="{OnPlatform 'Ctrl+Shift+C', macOS='Meta+Shift+T'}"
                          HotKey="{OnPlatform 'Ctrl+Shift+C', macOS='Meta+Shift+T'}"
                          Header="{x:Static localization:UI.ButtonLabel_Convert_to}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="ArrowSwap" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding CreateSidecarCommand, Mode=OneWay}"
                          InputGesture="{OnPlatform 'Ctrl+Shift+S', macOS='Meta+Shift+S'}"
                          HotKey="{OnPlatform 'Ctrl+Shift+S', macOS='Meta+Shift+S'}"
                          Header="{x:Static localization:UI.ButtonLabel_Create_Aaru_Metadata_sidecar}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="DocumentBulletListMultiple" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding ViewImageSectorsCommand, Mode=OneWay}"
                          InputGesture="Ctrl+T"
                          HotKey="Ctrl+T"
                          Header="{x:Static localization:UI.ButtonLabel_View_sectors}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="TableSearch" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding DecodeImageMediaTagsCommand, Mode=OneWay}"
                          InputGesture="Ctrl+G"
                          HotKey="Ctrl+G"
                          Header="{x:Static localization:UI.ButtonLabel_Decode_media_tags}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="SaveSearch" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Metadata}">
                <MenuItem Command="{Binding ImageMetadataCommand, Mode=OneWay}"
                          InputGesture="{OnPlatform 'Ctrl+Shift+M', macOS='Meta+M'}"
                          HotKey="{OnPlatform 'Ctrl+Shift+M', macOS='Meta+M'}"
                          Header="{x:Static localization:UI.Menu_Edit_image_metadata}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="TextBulletListSquareEdit" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Command="{Binding CreateMetadataCommand, Mode=OneWay}"
                          InputGesture="{OnPlatform 'Ctrl+N', macOS='Meta+N'}"
                          HotKey="{OnPlatform 'Ctrl+N', macOS='Meta+N'}"
                          Header="{x:Static localization:UI.Menu_Create_metadata_sidecar}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="DocumentAdd" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="{Binding EditMetadataCommand, Mode=OneWay}"
                          InputGesture="{OnPlatform 'Ctrl+Shift+E', macOS='Meta+E'}"
                          HotKey="{OnPlatform 'Ctrl+Shift+E', macOS='Meta+E'}"
                          Header="{x:Static localization:UI.Menu_Edit_metadata_sidecar}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="DocumentEdit" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Window}">
                <MenuItem Header="{x:Static localization:UI.Menu_Console}"
                          InputGesture="{OnPlatform 'Ctrl+OemTilde', macOS='Meta+Shift+C'}"
                          HotKey="{OnPlatform 'Ctrl+OemTilde', macOS='Meta+Shift+C'}"
                          Command="{Binding ConsoleCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="WindowConsole" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Help}">
                <MenuItem Header="{x:Static localization:UI.Menu_Encodings}"
                          Command="{Binding EncodingsCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="LocalLanguage" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static localization:UI.Menu_Plugins}"
                          Command="{Binding PluginsCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="PuzzlePiece" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static localization:UI.Menu_Statistics}"
                          Command="{Binding StatisticsCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="DataPie" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}" />
                <MenuItem Header="{x:Static localization:UI.Menu_About}"
                          Name="AboutMenuItem"
                          IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
                          Command="{Binding AboutCommand, Mode=OneWay}">
                    <MenuItem.Icon>
                        <ic:FluentIcon Icon="People" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
        <Grid ColumnDefinitions="*,5,4*">
            <TreeView ItemsSource="{Binding TreeRoot, Mode=OneWay}"
                      SelectedItem="{Binding TreeViewSelectedItem, Mode=TwoWay}"
                      BorderBrush="LightGray"
                      BorderThickness="1"
                      CornerRadius="4">
                <TreeView.DataTemplates>
                    <TreeDataTemplate DataType="models:ImageModel"
                                      ItemsSource="{Binding PartitionSchemesOrFileSystems, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal"
                                    Spacing="4">
                            <StackPanel.ContextMenu>
                                <ContextMenu
                                    DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType=Window}, Mode=OneWay}">
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.CalculateEntropyCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_Calculate_entropy}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="CalculatorArrowClockwise" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.VerifyImageCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_Verify}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="Stethoscope" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.ChecksumImageCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_Checksum}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="ShieldAdd" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.ConvertImageCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_Convert_to}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="ArrowSwap" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.CreateSidecarCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_Create_Aaru_Metadata_sidecar}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="DocumentBulletListMultiple" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.ViewImageSectorsCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_View_sectors}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="TableSearch" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                    <MenuItem
                                        Command="{Binding $parent[Window].DataContext.DecodeImageMediaTagsCommand, Mode=OneWay}"
                                        Header="{x:Static localization:UI.ButtonLabel_Decode_media_tags}">
                                        <MenuItem.Icon>
                                            <ic:FluentIcon Icon="SaveSearch" />
                                        </MenuItem.Icon>
                                    </MenuItem>
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon, Mode=OneWay}" />
                            <TextBlock Text="{Binding FileName, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:PartitionSchemeModel"
                                      ItemsSource="{Binding Partitions, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal"
                                    Spacing="4">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon, Mode=OneWay}" />
                            <TextBlock Text="{Binding Name, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:PartitionModel"
                                      ItemsSource="{Binding FileSystems, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal"
                                    Spacing="4">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon, Mode=OneWay}" />
                            <TextBlock Text="{Binding Name, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:FileSystemModel"
                                      ItemsSource="{Binding Roots, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal"
                                    Spacing="4">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon, Mode=OneWay}" />
                            <TextBlock Text="{Binding VolumeName, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:SubdirectoryModel"
                                      ItemsSource="{Binding Subdirectories, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal"
                                    Spacing="4">
                            <Svg Width="24"
                                 Height="24"
                                 Path="/Assets/Icons/oxygen/inode-directory.svg" />
                            <TextBlock Text="{Binding Name, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <DataTemplate DataType="models:RootModel">
                        <TextBlock Text="{Binding Name, Mode=OneWay}" />
                    </DataTemplate>
                </TreeView.DataTemplates>
            </TreeView>
            <GridSplitter Grid.Column="1"
                          Width="5"
                          HorizontalAlignment="Stretch"
                          Background="#555555" />
            <ContentControl Grid.Column="2"
                            Content="{Binding ContentPanel, Mode=OneWay}"
                            HorizontalAlignment="Stretch"
                            HorizontalContentAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            VerticalContentAlignment="Stretch"
                            BorderBrush="LightGray"
                            BorderThickness="1"
                            CornerRadius="4" />
        </Grid>
    </DockPanel>
</Window>