<Window x:Class="ADP.Views.ShellView"
        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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:converter="clr-namespace:UIShare.Converters;assembly=UIShare"
        xmlns:prism="http://prismlibrary.com/"
        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
        WindowStartupLocation="CenterScreen"
        Topmost="false"
        mc:Ignorable="d"
        prism:ViewModelLocator.AutoWireViewModel="True"
        WindowStyle="None"
        WindowState="Maximized"
        Title="ShellView"
        d:DesignHeight="1080"
        d:DesignWidth="1920">
    <WindowChrome.WindowChrome>
        <WindowChrome GlassFrameThickness="-1" />
    </WindowChrome.WindowChrome>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <i:InvokeCommandAction Command="{Binding LoadCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <Window.Resources>
        <converter:InverseBooleanConverter x:Key="InverseBooleanConverter" />
        <converter:TimeSpanToStringConverter x:Key="TimeSpanConverter" />
    </Window.Resources>
    <materialDesign:DrawerHost x:Name="MainDrawerHost"
                               IsLeftDrawerOpen="{Binding IsLeftDrawerOpen, Mode=TwoWay}">

        <!-- ✅ 左侧抽屉内容 -->
        <materialDesign:DrawerHost.LeftDrawerContent>
            <StackPanel Width="220"
                        Background="{DynamicResource MaterialDesignPaper}">
                <TextBlock Text="导航菜单"
                           FontSize="18"
                           Margin="16"
                           Foreground="{DynamicResource PrimaryHueMidBrush}" />
                <Separator Margin="0,0,0,8" />
                <Button Content="主界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" />
                <Button Content="监控界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" />
                <Button Content="记录界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" />
                <Button Content="设置界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" /> 

                <Button Content="台架移动界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" />
                <Button Content="曲线回读界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" />
                <Button Content="测试报告导出界面"
                        Command="{Binding NavigateCommand}"
                        CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
                        Style="{StaticResource MaterialDesignFlatButton}"
                        Margin="8" />
            </StackPanel>
        </materialDesign:DrawerHost.LeftDrawerContent>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <!-- 顶部工具栏 -->
            <materialDesign:ColorZone Mode="PrimaryMid"
                                      MouseLeftButtonDown="ColorZone_MouseLeftButtonDown">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition />
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <Menu Grid.Column="0"
                          Background="Transparent"
                          Foreground="White"
                          VerticalAlignment="Center">
                        <!-- 文件菜单 -->
                        <MenuItem FontSize="13"
                                  Height="50"
                                  Header="菜单"
                                  Foreground="White"
                                  Command="{Binding DataContext.LeftDrawerOpenCommand, RelativeSource={RelativeSource AncestorType=Window}}">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Menu"
                                                         Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>


                        <!-- 工具菜单 -->
                        <MenuItem Header="工具"
          FontSize="13"
          Height="50"
          Foreground="White">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Tools"
                                 Foreground="White" />
                            </MenuItem.Icon>

                            <!-- 新建 -->
                            <MenuItem Header="新建"
              Foreground="Black"
              Command="{Binding NewCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="FilePlus"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>

                            <!-- 打开 -->
                            <MenuItem Header="打开"
              Foreground="Black"
              Command="{Binding OpenCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="FolderOpen"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>

                            <!-- 保存 -->
                            <MenuItem Header="保存"
              Foreground="Black"
              Command="{Binding SaveCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="ContentSave"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>

                            <!-- 另存为 -->
                            <MenuItem Header="另存为"
              Foreground="Black"
              Command="{Binding SaveAsCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="ContentSaveEdit"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>

                            <!-- 设置默认程序 -->
                            <MenuItem Header="设置默认程序"
              Foreground="Black"
              Command="{Binding SetDefaultCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="Cog"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <!-- CAN信号监控 -->
                            <MenuItem Header="CAN信号监控"
Foreground="Black"
Command="{Binding SelectCANSignalMonitorCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="Message"
                       Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <!-- 监控设置 -->
                            <MenuItem Header="监控设置"
Foreground="Black"
Command="{Binding MonitorValueSettingCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="Monitor"
                       Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="CAN报文选择"
Foreground="Black"
Command="{Binding SelectCANMessageCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="Message"
                       Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>
                           
                            <!-- 获得文件路径字符串 -->
                            <MenuItem Header="获得文件路径字符串"
