123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <Page x:Class="ClashDotNetFramework.Pages.ProfilesPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:ClashDotNetFramework.Pages"
- xmlns:converters="clr-namespace:ClashDotNetFramework.Models.Converters"
- xmlns:TxtBox="clr-namespace:WatermarkControlsLib.Controls;assembly=WatermarkControlsLib"
- mc:Ignorable="d" FontSize="14" Loaded="ProfilesPage_Loaded"
- d:DesignHeight="750" d:DesignWidth="780"
- Title="ProfilesPage">
- <Page.Resources>
- <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
- <converters:DateTimeToStringConverter x:Key="DateTimeToStringConverter"/>
- <converters:GroupCountToStringConverter x:Key="GroupCountToStringConverter"/>
- <converters:ProfileTypeToStringConverter x:Key="ProfileTypeToStringConverter"/>
- <converters:ProxyCountToStringConverter x:Key="ProxyCountToStringConverter"/>
- <converters:RuleCountToStringConverter x:Key="RuleCountToStringConverter"/>
- <converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
- <Style x:Key="ButtonStyle" TargetType="Button">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Foreground" Value="{DynamicResource ButtonForeground}"/>
- <Setter Property="Background" Value="{DynamicResource ButtonBackground}"/>
- <Setter Property="Cursor" Value="Hand"/>
- <Setter Property="Width" Value="130"/>
- <Setter Property="Height" Value="40"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <Border CornerRadius="2" Background="{TemplateBinding Background}">
- <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="BorderStyle" TargetType="Border">
- <Setter Property="CornerRadius" Value="2"/>
- <Setter Property="Padding" Value="4,4"/>
- <Setter Property="Margin" Value="0,0,5,0"/>
- </Style>
- <DataTemplate x:Key="ProfileItemTemplate" DataType="items:ProfileItem">
- <Grid>
- <Grid.RowDefinitions>
- <!-- Profile Name -->
- <RowDefinition/>
- <!-- Status Labels -->
- <RowDefinition/>
- </Grid.RowDefinitions>
- <!-- Profile Name -->
- <TextBlock
- Text="{Binding Name}"
- Foreground="{DynamicResource NormalTextForeground}"/>
- <!-- Status Labels -->
- <StackPanel
- Grid.Row="1"
- Orientation="Horizontal"
- Margin="0,5,0,10">
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#D4302C"
- Visibility="{Binding Path=IsSelected, Converter={StaticResource BoolToVisibilityConverter}}">
- <TextBlock
- Text="Default"
- Foreground="White"/>
- </Border>
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#CE8647">
- <TextBlock
- Text="{Binding Type, Converter={StaticResource ProfileTypeToStringConverter}}"
- Foreground="White"/>
- </Border>
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#CF9F46"
- Visibility="{Binding Path=Host, Converter={StaticResource StringToVisibilityConverter}}">
- <TextBlock
- Text="{Binding Host}"
- Foreground="White"/>
- </Border>
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#75AB5B">
- <TextBlock
- Text="{Binding ProxyCount, Converter={StaticResource ProxyCountToStringConverter}}"
- Foreground="White"/>
- </Border>
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#369F71">
- <TextBlock
- Text="{Binding GroupCount, Converter={StaticResource GroupCountToStringConverter}}"
- Foreground="White"/>
- </Border>
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#428EE4">
- <TextBlock
- Text="{Binding RuleCount, Converter={StaticResource RuleCountToStringConverter}}"
- Foreground="White"/>
- </Border>
- <Border
- Style="{StaticResource BorderStyle}"
- Background="#5182CC">
- <TextBlock
- Text="{Binding LastUpdate, Converter={StaticResource DateTimeToStringConverter}}"
- Foreground="White"/>
- </Border>
- </StackPanel>
- </Grid>
- </DataTemplate>
- </Page.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <!-- Top Buttons -->
- <RowDefinition Height="100"/>
-
- <!-- Profile ListView -->
- <RowDefinition/>
- </Grid.RowDefinitions>
-
- <!-- Top Buttons -->
- <Grid
- Height="50"
- Margin="20,0">
- <Grid.ColumnDefinitions>
- <!-- UrlTextBox -->
- <ColumnDefinition Width="*"/>
-
- <!-- Download Button -->
- <ColumnDefinition Width="Auto"/>
-
- <!-- Update All Button -->
- <ColumnDefinition Width="Auto"/>
-
- <!-- Import Button -->
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <!-- UrlTextBox -->
- <TxtBox:WatermarkTextBox
- BorderBrush="{DynamicResource TextBoxBorderBrush}"
- Background="{DynamicResource TextBoxBackground}"
- Foreground="{DynamicResource NormalTextForeground}"
- HorizontalAlignment="Stretch"
- VerticalContentAlignment="Center"
- x:Name="UrlTextBox">
- <TextBox.Resources>
- <Style TargetType="{x:Type Border}">
- <Setter Property="CornerRadius" Value="2"/>
- </Style>
- </TextBox.Resources>
- <TxtBox:WatermarkTextBox.Watermark>
- <TextBlock
- Text="{DynamicResource DownloadFromURL}"
- Foreground="{DynamicResource NormalTextForeground}"
- Margin="5,0,0,0"/>
- </TxtBox:WatermarkTextBox.Watermark>
- </TxtBox:WatermarkTextBox>
- <!-- Download Button -->
- <Button
- Grid.Column="1"
- Style="{StaticResource ButtonStyle}"
- Content="{DynamicResource Download}"
- Click="DownloadButton_Click"
- Margin="15,0,0,0"
- x:Name="DownloadButton"/>
-
- <!-- Update All Button -->
- <Button
- Grid.Column="2"
- Style="{StaticResource ButtonStyle}"
- Content="{DynamicResource UpdateAll}"
- Click="UpdateAllButton_Click"
- Margin="15,0,0,0"
- x:Name="UpdateAllButton"/>
-
- <!-- Import Button -->
- <Button
- Grid.Column="3"
- Style="{StaticResource ButtonStyle}"
- Content="{DynamicResource Import}"
- Click="ImportButton_Click"
- Margin="15,0,0,0"
- x:Name="ImportButton"/>
- </Grid>
- <Separator
- VerticalAlignment="Bottom"
- Background="{DynamicResource SeparatorBackground}"/>
- <!-- Profile ListView -->
- <Grid
- Grid.Row="1"
- AllowDrop="True"
- Drop="ProfileGrid_Drop"
- Margin="14,5,20,20">
- <ListView
- Background="Transparent"
- BorderBrush="Transparent"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled"
- ScrollViewer.VerticalScrollBarVisibility="Hidden"
- ItemTemplate="{StaticResource ProfileItemTemplate}"
- SelectionMode="Single"
- x:Name="ProfileItemListView">
- <ListView.ContextMenu>
- <ContextMenu Style="{StaticResource IconlessContextMenuStyle}">
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource SelectProfile}" Click="SelectProfile_Click"/>
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource UpdateProfile}" Click="UpdateProfile_Click"/>
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource EditProfile}" Click="EditProfile_Click"/>
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource DuplicateProfile}" Click="DuplicateProfile_Click"/>
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource GoToURL}" Click="GoToURL_Click"/>
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource ProfileSettings}" Click="ProfileSettings_Click"/>
- <MenuItem Style="{StaticResource MenuItemStyle}" Header="{DynamicResource DeleteProfile}" Click="DeleteProfile_Click"/>
- </ContextMenu>
- </ListView.ContextMenu>
- </ListView>
- </Grid>
- </Grid>
- </Page>
|