<base:WindowBase
    x:Class="v2rayN.Views.RoutingRuleSettingWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="clr-namespace:v2rayN.Base"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:reactiveui="http://reactiveui.net"
    xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
    xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
    Title="{x:Static resx:ResUI.menuRoutingRuleSetting}"
    Width="1000"
    Height="700"
    x:TypeArguments="vms:RoutingRuleSettingViewModel"
    ResizeMode="CanResize"
    ShowInTaskbar="False"
    Style="{StaticResource WindowGlobal}"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <DockPanel>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                ClipToBounds="True"
                Style="{StaticResource MaterialDesignToolBar}">
                <Button x:Name="menuRuleAdd">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon
                            Margin="{StaticResource MarginRight8}"
                            VerticalAlignment="Center"
                            Kind="Plus" />
                        <TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuRuleAdd}" />
                    </StackPanel>
                </Button>
                <Separator />
                <Button x:Name="menuImportRulesFromFile">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon
                            Margin="{StaticResource MarginRight8}"
                            VerticalAlignment="Center"
                            Kind="Import" />
                        <TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromFile}" />
                    </StackPanel>
                </Button>
                <Separator />
                <Button x:Name="menuImportRulesFromClipboard">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon
                            Margin="{StaticResource MarginRight8}"
                            VerticalAlignment="Center"
                            Kind="Import" />
                        <TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromClipboard}" />
                    </StackPanel>
                </Button>
                <Separator />
                <Button x:Name="menuImportRulesFromUrl">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon
                            Margin="{StaticResource MarginRight8}"
                            VerticalAlignment="Center"
                            Kind="Import" />
                        <TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromUrl}" />
                    </StackPanel>
                </Button>
            </ToolBar>
        </ToolBarTray>

        <StackPanel
            Margin="{StaticResource Margin8}"
            HorizontalAlignment="Right"
            DockPanel.Dock="Bottom"
            Orientation="Horizontal">
            <Button
                x:Name="btnSave"
                Width="100"
                Content="{x:Static resx:ResUI.TbConfirm}"
                IsDefault="True"
                Style="{StaticResource DefButton}" />
            <Button
                x:Name="btnCancel"
                Width="100"
                Margin="{StaticResource MarginLeftRight8}"
                Content="{x:Static resx:ResUI.TbCancel}"
                IsCancel="true"
                Style="{StaticResource DefButton}" />
        </StackPanel>

        <Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                Grid.Row="0"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}"
                Text="{x:Static resx:ResUI.LvRemarks}" />
            <StackPanel
                Grid.Row="0"
                Grid.Column="1"
                Orientation="Horizontal">

                <TextBox
                    x:Name="txtRemarks"
                    Grid.Row="0"
                    Grid.Column="1"
                    Width="300"
                    Margin="{StaticResource Margin4}"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    AcceptsReturn="True"
                    Style="{StaticResource DefTextBox}"
                    TextWrapping="Wrap" />

                <TextBlock
                    Margin="{StaticResource Margin4}"
                    VerticalAlignment="Center"
                    Style="{StaticResource ToolbarTextBlock}"
                    Text="{x:Static resx:ResUI.LvSort}" />
                <TextBox
                    x:Name="txtSort"
                    Width="100"
                    Margin="{StaticResource Margin4}"
                    HorizontalAlignment="Left"
                    AcceptsReturn="True"
                    Style="{StaticResource DefTextBox}" />
            </StackPanel>

            <TextBlock
                Grid.Row="1"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}"
                Text="{x:Static resx:ResUI.TbdomainStrategy}" />
            <StackPanel
                Grid.Row="1"
                Grid.Column="1"
                Orientation="Horizontal">
                <ComboBox
                    x:Name="cmbdomainStrategy"
                    Width="200"
                    Margin="{StaticResource Margin4}"
                    Style="{StaticResource DefComboBox}" />
                <TextBlock
                    Margin="{StaticResource Margin4}"
                    VerticalAlignment="Center"
                    Style="{StaticResource ToolbarTextBlock}"
                    Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
                <ComboBox
                    x:Name="cmbdomainStrategy4Singbox"
                    Width="200"
                    Margin="{StaticResource Margin4}"
                    Style="{StaticResource DefComboBox}" />
            </StackPanel>

            <TextBlock
                Grid.Row="2"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}"
                Text="{x:Static resx:ResUI.LvUrl}" />
            <TextBox
                x:Name="txtUrl"
                Grid.Row="2"
                Grid.Column="1"
                Width="600"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                AcceptsReturn="True"
                Style="{StaticResource DefTextBox}"
                TextWrapping="Wrap" />

            <TextBlock
                Grid.Row="3"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}"
                Text="{x:Static resx:ResUI.LvCustomIcon}" />
            <TextBox
                x:Name="txtCustomIcon"
                Grid.Row="3"
                Grid.Column="1"
                Width="600"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                AcceptsReturn="True"
                Style="{StaticResource DefTextBox}"
                TextWrapping="Wrap" />
            <Button
                x:Name="btnBrowseCustomIcon"
                Grid.Row="3"
                Grid.Column="2"
                Margin="{StaticResource MarginLeftRight4}"
                Content="{x:Static resx:ResUI.TbBrowse}"
                Style="{StaticResource DefButton}" />

            <TextBlock
                Grid.Row="4"
                Grid.Column="0"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                Style="{StaticResource ToolbarTextBlock}">
                <Hyperlink Click="linkCustomRulesetPath4Singbox">
                    <TextBlock Text="{x:Static resx:ResUI.LvCustomRulesetPath4Singbox}" />
                    <materialDesign:PackIcon Kind="Link" />
                </Hyperlink>
            </TextBlock>
            <TextBox
                x:Name="txtCustomRulesetPath4Singbox"
                Grid.Row="4"
                Grid.Column="1"
                Width="600"
                Margin="{StaticResource Margin4}"
                VerticalAlignment="Center"
                AcceptsReturn="True"
                Style="{StaticResource DefTextBox}"
                TextWrapping="Wrap" />
            <Button
                x:Name="btnBrowseCustomRulesetPath4Singbox"
                Grid.Row="4"
                Grid.Column="2"
                Margin="{StaticResource MarginLeftRight4}"
                Content="{x:Static resx:ResUI.TbBrowse}"
                Style="{StaticResource DefButton}" />
        </Grid>

        <TabControl x:Name="tabAdvanced">
            <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.menuRuleList}">
                <DataGrid
                    x:Name="lstRules"
                    AutoGenerateColumns="False"
                    BorderThickness="1"
                    CanUserAddRows="False"
                    CanUserResizeRows="False"
                    CanUserSortColumns="False"
                    EnableRowVirtualization="True"
                    GridLinesVisibility="All"
                    HeadersVisibility="Column"
                    IsReadOnly="True"
                    Style="{StaticResource DefDataGrid}">
                    <DataGrid.ContextMenu>
                        <ContextMenu Style="{StaticResource DefContextMenu}">
                            <MenuItem
                                x:Name="menuRuleAdd2"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRuleAdd}" />
                            <MenuItem
                                x:Name="menuRuleRemove"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRuleRemove}" />
                            <MenuItem
                                x:Name="menuRuleSelectAll"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuSelectAll}" />
                            <MenuItem
                                x:Name="menuRuleExportSelected"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuRuleExportSelected}" />
                            <Separator />
                            <MenuItem
                                x:Name="menuMoveTop"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuMoveTop}" />
                            <MenuItem
                                x:Name="menuMoveUp"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuMoveUp}" />
                            <MenuItem
                                x:Name="menuMoveDown"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuMoveDown}" />
                            <MenuItem
                                x:Name="menuMoveBottom"
                                Height="{StaticResource MenuItemHeight}"
                                Header="{x:Static resx:ResUI.menuMoveBottom}" />
                        </ContextMenu>
                    </DataGrid.ContextMenu>
                    <DataGrid.Columns>
                        <DataGridCheckBoxColumn
                            Width="60"
                            Binding="{Binding Enabled}"
                            Header="" />
                        <DataGridTextColumn
                            Width="150"
                            Binding="{Binding Remarks}"
                            Header="{x:Static resx:ResUI.LvRemarks}" />
                        <DataGridTextColumn
                            Width="100"
                            Binding="{Binding RuleTypeName}"
                            Header="{x:Static resx:ResUI.TbRuleType}" />
                        <DataGridTextColumn
                            Width="130"
                            Binding="{Binding OutboundTag}"
                            Header="outboundTag" />
                        <DataGridTextColumn
                            Width="100"
                            Binding="{Binding Port}"
                            Header="port" />
                        <DataGridTextColumn
                            Width="100"
                            Binding="{Binding Protocols}"
                            Header="protocol" />
                        <DataGridTextColumn
                            Width="120"
                            Binding="{Binding InboundTags}"
                            Header="inboundTag" />
                        <DataGridTextColumn
                            Width="100"
                            Binding="{Binding Network}"
                            Header="network" />
                        <DataGridTextColumn
                            Width="*"
                            Binding="{Binding Domains}"
                            Header="domain / ip" />
                    </DataGrid.Columns>
                </DataGrid>
            </TabItem>
        </TabControl>
    </DockPanel>
</base:WindowBase>
