mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 12:52:08 +08:00
1.1.3 -> 1.1.4 第30次更新
This commit is contained in:
parent
be23d1bce8
commit
c8bffaa96c
33
App.config
Normal file
33
App.config
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="Sheas_Cealer.Props.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
<userSettings>
|
||||||
|
<Sheas_Cealer.Props.Settings>
|
||||||
|
<setting name="BrowserPath" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="UpstreamUrl" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="ExtraArgs" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="IsLightTheme" serializeAs="String">
|
||||||
|
<value>-1</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="IsEnglishLang" serializeAs="String">
|
||||||
|
<value>-1</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="PrimaryColor" serializeAs="String">
|
||||||
|
<value>Red</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="IsLightWeight" serializeAs="String">
|
||||||
|
<value>-1</value>
|
||||||
|
</setting>
|
||||||
|
</Sheas_Cealer.Props.Settings>
|
||||||
|
</userSettings>
|
||||||
|
</configuration>
|
38
Consts/SettingsMultilangConst.Designer.cs
generated
38
Consts/SettingsMultilangConst.Designer.cs
generated
@ -70,7 +70,7 @@ namespace Sheas_Cealer.Consts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Switch Color (Fully random) 的本地化字符串。
|
/// 查找类似 Switch Color (Fully Random) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ColorsButtonContent {
|
public static string ColorsButtonContent {
|
||||||
get {
|
get {
|
||||||
@ -158,5 +158,41 @@ namespace Sheas_Cealer.Consts {
|
|||||||
return ResourceManager.GetString("ThemesButtonToolTip", resourceCulture);
|
return ResourceManager.GetString("ThemesButtonToolTip", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Switch Weight (Bold → Light) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string WeightsButtonBoldWeightContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("WeightsButtonBoldWeightContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Switch Weight (Light → Regular) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string WeightsButtonLightWeightContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("WeightsButtonLightWeightContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Switch Weight (Regular → Bold) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string WeightsButtonRegularWeightContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("WeightsButtonRegularWeightContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Click to switch font weights 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string WeightsButtonToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("WeightsButtonToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="ColorsButtonContent" xml:space="preserve">
|
<data name="ColorsButtonContent" xml:space="preserve">
|
||||||
<value>Switch Color (Fully random)</value>
|
<value>Switch Color (Fully Random)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ColorsButtonToolTip" xml:space="preserve">
|
<data name="ColorsButtonToolTip" xml:space="preserve">
|
||||||
<value>Click to switch colors</value>
|
<value>Click to switch colors</value>
|
||||||
@ -127,6 +127,18 @@
|
|||||||
<data name="ThemesButtonToolTip" xml:space="preserve">
|
<data name="ThemesButtonToolTip" xml:space="preserve">
|
||||||
<value>Click to switch themes</value>
|
<value>Click to switch themes</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="WeightsButtonBoldWeightContent" xml:space="preserve">
|
||||||
|
<value>Switch Weight (Bold → Light)</value>
|
||||||
|
</data>
|
||||||
|
<data name="WeightsButtonLightWeightContent" xml:space="preserve">
|
||||||
|
<value>Switch Weight (Light → Regular)</value>
|
||||||
|
</data>
|
||||||
|
<data name="WeightsButtonRegularWeightContent" xml:space="preserve">
|
||||||
|
<value>Switch Weight (Regular → Bold)</value>
|
||||||
|
</data>
|
||||||
|
<data name="WeightsButtonToolTip" xml:space="preserve">
|
||||||
|
<value>Click to switch font weights</value>
|
||||||
|
</data>
|
||||||
<data name="_ChangeLangSuccessMsg" xml:space="preserve">
|
<data name="_ChangeLangSuccessMsg" xml:space="preserve">
|
||||||
<value>Change successfuly, restart to refresh the windows</value>
|
<value>Change successfuly, restart to refresh the windows</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -127,6 +127,18 @@
|
|||||||
<data name="ThemesButtonToolTip" xml:space="preserve">
|
<data name="ThemesButtonToolTip" xml:space="preserve">
|
||||||
<value>点击切换显示主题</value>
|
<value>点击切换显示主题</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="WeightsButtonBoldWeightContent" xml:space="preserve">
|
||||||
|
<value>切换字重 (粗体 → 细体)</value>
|
||||||
|
</data>
|
||||||
|
<data name="WeightsButtonLightWeightContent" xml:space="preserve">
|
||||||
|
<value>切换字重 (细体 → 标准)</value>
|
||||||
|
</data>
|
||||||
|
<data name="WeightsButtonRegularWeightContent" xml:space="preserve">
|
||||||
|
<value>切换字重 (标准 → 粗体)</value>
|
||||||
|
</data>
|
||||||
|
<data name="WeightsButtonToolTip" xml:space="preserve">
|
||||||
|
<value>点击切换字体粗细</value>
|
||||||
|
</data>
|
||||||
<data name="_ChangeLangSuccessMsg" xml:space="preserve">
|
<data name="_ChangeLangSuccessMsg" xml:space="preserve">
|
||||||
<value>语言更改完成,重启以刷新界面</value>
|
<value>语言更改完成,重启以刷新界面</value>
|
||||||
</data>
|
</data>
|
||||||
|
20
Convs/SettingsWeightsButtonContentConv.cs
Normal file
20
Convs/SettingsWeightsButtonContentConv.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Sheas_Cealer.Consts;
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Convs;
|
||||||
|
|
||||||
|
internal class SettingsWeightsButtonContentConv : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
bool? isLightWeight = value as bool?;
|
||||||
|
|
||||||
|
return isLightWeight.HasValue ?
|
||||||
|
isLightWeight.GetValueOrDefault() ? SettingsConst.WeightsButtonLightWeightContent : SettingsConst.WeightsButtonBoldWeightContent :
|
||||||
|
SettingsConst.WeightsButtonRegularWeightContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Markup;
|
using System.Windows.Markup;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Sheas_Cealer.Props;
|
using Sheas_Cealer.Props;
|
||||||
@ -19,6 +20,14 @@ internal partial class SettingsPres : GlobalPres
|
|||||||
1 => true,
|
1 => true,
|
||||||
_ => throw new UnreachableException()
|
_ => throw new UnreachableException()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IsLightWeight = Settings.Default.IsLightWeight switch
|
||||||
|
{
|
||||||
|
-1 => null,
|
||||||
|
0 => false,
|
||||||
|
1 => true,
|
||||||
|
_ => throw new UnreachableException()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
@ -35,4 +44,22 @@ internal partial class SettingsPres : GlobalPres
|
|||||||
Settings.Default.IsEnglishLang = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1);
|
Settings.Default.IsEnglishLang = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1);
|
||||||
Settings.Default.Save();
|
Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private static bool? isLightWeight = null;
|
||||||
|
partial void OnIsLightWeightChanged(bool? value)
|
||||||
|
{
|
||||||
|
FontWeight newWeight = value.HasValue ? value.Value ? FontWeights.Light : FontWeights.Bold : FontWeights.Regular;
|
||||||
|
|
||||||
|
Style newStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style);
|
||||||
|
newStyle.Setters.Add(new Setter(Window.FontWeightProperty, newWeight));
|
||||||
|
Application.Current.Resources["CommonWindow"] = newStyle;
|
||||||
|
|
||||||
|
newStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
|
||||||
|
newStyle.Setters.Add(new Setter(Button.FontWeightProperty, newWeight));
|
||||||
|
Application.Current.Resources[typeof(Button)] = newStyle;
|
||||||
|
|
||||||
|
Settings.Default.IsLightWeight = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1);
|
||||||
|
Settings.Default.Save();
|
||||||
|
}
|
||||||
}
|
}
|
12
Props/Settings.Designer.cs
generated
12
Props/Settings.Designer.cs
generated
@ -94,5 +94,17 @@ namespace Sheas_Cealer.Props {
|
|||||||
this["PrimaryColor"] = value;
|
this["PrimaryColor"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
|
||||||
|
public sbyte IsLightWeight {
|
||||||
|
get {
|
||||||
|
return ((sbyte)(this["IsLightWeight"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["IsLightWeight"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,8 @@
|
|||||||
<Setting Name="PrimaryColor" Type="System.Drawing.Color" Scope="User">
|
<Setting Name="PrimaryColor" Type="System.Drawing.Color" Scope="User">
|
||||||
<Value Profile="(Default)">Red</Value>
|
<Value Profile="(Default)">Red</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="IsLightWeight" Type="System.SByte" Scope="User">
|
||||||
|
<Value Profile="(Default)">-1</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -12,7 +12,7 @@ internal static class ForegroundGenerator
|
|||||||
double blackContrast = (luminance + 0.05) / 0.05;
|
double blackContrast = (luminance + 0.05) / 0.05;
|
||||||
double whiteContrast = 1.05 / (luminance + 0.05);
|
double whiteContrast = 1.05 / (luminance + 0.05);
|
||||||
|
|
||||||
return blackContrast >= 3.9 && whiteContrast >= 2.9 ? null :
|
return blackContrast >= 4 && whiteContrast >= 3 ? null :
|
||||||
blackContrast >= whiteContrast ? Color.FromRgb(0, 0, 0) : Color.FromRgb(255, 255, 255);
|
blackContrast >= whiteContrast ? Color.FromRgb(0, 0, 0) : Color.FromRgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,5 +44,16 @@
|
|||||||
|
|
||||||
<Button Grid.Row="1" Grid.Column="0" Margin="5" Content="{Binding Source={x:Static consts:SettingsConst.ColorsButtonContent}}" ToolTip="{Binding Source={x:Static consts:SettingsConst.ColorsButtonToolTip}}"
|
<Button Grid.Row="1" Grid.Column="0" Margin="5" Content="{Binding Source={x:Static consts:SettingsConst.ColorsButtonContent}}" ToolTip="{Binding Source={x:Static consts:SettingsConst.ColorsButtonToolTip}}"
|
||||||
Click="ColorsButton_Click" />
|
Click="ColorsButton_Click" />
|
||||||
|
|
||||||
|
<Button Grid.Row="1" Grid.Column="1" Margin="5" d:Content="# # # #" ToolTip="{Binding Source={x:Static consts:SettingsConst.WeightsButtonToolTip}}"
|
||||||
|
Click="WeightsButton_Click">
|
||||||
|
<Button.Content>
|
||||||
|
<Binding Path="IsLightWeight">
|
||||||
|
<Binding.Converter>
|
||||||
|
<convs:SettingsWeightsButtonContentConv />
|
||||||
|
</Binding.Converter>
|
||||||
|
</Binding>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
@ -54,6 +54,7 @@ public partial class SettingsWin : Window
|
|||||||
Settings.Default.PrimaryColor = System.Drawing.Color.FromArgb(newColor.A, newColor.R, newColor.G, newColor.B);
|
Settings.Default.PrimaryColor = System.Drawing.Color.FromArgb(newColor.A, newColor.R, newColor.G, newColor.B);
|
||||||
Settings.Default.Save();
|
Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
private void WeightsButton_Click(object sender, RoutedEventArgs e) => SettingsPres!.IsLightWeight = SettingsPres.IsLightWeight.HasValue ? SettingsPres.IsLightWeight.Value ? null : true : false;
|
||||||
|
|
||||||
private void SettingsWin_KeyDown(object sender, KeyEventArgs e)
|
private void SettingsWin_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user