<UserControl x:Class="BDU.Views.ToolBar"
             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:local="clr-namespace:BDU.Views"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:converters="clr-namespace:BDU.Tools"
    d:DataContext="{d:DesignInstance Type=local:ToolBar}"
             d:DesignWidth="800"
             mc:Ignorable="d"
             Height="50">
    <Grid>
        <Menu Grid.ColumnSpan="3"
              Background="Transparent">
           
            <MenuItem Header="返回上级程序"
                      FontSize="13"
                      Height="50"
                      Click="NavigateBack_Click">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="ArrowLeft" />
                </MenuItem.Icon>


            </MenuItem>

            <MenuItem Header="文件"
                      FontSize="13"
                      Height="50">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="File" />
                </MenuItem.Icon>
                <MenuItem Click="File_New_Click"
                          Header="新建" />
                <MenuItem Click="File_Open_Click"
                          Header="打开" />
                <MenuItem Click="File_Save_Click"
                          Header="保存" />
                <MenuItem Click="File_SaveAsOther_Click"
                          Header="另存为" />
                <MenuItem Click="Set_DefaultProgram_Click"
                          Header="设置默认程序" />
            </MenuItem>

            <MenuItem Header="工具"
                      FontSize="13"
                      Height="50">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="Tools" />
                </MenuItem.Icon>
                <MenuItem Click="SystemConfig_Click"
                          Header="系统设置"
                          IsEnabled="{Binding IsAdmin}" />
                <MenuItem Header="设备管理"
                          Click="DeviceManage_Click"
                          IsEnabled="{Binding IsAdmin}">
                </MenuItem>
                <MenuItem Header="数据">
                    <MenuItem Click="TestDataInfo_Click"
                              Header="数据查询" />
                </MenuItem>
                <MenuItem Header="同星CAN"
                          IsEnabled="{Binding IsAdmin}">
                    <MenuItem Click="Connect_DisConnect_Click"
                              Header="连接/断开" />
                    <MenuItem Click="ChannelMapping_Click"
                              Header="通道映射" />
                    <MenuItem Click="CAN_DatabaseConnect_Click"
                              Header="加载数据库" />
                    <MenuItem Click="CAN_CatchConfig_Click"
                              Header="CAN采集信号配置" 
                              IsEnabled="{Binding IsDebug}"/>
                </MenuItem>
                <MenuItem Header="调试"
                          IsEnabled="{Binding IsDebug}">
                    <MenuItem Header="自动运行"
                              Click="Debug_AutoRun_Click" />
                    <MenuItem Header="清空数据库"
                              Foreground="Red"
                              Click="Debug_ClearDataBase_Click" />
                </MenuItem>
            </MenuItem>

            <MenuItem Click="ProgramRun_Click"
                      FontSize="13"
                      Height="50"
                      Header="{Binding RunState}"
                      IsEnabled="{Binding IsTerminate, Converter={StaticResource BoolInverseConverter}}">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="{Binding RunIcon}" />
                </MenuItem.Icon>
            </MenuItem>

            <MenuItem Click="SingleStepExecution_Click"
                      FontSize="13"
                      Height="50"
                      Header="单步执行"
                      IsEnabled="{Binding IsTerminate, Converter={StaticResource BoolInverseConverter}}">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="Arrow" />
                </MenuItem.Icon>
            </MenuItem>

            <MenuItem Click="Terminate_Click"
                      FontSize="13"
                      Height="50"
                      Header="停止"
                      IsEnabled="{Binding IsStop, Converter={StaticResource BoolInverseConverter}}">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="Stop" />
                </MenuItem.Icon>
            </MenuItem>

            <MenuItem Click="Reset_Click"
                      FontSize="13"
                      Height="50"
                      Header="复位"
                      IsEnabled="{Binding IsTerminate}">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="Restart" />
                </MenuItem.Icon>
            </MenuItem>

            <MenuItem Click="Report_Click"
                      FontSize="13"
                      Height="50"
                      Header="导出报告"
                      IsEnabled="{Binding CanReport, Converter={StaticResource BoolInverseConverter}}">
                <MenuItem.Icon>
                    <materialDesign:PackIcon Kind="Book" />
                </MenuItem.Icon>
            </MenuItem>
        </Menu>
    </Grid>
</UserControl>