<Window
    x:Class="DouYin.DownLoader.Views.MainView" 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:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:local="clr-namespace:DouYin.DownLoader.Views"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:DouYin.DownLoader.ViewModels"
    Title="MainView" Width="1080" Height="960"
    d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
    AllowsTransparency="True"
    Style="{StaticResource MaterialDesignWindow}"
    WindowStartupLocation="CenterScreen" WindowStyle="None" mc:Ignorable="d">

    <md:DialogHost DialogTheme="Inherit" Identifier="RootDialog">

        <md:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
            <md:DrawerHost.LeftDrawerContent>
                <DockPanel MinWidth="220">
                    <StackPanel DockPanel.Dock="Top">
                        <Image
                            Width="100" Height="100" Margin="20"
                            Source="/avator.jpg">
                            <Image.Clip>
                                <EllipseGeometry
                                    Center="50,50" RadiusX="40" RadiusY="40" />
                            </Image.Clip>
                        </Image>
                        <ListBox
                            x:Name="menuListBoxt"
                            ItemContainerStyle="{StaticResource MyListIBoxtemStyle}"
                            ItemsSource="{Binding MenuBars}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="SelectionChanged">
                                    <i:InvokeCommandAction Command="{Binding NavigateCommand}" CommandParameter="{Binding ElementName=menuListBoxt, Path=SelectedItem}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <md:PackIcon Margin="20,10" Kind="{Binding Icon}" />
                                        <TextBlock Margin="10,10" Text="{Binding Title}" />
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </DockPanel>
            </md:DrawerHost.LeftDrawerContent>

            <DockPanel>
                <md:ColorZone
                    Padding="2" md:ElevationAssist.Elevation="Dp1" DockPanel.Dock="Top"
                    Mode="PrimaryMid" MouseLeftButtonDown="ColorZone_MouseLeftButtonDown">

                    <DockPanel LastChildFill="True">
                        <StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
                            <Image
                                Width="60" Height="60" Source="/avator.jpg">
                                <Image.Clip>
                                    <EllipseGeometry
                                        Center="30,30" RadiusX="26" RadiusY="26" />
                                </Image.Clip>
                            </Image>
                            <Button
                                x:Name="mixiMizedBtn" Click="mixiMizedBtn_Click" Content="─"
                                Style="{StaticResource MaterialDesignFlatMidBgButton}" />
                            <Button
                                x:Name="maxiMizedBtn" Click="maxiMizedBtn_Click" Content="☐"
                                Style="{StaticResource MaterialDesignFlatMidBgButton}" />
                            <Button
                                x:Name="closedBtn" Click="closedBtn_Click" Content="✕"
                                Style="{StaticResource MaterialDesignFlatMidBgButton}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <ToggleButton
                                x:Name="MenuToggleButton" AutomationProperties.Name="HamburgerToggleButton" IsChecked="False"
                                Style="{StaticResource MaterialDesignHamburgerToggleButton}" />
                        </StackPanel>

                        <TextBlock
                            Margin="20,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"
                            AutomationProperties.Name="WPF NOTE BOOK" FontSize="22" Text="抖音下载助手" />
                    </DockPanel>

                </md:ColorZone>

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="25" />
                    </Grid.RowDefinitions>
                    <ContentControl Grid.Row="0" Content="{Binding CurrentViewModel}">
                        <ContentControl.Resources>
                            <DataTemplate DataType="{x:Type vm:HomeViewModel}">
                                <local:Home />
                            </DataTemplate>
                            <DataTemplate DataType="{x:Type vm:NoteViewModel}">
                                <local:Note />
                            </DataTemplate>
                            <DataTemplate DataType="{x:Type vm:SettingViewModel}">
                                <local:Setting />
                            </DataTemplate>
                            <DataTemplate DataType="{x:Type vm:SearchViewModel}">
                                <local:Search />
                            </DataTemplate>
                        </ContentControl.Resources>
                    </ContentControl>
                    <ProgressBar
                        Grid.Row="1" Height="25"
                        IsIndeterminate="{Binding IsIndeterminate}"
                        Opacity="0.1" />
                    <TextBlock
                        Grid.Row="1" VerticalAlignment="Center"
                        Text="{Binding Message}"
                        TextAlignment="Center" />
                </Grid>
            </DockPanel>
        </md:DrawerHost>
    </md:DialogHost>
</Window>
