UI New Style

This commit is contained in:
RMBGAME
2021-10-17 04:57:59 +08:00
parent 2f5dcab571
commit c43bddf22d
11 changed files with 77 additions and 70 deletions
@@ -1,14 +1,10 @@
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using ReactiveUI;
using System.Application.Mvvm;
using System.Application.UI.ViewModels;
using System.Application.UI.Views;
using System.Collections.Generic;
using System.IO;
using System.Properties;
using System.Windows;
using AvaloniaApplication = Avalonia.Application;
using ShutdownMode = Avalonia.Controls.ShutdownMode;
using Window = Avalonia.Controls.Window;
@@ -21,7 +17,6 @@ using System.Linq;
using System.Application.Settings;
using System.Application.UI.Resx;
using System.Application.Models;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Application.UI.Views.Windows;
using System.Application.Services.Implementation;
@@ -14,8 +14,8 @@
</Border>
</Design.PreviewWith>
<Styles.Resources>
<CornerRadius x:Key="PaperRadius">9</CornerRadius>
<CornerRadius x:Key="PaperRadiusLeft">9 0 0 9</CornerRadius>
<CornerRadius x:Key="PaperRadius">8</CornerRadius>
<CornerRadius x:Key="PaperRadiusLeft">8 0 0 8</CornerRadius>
</Styles.Resources>
<Style Selector="Border.card">
@@ -52,6 +52,11 @@
</Design.PreviewWith>
<Styles.Resources>
<sys:Double x:Key="SettingsRightContentWidth">250</sys:Double>
<SolidColorBrush x:Key="ExpanderBorderPointerOverBrush"
Color="{DynamicResource CardStrokeColorDefault}" />
<SolidColorBrush x:Key="ExpanderBorderBrush"
Color="{DynamicResource CardStrokeColorDefault}" />
</Styles.Resources>
<Style Selector="StackPanel.Settings">
@@ -80,7 +85,7 @@
</Style>
<Style Selector="Border.Item:pointerover">
<Setter Property="Background" Value="{DynamicResource ControlStrokeColorSecondaryBrush}" />
<Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorSecondaryBrush}" />
</Style>
<Style Selector="StackPanel.Settings Expander">
@@ -93,6 +98,10 @@
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style Selector="StackPanel.Settings Expander ToggleButton.ExpanderToggleButton /template/ ContentPresenter#ContentPresenter > TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style Selector="StackPanel.Settings TextBlock">
<Setter Property="FontSize" Value="{StaticResource FontSizeH7}"/>
<Setter Property="Foreground" Value="{DynamicResource HighlightForegroundBrushKey}" />
@@ -112,6 +121,12 @@
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style Selector="StackPanel.Settings DockPanel > Label">
<Setter Property="Margin" Value="0 0 20 0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="(DockPanel.Dock)" Value="Left" />
</Style>
<Style Selector="StackPanel.Settings DockPanel > TextBlock">
<Setter Property="Margin" Value="0 0 20 0" />
<Setter Property="VerticalAlignment" Value="Center" />
@@ -150,6 +165,13 @@
<Setter Property="(DockPanel.Dock)" Value="Right" />
</Style>
<Style Selector="StackPanel.Settings DockPanel > NumericUpDown">
<!--<Setter Property="Width" Value="{StaticResource SettingsRightContentWidth}" />-->
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="(DockPanel.Dock)" Value="Right" />
</Style>
<Style Selector="StackPanel.Settings DockPanel > Slider">
<Setter Property="Width" Value="{StaticResource SettingsRightContentWidth}" />
<Setter Property="Margin" Value="0 -15 0 0" />
@@ -31,22 +31,22 @@
TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
<!--<ExperimentalAcrylicBorder IsHitTestVisible="False"
<ExperimentalAcrylicBorder IsHitTestVisible="False"
DockPanel.Dock="Right">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial TintColor="{DynamicResource BackgroundColorKey}"
MaterialOpacity="{ReflectionBinding Value,Source={x:Static ms:UISettings.AcrylicOpacity},Mode=OneWay}"
TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>-->
<ExperimentalAcrylicBorder IsHitTestVisible="False"
</ExperimentalAcrylicBorder>
<!--<ExperimentalAcrylicBorder IsHitTestVisible="False"
DockPanel.Dock="Right">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial TintColor="{DynamicResource ThemeColorKey}"
MaterialOpacity="{ReflectionBinding Value,Source={x:Static ms:UISettings.AcrylicOpacity},Mode=OneWay}"
TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
</ExperimentalAcrylicBorder>-->
</DockPanel>
<!--Content-->
@@ -54,8 +54,8 @@
Margin="{StaticResource TitleBarAfterMargin}"
Background="Transparent"
PaneDisplayMode="Left"
IsPaneOpen="False"
AlwaysShowHeader="False"
IsPaneOpen="{ReflectionBinding Source={x:Static ms:UISettings.MainMenuExpandedState},Path=Value,Mode=TwoWay}"
AlwaysShowHeader="True"
IsSettingsVisible="False"
OpenPaneLength="240"
MenuItems="{Binding TabItems}"
@@ -63,6 +63,14 @@
IsBackButtonVisible="False"
IsBackEnabled="{Binding #frame.CanGoBack}"
SelectedItem="{Binding SelectedItem}">
<!--<ui:NavigationView.Styles>
<Style Selector="ui|NavigationView:minimal /template/ SplitView Rectangle#ContentLeftPadding">
<Setter Property="Grid.Row" Value="0" />
</Style>
<Style Selector="ui|NavigationView:minimal /template/ SplitView Rectangle#ContentTopPadding">
<Setter Property="IsVisible" Value="False" />
</Style>
</ui:NavigationView.Styles>-->
<!--<ui:NavigationView.PaneHeader>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="110" VerticalAlignment="Top">
<Image Source="/Application/UI/Assets/Icon.ico" Height="64" Width="64" VerticalAlignment="Center" Margin="-8,0,0,0"/>
@@ -71,7 +79,7 @@
</ui:NavigationView.PaneHeader>-->
<ui:NavigationView.Content>
<ui:Frame x:Name="frame" DataContext="{Binding SelectedItem}">
<ui:Frame x:Name="frame" DataContext="{Binding SelectedItem}" Margin="-10 0 0 0">
<ui:Frame.DataTemplates>
<DataTemplate DataType="vm:ProxyScriptManagePageViewModel">
<pages:ProxyScriptManagePage/>
@@ -9,10 +9,8 @@
mc:Ignorable="d"
d:DesignWidth="800" d:DesignHeight="450"
x:Class="System.Application.UI.Views.Pages.AboutPage">
<Border Classes="paper"
Margin="10"
Padding="0 10"
Background="{DynamicResource ThemeBrushKey}">
<Border
Padding="0 10">
<TabControl Classes="flat">
<TabItem Header="{ReflectionBinding Path=Res.About_ThisSoft,Mode=OneWay,Source={x:Static resx:R.Current}}">
<pages:About_SoftwarePage>
@@ -10,7 +10,8 @@
mc:Ignorable="d"
d:DesignWidth="800" d:DesignHeight="450"
x:Class="System.Application.UI.Views.Pages.DebugPage">
<Grid RowDefinitions="*,Auto">
<Grid RowDefinitions="*,Auto"
Margin="10">
<TextBox Grid.Row="0" Text="{Binding DebugString}" AcceptsReturn="True" />
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Height="35" MinWidth="200" Content="Debug Button"
@@ -431,7 +431,7 @@
<ia:InvokeCommandAction Command="{ReflectionBinding #u.DataContext.AppClick}" CommandParameter="{Binding}"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>-->
<Border CornerRadius="9"
<Border CornerRadius="{DynamicResource ControlCornerRadius}"
ClipToBounds="True">
<Panel
Width="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=OneWay}">
@@ -7,10 +7,9 @@
xmlns:pages="using:System.Application.UI.Views.Pages"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="System.Application.UI.Views.Pages.SettingsPage">
<Border Classes="paper"
Margin="10"
Padding="0 10"
Background="{DynamicResource ThemeBrushKey}">
<Border
Margin="0"
Padding="0 10">
<TabControl Classes="flat">
<TabControl.Styles>
<Style Selector="ScrollViewer.tabscroll">
@@ -22,7 +22,6 @@
Margin="{StaticResource TitleBarAfterMargin}">
<DockPanel LastChildFill="True">
<Button Content="保存"
Classes="action"
Margin="10"
Height="40"
FontSize="16"
@@ -17,43 +17,10 @@
x:CompileBindings="True">
<Panel>
<controls:TitleBar DockPanel.Dock="Top"></controls:TitleBar>
<Border Classes="paper"
Background="{DynamicResource ThemeBrushKey}"
<Border Background="{DynamicResource ThemeBrushKey}"
Margin="{StaticResource TitleBarAfterMargin}">
<ScrollViewer Padding="10">
<StackPanel Spacing="20">
<StackPanel.Styles>
<Style Selector="Expander">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
<Style Selector="DockPanel > Label">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0 0 0 5" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="(DockPanel.Dock)" Value="Top"></Setter>
</Style>
<Style Selector="DockPanel > TextBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="(DockPanel.Dock)" Value="Bottom"></Setter>
</Style>
<Style Selector="DockPanel > ui|ComboBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="(DockPanel.Dock)" Value="Bottom"></Setter>
</Style>
<Style Selector="DockPanel > TextBlock">
<Setter Property="Margin" Value="0 0 20 0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="(DockPanel.Dock)" Value="Left" />
</Style>
<Style Selector="DockPanel > ToggleSwitch">
<Setter Property="Margin" Value="0 0 -12 0" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="OnContent" Value="{x:Null}" />
<Setter Property="OffContent" Value="{x:Null}" />
</Style>
</StackPanel.Styles>
<StackPanel Spacing="20" Classes="Settings">
<Expander Header="加速设置" IsExpanded="True">
<StackPanel Spacing="10">
<DockPanel>
@@ -69,7 +36,8 @@
</DockPanel>
<DockPanel>
<Label Content="监听端口"></Label>
<TextBox Text="{ReflectionBinding Source={x:Static ms:ProxySettings.HostProxyPortId},Path=Value, Mode=TwoWay}"></TextBox>
<NumericUpDown Value="{ReflectionBinding Source={x:Static ms:ProxySettings.HostProxyPortId},Path=Value, Mode=TwoWay}"
Maximum="65535"/>
</DockPanel>
<DockPanel>
<TextBlock Text="{ReflectionBinding Path=Res.CommunityFix_AutoRunProxy,Mode=OneWay,Source={x:Static resx:R.Current}}" ></TextBlock>
@@ -94,13 +62,19 @@
</StackPanel>
</Expander>
<Expander Header="Socks5本地代理" IsExpanded="True">
<Expander IsExpanded="True">
<Expander.Header>
<DockPanel HorizontalAlignment="Stretch">
<TextBlock Text="Socks5本地代理"/>
<ToggleSwitch IsChecked="{ReflectionBinding Source={x:Static ms:ProxySettings.Socks5ProxyEnable},Path=Value, Mode=TwoWay}"/>
</DockPanel>
</Expander.Header>
<StackPanel Spacing="10">
<DockPanel>
<!--<DockPanel>
<TextBlock Text="启用" ></TextBlock>
<ToggleSwitch
IsChecked="{ReflectionBinding Source={x:Static ms:ProxySettings.Socks5ProxyEnable},Path=Value, Mode=TwoWay}"/>
</DockPanel>
</DockPanel>-->
<DockPanel>
<Label Content="监听端口"></Label>
<NumericUpDown Maximum="65535"
@@ -109,18 +83,23 @@
</StackPanel>
</Expander>
<Expander Header="二级代理" IsExpanded="True">
<Expander IsExpanded="True">
<Expander.Header>
<DockPanel HorizontalAlignment="Stretch">
<TextBlock Text="二级代理"/>
<ToggleSwitch IsChecked="{ReflectionBinding Source={x:Static ms:ProxySettings.TwoLevelAgentEnable},Path=Value, Mode=TwoWay}"/>
</DockPanel>
</Expander.Header>
<StackPanel Spacing="10">
<DockPanel>
<!--<DockPanel>
<TextBlock Text="启用" ></TextBlock>
<ToggleSwitch
IsChecked="{ReflectionBinding Source={x:Static ms:ProxySettings.TwoLevelAgentEnable},Path=Value, Mode=TwoWay}"/>
</DockPanel>
</DockPanel>-->
<DockPanel>
<Label Content="代理类型"></Label>
<ComboBox HorizontalAlignment="Stretch"
Items="{Binding ProxyTypes}"
<ComboBox Items="{Binding ProxyTypes}"
SelectedIndex="{ReflectionBinding Source={x:Static ms:ProxySettings.TwoLevelAgentProxyType},Path=Value, Mode=TwoWay}"/>
</DockPanel>
+6
View File
@@ -139,5 +139,11 @@ namespace System.Application.Settings
/// </summary>
public static SerializableProperty<bool> GetUserThemeAccent { get; }
= GetProperty(defaultValue: true, autoSave: true);
/// <summary>
/// 主菜单展开状态
/// </summary>
public static SerializableProperty<bool> MainMenuExpandedState { get; }
= GetProperty(defaultValue: false, autoSave: true);
}
}