This commit is contained in:
rmbgame
2021-04-21 01:20:46 +08:00
parent d3b127eef1
commit df7596cfe4
25 changed files with 308 additions and 322 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
</Application.DataTemplates>
<Application.Resources>
<converters:IsNullConverter x:Key="IsNullConverter" />
<converters:CardTitleToPlaceholderConverter x:Key="CardTitleToPlaceholderConverter" />
<converters:NameToFontFamilyConverter x:Key="NameToFontFamilyConverter" />
<converters:DrawingKeyValueConverter x:Key="DrawingKeyValueConverter" />
<converters:BitmapAssetValueConverter x:Key="BitmapAssetValueConverter" />
<converters:ReverseBooleanConverter x:Key="ReverseBooleanConverter" />
@@ -15,7 +15,7 @@ namespace System.Application.UI
// yet and stuff might break.
[STAThread]
static int Main(string[] args)
{
{
// 目前桌面端默认使用 SystemTextJson 如果出现兼容性问题可取消下面这行代码
// Serializable.DefaultJsonImplType = Serializable.JsonImplType.NewtonsoftJson;
Startup.IsMainProcess = args.Length == 0;
@@ -1,51 +0,0 @@
using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
namespace System.Application.Converters
{
public class CardTitleToPlaceholderConverter : IValueConverter
{
private static readonly (Color StartColor, Color EndColor)[] placeholderColors =
{
(Color.Parse("#38ADAE"), Color.Parse("#CD295A")),
(Color.Parse("#F1EAB9"), Color.Parse("#FF8C8C")),
(Color.Parse("#C6EA8D"), Color.Parse("#FE90AF")),
(Color.Parse("#EA8D8D"), Color.Parse("#A890FE")),
(Color.Parse("#D8B5FF"), Color.Parse("#1EAE98")),
(Color.Parse("#FF61D2"), Color.Parse("#FE9090")),
(Color.Parse("#BFF098"), Color.Parse("#6FD6FF")),
(Color.Parse("#4E65FF"), Color.Parse("#92EFFD")),
(Color.Parse("#A9F1DF"), Color.Parse("#FFBBBB"))
};
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string s)
{
var selector = s.Select(x => (uint) x)
.Aggregate((x, y) => x ^ y) % (uint) placeholderColors.Length;
return new LinearGradientBrush
{
StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative),
EndPoint = new RelativePoint(1, 1, RelativeUnit.Relative),
GradientStops = new GradientStops
{
new GradientStop(placeholderColors[selector].StartColor, 0),
new GradientStop(placeholderColors[selector].EndColor, 1)
}
};
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,27 @@
using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
namespace System.Application.Converters
{
public class NameToFontFamilyConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string s)
{
if (string.IsNullOrEmpty(s) || s.Equals("Default", StringComparison.OrdinalIgnoreCase))
return new FontFamily(FontManager.Current.DefaultFontFamilyName);
return new FontFamily(s);
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -11,7 +11,6 @@
x:Class="System.Application.UI.Views.Controls.PaperView">
<UserControl.Resources>
<converters:IsNullConverter x:Key="IsNullConverter" />
<converters:CardTitleToPlaceholderConverter x:Key="CardTitleToPlaceholderConverter" />
</UserControl.Resources>
<StackPanel Margin="20" Spacing="8">
<DockPanel LastChildFill="True">
@@ -7,159 +7,161 @@
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:service="clr-namespace:System.Application.Services;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
x:Class="System.Application.UI.Views.MainView"
FontSize="14"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
x:DataType="vm:MainWindowViewModel"
x:CompileBindings="True">
<Panel>
<!--Background-->
<DockPanel HorizontalAlignment="Stretch">
<ExperimentalAcrylicBorder IsHitTestVisible="False" DockPanel.Dock="Left" Width="240">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial TintColor="{DynamicResource BackgroundColorKey}" MaterialOpacity="0.80" TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
<ExperimentalAcrylicBorder IsHitTestVisible="False">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial TintColor="{DynamicResource ThemeColorKey}" MaterialOpacity="0.80" TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
</DockPanel>
<Panel>
<!--Background-->
<DockPanel HorizontalAlignment="Stretch">
<ExperimentalAcrylicBorder IsHitTestVisible="False" DockPanel.Dock="Left" Width="240">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial TintColor="{DynamicResource BackgroundColorKey}" MaterialOpacity="0.80" TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
<ExperimentalAcrylicBorder IsHitTestVisible="False">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial TintColor="{DynamicResource ThemeColorKey}" MaterialOpacity="0.80" TintOpacity="1"/>
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
</DockPanel>
<!--Title-->
<Grid ColumnDefinitions="240,*,Auto" ZIndex="0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="110" VerticalAlignment="Top">
<Image Source="/Application/UI/Assets/Icon9.ico" Height="64" Width="64" VerticalAlignment="Center" Margin="-8,0,0,0"/>
<Label Content="{ReflectionBinding Path=Title}" Foreground="{DynamicResource HighlightForegroundBrushKey}" VerticalContentAlignment="Center" FontSize="20" Margin="8,0,0,0"/>
</StackPanel>
<TextBlock IsHitTestVisible="False" Grid.Column="1" Text="{ReflectionBinding SelectedItem.Name}" Foreground="{DynamicResource HighlightForegroundBrushKey}" Padding="15 8 0 0" FontSize="28"/>
<StackPanel Grid.Column="2" x:Name="titleMenu" Orientation="Horizontal" VerticalAlignment="Top">
<!--<Menu Items="{Binding SelectedItem.MenuItems}" IsVisible="{Binding !SelectedItem.MenuItems,Converter={StaticResource IsNullConverter}}" Classes="BindMenu">
</Menu>-->
<Menu Classes="BindMenu">
<MenuItem Items="{Binding SelectedItem.MenuItems}" Classes="BindItem"
IsVisible="{Binding !SelectedItem.MenuItems,Converter={StaticResource IsNullConverter}}">
<MenuItem.Header>
<PathIcon Data="{StaticResource SettingsDrawing}" Width="14"></PathIcon>
</MenuItem.Header>
</MenuItem>
<MenuItem x:Name="userBtn" Command="{Binding OpenUserMenu}">
<MenuItem.Header>
<Image Source="/Application/UI/Assets/Icon9.ico" Height="20" Width="20">
<Image.Clip>
<EllipseGeometry Rect="0,0,20,20" />
</Image.Clip>
</Image>
</MenuItem.Header>
</MenuItem>
</Menu>
<Popup IsOpen="{Binding IsOpenUserMenu,Mode=TwoWay, FallbackValue=False}"
StaysOpen="False" Width="300"
PlacementTarget="userBtn"
HorizontalOffset="-250"
IsLightDismissEnabled="True">
<Border Background="{DynamicResource ThemeBrushKey}"
HorizontalAlignment="Stretch"
CornerRadius="{DynamicResource OverlayCornerRadius}">
<StackPanel>
<Panel Width="200" Margin="5">
<StackPanel Spacing="8">
<Image Source="/Application/UI/Assets/Icon9.ico" Height="100" Width="100" HorizontalAlignment="Center">
<Image.Clip>
<EllipseGeometry Rect="0,0,100,100" />
</Image.Clip>
</Image>
<Button
Content="{ReflectionBinding Path=User.NickName,Source={x:Static service:UserService.Current}}"
FontSize="16"
HorizontalAlignment="Center"
Foreground="{DynamicResource HighlightForegroundBrushKey}"></Button>
</StackPanel>
</Panel>
<ListBox SelectionMode="Single" Background="{DynamicResource ThemeBrushKey}">
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.UserProfile,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="UserProfile"></Button>
</ListBoxItem>
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.User_ChangePhoneNum,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="ChangeBindPhoneNumber"></Button>
</ListBoxItem>
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.DelAccount,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="ChangeBindPhoneNumber"></Button>
</ListBoxItem>
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.SignOut,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=SignOut,Source={x:Static service:UserService.Current}}"></Button>
</ListBoxItem>
</ListBox>
<!--Title-->
<Grid ColumnDefinitions="240,*,Auto" ZIndex="0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="110" VerticalAlignment="Top">
<Image Source="/Application/UI/Assets/Icon9.ico" Height="64" Width="64" VerticalAlignment="Center" Margin="-8,0,0,0"/>
<Label Content="{ReflectionBinding Path=Title}" Foreground="{DynamicResource HighlightForegroundBrushKey}" VerticalContentAlignment="Center" FontSize="20" Margin="8,0,0,0"/>
</StackPanel>
</Border>
</Popup>
</StackPanel>
</Grid>
<TextBlock IsHitTestVisible="False" Grid.Column="1" Text="{ReflectionBinding SelectedItem.Name}" Foreground="{DynamicResource HighlightForegroundBrushKey}" Padding="15 8 0 0" FontSize="28"/>
<StackPanel Grid.Column="2" x:Name="titleMenu" Orientation="Horizontal" VerticalAlignment="Top">
<!--<Menu Items="{Binding SelectedItem.MenuItems}" IsVisible="{Binding !SelectedItem.MenuItems,Converter={StaticResource IsNullConverter}}" Classes="BindMenu">
</Menu>-->
<Menu Classes="BindMenu">
<MenuItem Items="{Binding SelectedItem.MenuItems}" Classes="BindItem"
IsVisible="{Binding !SelectedItem.MenuItems,Converter={StaticResource IsNullConverter}}">
<MenuItem.Header>
<PathIcon Data="{StaticResource SettingsDrawing}" Width="14"></PathIcon>
</MenuItem.Header>
</MenuItem>
<!--Content-->
<TabControl
Items="{Binding TabItems}"
SelectedItem="{Binding SelectedItem}"
Margin="0 25 0 0"
Classes="NavBar">
<TabControl.DataTemplates>
<DataTemplate DataType="vm:DebugWebViewPageViewModel">
<pages:DebugWebViewPage/>
</DataTemplate>
<DataTemplate DataType="vm:ProxyScriptManagePageViewModel">
<pages:ProxyScriptManagePage/>
</DataTemplate>
<DataTemplate DataType="vm:DebugPageViewModel">
<pages:DebugPage/>
</DataTemplate>
<DataTemplate DataType="vm:AboutPageViewModel">
<pages:AboutPage/>
</DataTemplate>
<DataTemplate DataType="vm:SettingsPageViewModel">
<pages:SettingsPage/>
</DataTemplate>
<DataTemplate DataType="vm:StartPageViewModel">
<pages:StartPage/>
</DataTemplate>
<DataTemplate DataType="vm:SteamAccountPageViewModel">
<pages:SteamAccountPage/>
</DataTemplate>
<DataTemplate DataType="vm:GameListPageViewModel">
<pages:GameListPage/>
</DataTemplate>
<DataTemplate DataType="vm:CommunityProxyPageViewModel">
<pages:CommunityProxyPage/>
</DataTemplate>
<DataTemplate DataType="vm:LocalAuthPageViewModel">
<pages:LocalAuthPage/>
</DataTemplate>
</TabControl.DataTemplates>
<TabControl.ItemTemplate>
<DataTemplate>
<!--<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="Regular">
<MenuItem x:Name="userBtn" Command="{Binding OpenUserMenu}">
<MenuItem.Header>
<Image Source="/Application/UI/Assets/Icon9.ico" Height="20" Width="20">
<Image.Clip>
<EllipseGeometry Rect="0,0,20,20" />
</Image.Clip>
</Image>
</MenuItem.Header>
</MenuItem>
</Menu>
<Popup IsOpen="{Binding IsOpenUserMenu,Mode=TwoWay, FallbackValue=False}"
StaysOpen="False" Width="300"
PlacementTarget="userBtn"
HorizontalOffset="-250"
IsLightDismissEnabled="True">
<Border Background="{DynamicResource ThemeBrushKey}"
HorizontalAlignment="Stretch"
CornerRadius="{DynamicResource OverlayCornerRadius}">
<StackPanel>
<Panel Width="200" Margin="5">
<StackPanel Spacing="8">
<Image Source="/Application/UI/Assets/Icon9.ico" Height="100" Width="100" HorizontalAlignment="Center">
<Image.Clip>
<EllipseGeometry Rect="0,0,100,100" />
</Image.Clip>
</Image>
<Button
Content="{ReflectionBinding Path=User.NickName,Source={x:Static service:UserService.Current}}"
FontSize="16"
HorizontalAlignment="Center"
Foreground="{DynamicResource HighlightForegroundBrushKey}"></Button>
</StackPanel>
</Panel>
<ListBox SelectionMode="Single" Background="{DynamicResource ThemeBrushKey}">
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.UserProfile,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="UserProfile"></Button>
</ListBoxItem>
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.User_ChangePhoneNum,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="ChangeBindPhoneNumber"></Button>
</ListBoxItem>
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.DelAccount,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=ShowWindow,Source={x:Static service:UserService.Current}}"
CommandParameter="ChangeBindPhoneNumber"></Button>
</ListBoxItem>
<ListBoxItem>
<Button
Classes="CodeButton"
Content="{ReflectionBinding Path=Res.SignOut,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding Path=SignOut,Source={x:Static service:UserService.Current}}"></Button>
</ListBoxItem>
</ListBox>
</StackPanel>
</Border>
</Popup>
</StackPanel>
</Grid>
<!--Content-->
<TabControl
Items="{Binding TabItems}"
SelectedItem="{Binding SelectedItem}"
Margin="0 25 0 0"
Classes="NavBar">
<TabControl.DataTemplates>
<DataTemplate DataType="vm:DebugWebViewPageViewModel">
<pages:DebugWebViewPage/>
</DataTemplate>
<DataTemplate DataType="vm:ProxyScriptManagePageViewModel">
<pages:ProxyScriptManagePage/>
</DataTemplate>
<DataTemplate DataType="vm:DebugPageViewModel">
<pages:DebugPage/>
</DataTemplate>
<DataTemplate DataType="vm:AboutPageViewModel">
<pages:AboutPage/>
</DataTemplate>
<DataTemplate DataType="vm:SettingsPageViewModel">
<pages:SettingsPage/>
</DataTemplate>
<DataTemplate DataType="vm:StartPageViewModel">
<pages:StartPage/>
</DataTemplate>
<DataTemplate DataType="vm:SteamAccountPageViewModel">
<pages:SteamAccountPage/>
</DataTemplate>
<DataTemplate DataType="vm:GameListPageViewModel">
<pages:GameListPage/>
</DataTemplate>
<DataTemplate DataType="vm:CommunityProxyPageViewModel">
<pages:CommunityProxyPage/>
</DataTemplate>
<DataTemplate DataType="vm:LocalAuthPageViewModel">
<pages:LocalAuthPage/>
</DataTemplate>
</TabControl.DataTemplates>
<TabControl.ItemTemplate>
<DataTemplate>
<!--<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="Regular">
</TextBlock>-->
<controls:ScrollingTextBlock Text="{Binding Name}" FontSize="14" FontWeight="Regular"></controls:ScrollingTextBlock>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
<!--Toast-->
<controls:ToastMessage VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
</Panel>
<controls:ScrollingTextBlock Text="{Binding Name}" FontSize="14" FontWeight="Regular"></controls:ScrollingTextBlock>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
<!--Toast-->
<controls:ToastMessage VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
</Panel>
</UserControl>
@@ -95,13 +95,19 @@
<CheckBox IsChecked="{Binding Enable}"
VerticalAlignment="Center">
<WrapPanel>
<WrapPanel.Styles>
<Style Selector="TextBlock.count">
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="FontSize" Value="12"></Setter>
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}"></Setter>
</Style>
</WrapPanel.Styles>
<TextBlock Text="{Binding Name_Localiza}"
VerticalAlignment="Center"/>
<TextBlock Margin="5 0 0 0"
Text="{Binding Count}"
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource InactiveForegroundBrushKey}"/>
<TextBlock Margin="5 0 0 0" Text="(" Classes="count"/>
<TextBlock Classes="count"
Text="{Binding Count}"/>
<TextBlock Classes="count" Text=")"/>
</WrapPanel>
</CheckBox>
</DockPanel>
@@ -32,7 +32,17 @@
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Steam_AutoRunSteam,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ToggleSwitch IsChecked="{ReflectionBinding Source={x:Static ms:SteamSettings.IsAutoRunSteam},Path=Value, Mode=TwoWay}" />
</DockPanel>
<DockPanel>
<TextBlock Text="最小化启动Steam"/>
<ToggleSwitch />
</DockPanel>
<DockPanel>
<TextBlock Text="Steam启动时不检查更新"/>
<ToggleSwitch />
</DockPanel>
<StackPanel Spacing="10">
<TextBlock Text= "{ReflectionBinding Path=Res.Settings_Steam_SteamStratParameter,Mode=OneWay,Source={x:Static resx:R.Current}}" />
<TextBox Watermark="" Text="{ReflectionBinding Source={x:Static ms:SteamSettings.SteamStratParameter},Path=Value, Mode=TwoWay}"></TextBox>
@@ -7,55 +7,58 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="System.Application.UI.Views.Pages.Settings_UI">
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Spacing="20">
<StackPanel.Styles>
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource HighlightForegroundBrushKey}" />
</Style>
<Style Selector="DockPanel > TextBlock">
<Setter Property="Margin" Value="0 8 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 Orientation="Vertical" Spacing="10">
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Language,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBox HorizontalAlignment="Stretch" SelectedItem="{Binding SelectLanguage, Mode=TwoWay}" Items="{Binding Mode=OneWay,Source={x:Static resx:R.Languages}}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value,Mode=OneWay}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Spacing="20">
<StackPanel.Styles>
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource HighlightForegroundBrushKey}" />
</Style>
<Style Selector="DockPanel > TextBlock">
<Setter Property="Margin" Value="0 8 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 Orientation="Vertical" Spacing="10">
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Language,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBox HorizontalAlignment="Stretch" SelectedItem="{Binding SelectLanguage, Mode=TwoWay}" Items="{Binding Mode=OneWay,Source={x:Static resx:R.Languages}}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value,Mode=OneWay}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Vertical" Spacing="10">
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Theme,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBox x:Name="Themes"
SelectedIndex="{Binding Source={x:Static ms:UISettings.Theme},Path=Value, Mode=TwoWay}"
HorizontalAlignment="Stretch">
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_SystemDefault,Mode=OneWay,Source={x:Static resx:R.Current}}"></ComboBoxItem>
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_Light,Mode=OneWay,Source={x:Static resx:R.Current}}"></ComboBoxItem>
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_Dark,Mode=OneWay,Source={x:Static resx:R.Current}}"></ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Vertical" Spacing="10">
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Fonts,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBox
Items="{Binding Mode=OneWay,Source={x:Static resx:R.Fonts}}"
SelectedItem="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=TwoWay}"
HorizontalAlignment="Stretch">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding .,Mode=OneWay}"
FontFamily="{Binding .,Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<Separator BorderThickness=".88" Background="{DynamicResource SystemControlHighlightBaseLowBrush}"/>
</StackPanel>
<StackPanel Orientation="Vertical" Spacing="10">
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Theme,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBox x:Name="Themes"
SelectedIndex="{Binding Source={x:Static ms:UISettings.Theme},Path=Value, Mode=TwoWay}"
HorizontalAlignment="Stretch">
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_SystemDefault,Mode=OneWay,Source={x:Static resx:R.Current}}"></ComboBoxItem>
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_Light,Mode=OneWay,Source={x:Static resx:R.Current}}"></ComboBoxItem>
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_Dark,Mode=OneWay,Source={x:Static resx:R.Current}}"></ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Vertical" Spacing="10">
<TextBlock Text="{ReflectionBinding Path=Res.Settings_Fonts,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBox SelectedItem="{Binding SelectFont, Mode=TwoWay}" Items="{Binding Mode=OneWay,Source={x:Static resx:R.Fonts}}"
HorizontalAlignment="Stretch">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key,Mode=OneWay}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<Separator BorderThickness=".88" Background="{DynamicResource SystemControlHighlightBaseLowBrush}"/>
</StackPanel>
</UserControl>
@@ -8,6 +8,8 @@
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:service="clr-namespace:System.Application.Services;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Width="800" Height="600"
WindowStartupLocation="CenterOwner"
ExtendClientAreaToDecorationsHint="True"
@@ -10,6 +10,8 @@
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:i="using:Avalonia.Xaml.Interactivity"
xmlns:ia="using:Avalonia.Xaml.Interactions.Core"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
@@ -12,6 +12,8 @@
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ccl_services="clr-namespace:System.Application.Services;assembly=System.Application.SteamTools.Client"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
@@ -26,7 +26,7 @@ namespace Avalonia.Controls
void Constructor()
{
this.SetDefaultFontFamily();
//this.SetDefaultFontFamily();
ExtendClientAreaToDecorationsHint = true;
ExtendClientAreaTitleBarHeightHint = -1;
@@ -12,6 +12,8 @@
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ccl_services="clr-namespace:System.Application.Services;assembly=System.Application.SteamTools.Client"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
@@ -7,6 +7,8 @@
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
UseLayoutRounding="True"
WindowStartupLocation="CenterOwner"
SizeToContent="WidthAndHeight"
@@ -8,6 +8,8 @@
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
@@ -8,6 +8,8 @@
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
@@ -13,6 +13,8 @@
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ccl_services="clr-namespace:System.Application.Services;assembly=System.Application.SteamTools.Client"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
@@ -60,6 +60,9 @@ namespace System.Application.Models
[Description("SteamAppType_Mod")]
Mod = 18,
[Description("SteamAppType_Beta")]
Beta = 19,
}
#if DEBUG
@@ -39,6 +39,12 @@ namespace System.Application.Models.Settings
public static SerializableProperty<string> Language { get; }
= new SerializableProperty<string>(GetKey(), Providers.Local, "") { AutoSave = true };
/// <summary>
/// ×ÖÌå
/// </summary>
public static SerializableProperty<string> FontName { get; }
= new SerializableProperty<string>(GetKey(), Providers.Local, "Default") { AutoSave = true };
private static string GetKey([CallerMemberName] string propertyName = "")
{
return nameof(UISettings) + "." + propertyName;
+9
View File
@@ -1511,6 +1511,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 测试 的本地化字符串。
/// </summary>
public static string SteamAppType_Beta {
get {
return ResourceManager.GetString("SteamAppType_Beta", resourceCulture);
}
}
/// <summary>
/// 查找类似 配置 的本地化字符串。
/// </summary>
@@ -121,52 +121,52 @@
<value>About</value>
</data>
<data name="CommunityFix" xml:space="preserve">
<value>Fix Steam 302 Error</value>
<value>Community acceleration</value>
</data>
<data name="GameList" xml:space="preserve">
<value>My Games</value>
<value>Stock game</value>
</data>
<data name="GameRelated" xml:space="preserve">
<value>Game Related</value>
<value>Game features</value>
</data>
<data name="Hosts_Exists" xml:space="preserve">
<value>The written hosts already exist</value>
</data>
<data name="Hosts_ReadError" xml:space="preserve">
<value>An error occurred while reading the hosts file</value>
<value>There was an error reading the hosts file</value>
</data>
<data name="Hosts_ReadSuccess" xml:space="preserve">
<value>Read hosts successfully</value>
</data>
<data name="Hosts_UpdateSuccess" xml:space="preserve">
<value>Write hosts successfully</value>
<value>The write hosts succeeded</value>
</data>
<data name="Hosts_WirteError" xml:space="preserve">
<value>Error writing to hosts</value>
<value>An error occurred while writing hosts</value>
</data>
<data name="Language" xml:space="preserve">
<value>Language</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Settings</value>
<value>Set up</value>
</data>
<data name="Settings_Auth" xml:space="preserve">
<value>Auth Settings</value>
<value>Token settings</value>
</data>
<data name="Settings_General" xml:space="preserve">
<value>General Settings</value>
<value>Basic settings</value>
</data>
<data name="SteamAuth" xml:space="preserve">
<value>Steam Auth</value>
</data>
<data name="UserFastChange" xml:space="preserve">
<value>Account Change</value>
<value>Account switching</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Welcome" xml:space="preserve">
<value>Start Page</value>
<value>The start page</value>
</data>
<data name="About_FAQ" xml:space="preserve">
<value>FAQ troubleshooting</value>
@@ -195,9 +195,6 @@
<data name="CloudSync" xml:space="preserve">
<value>Cloud sync</value>
</data>
<data name="CommunityFix" xml:space="preserve">
<value>Community acceleration</value>
</data>
<data name="Confirm" xml:space="preserve">
<value>Are you sure</value>
</data>
@@ -219,27 +216,6 @@
<data name="Export" xml:space="preserve">
<value>Export</value>
</data>
<data name="GameList" xml:space="preserve">
<value>Stock game</value>
</data>
<data name="GameRelated" xml:space="preserve">
<value>Game features</value>
</data>
<data name="Hosts_Exists" xml:space="preserve">
<value>The written hosts already exist</value>
</data>
<data name="Hosts_ReadError" xml:space="preserve">
<value>There was an error reading the hosts file</value>
</data>
<data name="Hosts_ReadSuccess" xml:space="preserve">
<value>Read hosts successfully</value>
</data>
<data name="Hosts_UpdateSuccess" xml:space="preserve">
<value>The write hosts succeeded</value>
</data>
<data name="Hosts_WirteError" xml:space="preserve">
<value>An error occurred while writing hosts</value>
</data>
<data name="IdleCard" xml:space="preserve">
<value>Automatic set card</value>
</data>
@@ -375,15 +351,6 @@
<data name="SelectFileImport" xml:space="preserve">
<value>Select {0} file import</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Set up</value>
</data>
<data name="Settings_Auth" xml:space="preserve">
<value>Token settings</value>
</data>
<data name="Settings_General" xml:space="preserve">
<value>Basic settings</value>
</data>
<data name="Settings_Language" xml:space="preserve">
<value>Language</value>
</data>
@@ -423,13 +390,7 @@
<data name="UserChange_OfflineBtn" xml:space="preserve">
<value>Offline mode starts</value>
</data>
<data name="UserFastChange" xml:space="preserve">
<value>Account switching</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Welcome" xml:space="preserve">
<value>The start page</value>
<data name="Settings_UI_SystemDefault" xml:space="preserve">
<value>Default System</value>
</data>
</root>
@@ -593,6 +593,9 @@
<data name="SteamAppType_Application" xml:space="preserve">
<value>软件</value>
</data>
<data name="SteamAppType_Beta" xml:space="preserve">
<value>测试</value>
</data>
<data name="SteamAppType_Config" xml:space="preserve">
<value>配置</value>
</data>
+5 -6
View File
@@ -13,9 +13,9 @@ namespace System.Application.UI.Resx
{
public static R Current { get; }
public static readonly IList<KeyValuePair<string, string>> Languages;
public static readonly IReadOnlyCollection<KeyValuePair<string, string>> Languages;
public static readonly Dictionary<string, string> SteamLanguages;
public static readonly IList<KeyValuePair<string, FontFamily?>> Fonts;
public static readonly IReadOnlyCollection<string> Fonts;
public AppResources Res { get; set; } = new AppResources();
@@ -49,13 +49,12 @@ namespace System.Application.UI.Resx
AppResources.Culture = DefaultCurrentUICulture;
}
static IList<KeyValuePair<string, FontFamily?>> GetFonts()
static IReadOnlyCollection<string> GetFonts()
{
var culture = Culture;
InstalledFontCollection ifc = new();
var list = ifc.Families.Select(x =>
KeyValuePair.Create(x.GetName(culture.LCID), (FontFamily?)x)).ToList();
list.Insert(0, KeyValuePair.Create("Default", (FontFamily?)null));
var list = ifc.Families.Select(x => x.GetName(culture.LCID)).ToList();
list.Insert(0, "Default");
return list;
}
@@ -25,13 +25,6 @@ namespace System.Application.UI.ViewModels
protected set => this.RaiseAndSetIfChanged(ref _SelectLanguage, value);
}
KeyValuePair<string, FontFamily?> _SelectFont;
public KeyValuePair<string, FontFamily?> SelectFont
{
get => _SelectFont;
protected set => this.RaiseAndSetIfChanged(ref _SelectFont, value);
}
public SettingsPageViewModel()
{
IconKey = nameof(SettingsPageViewModel).Replace("ViewModel", "Svg");