<UserControl
    x:Class="DMS.WPF.Views.SettingView"
    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:ikw="http://schemas.inkore.net/lib/ui/wpf"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">
    <StackPanel>

        <ui:SettingsExpander Description="通用程序行为设置" Header="通用设置">
            <ui:SettingsExpander.HeaderIcon>
                <ui:FontIcon Glyph="&#xE713;" />
            </ui:SettingsExpander.HeaderIcon>
            <ui:SettingsExpander.Items>
                <ui:SettingsCard Description="切换应用程序的主题" Header="主题切换">
                    <ComboBox
                        Width="120"
                        ItemsSource="{Binding Themes}"
                        SelectedItem="{Binding SelectedTheme, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>
                <ui:SettingsCard
                    Description="开启后，点击主窗口的关闭按钮会将程序最小化到系统通知栏，而不是直接退出。"
                    Header="点击关闭按钮时最小化到通知栏"
                    IsClickEnabled="True">
                    <ui:ToggleSwitch IsOn="{Binding MinimizeToTrayOnClose, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>
                <ui:SettingsCard Description="设置变量的默认轮询间隔时间（毫秒）" Header="默认轮询间隔">
                    <TextBox Width="120" Text="{Binding DefaultPollingInterval, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>
            </ui:SettingsExpander.Items>
        </ui:SettingsExpander>



        <ui:SettingsExpander Description="设置要连接的数据库，数据全部在数据库中存放" Header="设置数据库">
            <ui:SettingsExpander.HeaderIcon>
                <ui:FontIcon
                    FontFamily="{StaticResource MdFontIcons}"
                    FontSize="18"
                    Glyph="&#xF01BC;" />
            </ui:SettingsExpander.HeaderIcon>
            <Button
                Margin="0,10,0,0"
                HorizontalAlignment="Left"
                Command="{Binding TestConnectionCommand}"
                Content="测试连接"
                Style="{StaticResource AccentButtonStyle}" />

            <ui:SettingsExpander.Items>
                <ui:SettingsCard Description="使用的数据库类型，如Mysql,SqlServer等" Header="数据库类型">
                    <ComboBox
                        MinWidth="200"
                        ItemsSource="{Binding AvailableDbTypes}"
                        SelectedItem="{Binding SelectedDbType}" />
                </ui:SettingsCard>

                <ui:SettingsCard Description="数据库所在电脑的地址" Header="服务器地址">
                    <TextBox MinWidth="200" Text="{Binding Server, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>

                <ui:SettingsCard Description="数据库服务器端口号" Header="服务器端口">
                    <TextBox MinWidth="200" Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>


                <ui:SettingsCard Description="数据库登录用户名" Header="用户名">
                    <TextBox MinWidth="200" Text="{Binding UserId, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>

                <ui:SettingsCard Description="数据库登录密码" Header="密码">
                    <TextBox MinWidth="200" Text="{Binding Password, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>

                <ui:SettingsCard Description="要连接的数据库名称" Header="数据库名称">
                    <TextBox MinWidth="200" Text="{Binding DbName, UpdateSourceTrigger=PropertyChanged}" />
                </ui:SettingsCard>


            </ui:SettingsExpander.Items>

        </ui:SettingsExpander>

        <ui:SettingsExpander>
            <ui:SettingsExpander.HeaderIcon>
                <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.ScreenTime}" />
            </ui:SettingsExpander.HeaderIcon>
        </ui:SettingsExpander>


    </StackPanel>
</UserControl>