Foreground="Black"
Command="{Binding GetFileStringCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="File"
                       Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>

                            <!-- 弹窗管理器 -->
                            <MenuItem Header="弹窗管理器"
              FontSize="14"
              Height="50"
              Foreground="Black"
              Command="{Binding ShowDialogManagerViewCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="DialogueOutline"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem> 
                            <MenuItem Header="蜂鸣器消音"
              FontSize="14"
              Height="50"
              Foreground="Black"
              Command="{Binding SilenceBuzzerCommand}">
                                <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="BellOff"
                                     Foreground="Black" />
                                </MenuItem.Icon>
                            </MenuItem>
                        </MenuItem>
                        <MenuItem Header="切换九宫格"
                                 FontSize="13"
                                 Height="50"
                                 Foreground="White"
                                 Command="{Binding RefreshCommand}">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Refresh"
                                   Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="销毁作用域"
                                 FontSize="13"
                                 Height="50"
                                 Foreground="White"
                                 Command="{Binding DestroyCommand}">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Death"
                                   Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem FontSize="14"
          Height="50"
          Header="运行"
          IsEnabled="{Binding IsTerminate, Converter={StaticResource InverseBooleanConverter}}"
          Command="{Binding RunningCommand}"
          Foreground="White">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="{Binding RunIcon}"
                                 Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem FontSize="14"
          Height="50"
          Header="单步执行"
          IsEnabled="{Binding IsTerminate, Converter={StaticResource InverseBooleanConverter}}"
          Command="{Binding RunSingleCommand}"
          Foreground="White">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="ArrowRight"
                                 Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem FontSize="14"
          Height="50"
          Header="异常流程"
          Command="{Binding RunAbnormalStepsCommand}"
          IsEnabled="{Binding IsTerminate, Converter={StaticResource InverseBooleanConverter}}"
          Foreground="White">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="AlertCircle"
                                 Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem FontSize="14"
          Height="50"
          Header="复位"
          Command="{Binding RestorationCommand}"
          Foreground="White">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Restart"
                                 Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>

                        <MenuItem FontSize="14"
          Height="50"
          Foreground="White">
                            <MenuItem.Header>
                                <TextBlock>
            <Run Text="运行时间：" />
           <TextBlock Text="{Binding RunningTime, Converter={StaticResource TimeSpanConverter}}" />
        </TextBlock>
                            </MenuItem.Header>
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Clock"
                                 Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                    </Menu>

                    <Menu Grid.Column="2"
                          Margin="0 0 20 0">
                        <MenuItem FontSize="13"
                                  Height="50"
                                  Header="最小化"
                                  Foreground="White"
                                  Command="{Binding MinimizeCommand}"
                                  CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Minimize"
                                                         Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>

                        <!--<MenuItem FontSize="13"
                                  Height="50"
                                  Header="最大化"
                                  Foreground="White"
                                  Command="{Binding MaximizeCommand}"
                                  CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Maximize"
                                                         Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>-->

                        <MenuItem FontSize="13"
                                  Height="50"
                                  Header="关闭"
                                  Foreground="White"
                                  Command="{Binding CloseCommand}"
                                  CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}">
                            <MenuItem.Icon>
                                <materialDesign:PackIcon Kind="Close"
                                                         Foreground="White" />
                            </MenuItem.Icon>
                        </MenuItem>
                    </Menu>

                </Grid>
                <!-- 左侧菜单 -->



            </materialDesign:ColorZone>

            <materialDesign:DialogHost Grid.Row="1"
                                       x:Name="DialogHost"
                                       DialogBackground="Transparent"
                                       Background="Transparent"
                                       Identifier="Root">
                <!-- 主内容区 -->
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="31*"/>
                    </Grid.ColumnDefinitions>
                    <ContentControl prism:RegionManager.RegionName="ShellViewManager" Grid.ColumnSpan="2" />
                    <Border x:Name="Overlay"
                            Background="#40000000"
                            Visibility="Collapsed"
                            Panel.ZIndex="1" Grid.ColumnSpan="2">
                        <StackPanel Width="150"
                                    VerticalAlignment="Center"
                                    Margin="0 0 0 100">

                        </StackPanel>
                    </Border>
                    <Border x:Name="Waitinglay"
                            Background="#40000000"
                            Visibility="Collapsed"
                            Panel.ZIndex="1" Grid.ColumnSpan="2">
                        <StackPanel Width="150"
                                    VerticalAlignment="Center"
                                    Margin="0 0 0 100">
                            <ProgressBar Width="80"
                                         Height="80"
                                         Margin="20"
                                         IsIndeterminate="True"
                                         Style="{StaticResource MaterialDesignCircularProgressBar}" />
                            <TextBlock FontSize="30"
                                       Text="加载中......"
                                       HorizontalAlignment="Center" />
                        </StackPanel>
                    </Border>
                </Grid>
            </materialDesign:DialogHost>
        </Grid>
    </materialDesign:DrawerHost>

</Window>
