adjust propertynames

This commit is contained in:
Lightczx
2023-12-06 17:16:23 +08:00
parent e6e6e22b9c
commit 3ba3ba55cb
8 changed files with 57 additions and 73 deletions

View File

@@ -199,7 +199,7 @@
Margin="16,16,16,0"
Style="{StaticResource TitleTextBlockStyle}"
Text="{Binding GreetingText}"/>
<TextBlock Margin="16,0" Text="{Binding UserOptions.UserName}"/>
<TextBlock Margin="16,0" Text="{Binding HutaoUserOptions.UserName}"/>
<ItemsControl
Margin="16,8,12,0"

View File

@@ -469,13 +469,13 @@
Description="{shcm:ResourceString Name=ViewPageDailyNoteSettingAutoRefreshDescription}"
Header="{shcm:ResourceString Name=ViewPageDailyNoteSettingAutoRefresh}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE72C;}">
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding Options.IsAutoRefreshEnabled, Mode=TwoWay}"/>
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsAutoRefreshEnabled, Mode=TwoWay}"/>
</cwc:SettingsCard>
<RadioButtons
Margin="1,11,0,5"
IsEnabled="{Binding Options.IsAutoRefreshEnabled}"
ItemsSource="{Binding Options.RefreshTimes}"
SelectedItem="{Binding Options.SelectedRefreshTime, Mode=TwoWay}">
IsEnabled="{Binding DailyNoteOptions.IsAutoRefreshEnabled}"
ItemsSource="{Binding DailyNoteOptions.RefreshTimes}"
SelectedItem="{Binding DailyNoteOptions.SelectedRefreshTime, Mode=TwoWay}">
<RadioButtons.Header>
<TextBlock Style="{StaticResource BaseTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageDailyNoteRefreshTime}"/>
</RadioButtons.Header>
@@ -493,13 +493,13 @@
Description="{shcm:ResourceString Name=ViewPageDailyNoteSlientModeDescription}"
Header="{shcm:ResourceString Name=ViewPageDailyNoteSlientModeHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE7ED;}">
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding Options.IsSilentWhenPlayingGame, Mode=TwoWay}"/>
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsSilentWhenPlayingGame, Mode=TwoWay}"/>
</cwc:SettingsCard>
<cwc:SettingsCard
Description="{shcm:ResourceString Name=ViewPageDailyNoteReminderDescription}"
Header="{shcm:ResourceString Name=ViewPageDailyNoteReminderHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xEA8F;}">
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding Options.IsReminderNotification, Mode=TwoWay}"/>
<ToggleSwitch Margin="24,0,0,0" IsOn="{Binding DailyNoteOptions.IsReminderNotification, Mode=TwoWay}"/>
</cwc:SettingsCard>
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageDailyNoteDataInteropHeader}"/>

View File

@@ -159,7 +159,7 @@
<cwc:SettingsCard
Header="{shcm:ResourceString Name=ViewPageLaunchGameSwitchSchemeHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE8AB;}"
IsEnabled="{Binding HutaoOptions.IsElevated}">
IsEnabled="{Binding RuntimeOptions.IsElevated}">
<cwc:SettingsCard.Description>
<StackPanel>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageLaunchGameSwitchSchemeDescription}"/>
@@ -170,7 +170,7 @@
</StackPanel>
</cwc:SettingsCard.Description>
<StackPanel Orientation="Horizontal">
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<shc:SizeRestrictedContentControl>
<shccs:ComboBox2
DisplayMemberPath="DisplayName"
@@ -201,28 +201,28 @@
<!-- 进程 -->
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageLaunchGameProcessHeader}"/>
<cwc:SettingsExpander
shch:SettingsExpanderHelper.IsItemsEnabled="{Binding Options.IsEnabled}"
shch:SettingsExpanderHelper.IsItemsEnabled="{Binding LaunchOptions.IsEnabled}"
Description="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE943;}"
IsExpanded="True">
<ToggleSwitch Width="120" IsOn="{Binding Options.IsEnabled, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsEnabled, Mode=TwoWay}"/>
<cwc:SettingsExpander.Items>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceExclusiveDescription}" Header="-window-mode exclusive">
<ToggleSwitch Width="120" IsOn="{Binding Options.IsExclusive, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsExclusive, Mode=TwoWay}"/>
</cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceFullscreenDescription}" Header="-screen-fullscreen">
<ToggleSwitch Width="120" IsOn="{Binding Options.IsFullScreen, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsFullScreen, Mode=TwoWay}"/>
</cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceBorderlessDescription}" Header="-popupwindow">
<ToggleSwitch Width="120" IsOn="{Binding Options.IsBorderless, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsBorderless, Mode=TwoWay}"/>
</cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioDescription}" Header="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioHeader}">
<shc:SizeRestrictedContentControl Margin="0,0,136,0">
<ComboBox
ItemsSource="{Binding Options.AspectRatios}"
ItemsSource="{Binding LaunchOptions.AspectRatios}"
PlaceholderText="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioPlaceHolder}"
SelectedItem="{Binding Options.SelectedAspectRatio, Mode=TwoWay}"/>
SelectedItem="{Binding LaunchOptions.SelectedAspectRatio, Mode=TwoWay}"/>
</shc:SizeRestrictedContentControl>
</cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenWidthDescription}" Header="-screen-width">
@@ -231,9 +231,9 @@
Width="156"
Padding="12,6,0,0"
VerticalAlignment="Center"
IsEnabled="{Binding Options.IsScreenWidthEnabled}"
Value="{Binding Options.ScreenWidth, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding Options.IsScreenWidthEnabled, Mode=TwoWay}"/>
IsEnabled="{Binding LaunchOptions.IsScreenWidthEnabled}"
Value="{Binding LaunchOptions.ScreenWidth, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsScreenWidthEnabled, Mode=TwoWay}"/>
</StackPanel>
</cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenHeightDescription}" Header="-screen-height">
@@ -242,9 +242,9 @@
Width="156"
Padding="12,6,0,0"
VerticalAlignment="Center"
IsEnabled="{Binding Options.IsScreenHeightEnabled}"
Value="{Binding Options.ScreenHeight, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding Options.IsScreenHeightEnabled, Mode=TwoWay}"/>
IsEnabled="{Binding LaunchOptions.IsScreenHeightEnabled}"
Value="{Binding LaunchOptions.ScreenHeight, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsScreenHeightEnabled, Mode=TwoWay}"/>
</StackPanel>
</cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameMonitorsDescription}" Header="-monitor">
@@ -252,11 +252,11 @@
<shc:SizeRestrictedContentControl>
<ComboBox
DisplayMemberPath="Name"
IsEnabled="{Binding Options.IsMonitorEnabled}"
ItemsSource="{Binding Options.Monitors}"
SelectedItem="{Binding Options.Monitor, Mode=TwoWay}"/>
IsEnabled="{Binding LaunchOptions.IsMonitorEnabled}"
ItemsSource="{Binding LaunchOptions.Monitors}"
SelectedItem="{Binding LaunchOptions.Monitor, Mode=TwoWay}"/>
</shc:SizeRestrictedContentControl>
<ToggleSwitch Width="120" IsOn="{Binding Options.IsMonitorEnabled, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsMonitorEnabled, Mode=TwoWay}"/>
</StackPanel>
</cwc:SettingsCard>
</cwc:SettingsExpander.Items>
@@ -265,20 +265,20 @@
Description="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE785;}"
IsEnabled="{Binding HutaoOptions.IsElevated}"
IsEnabled="{Binding RuntimeOptions.IsElevated}"
Visibility="{Binding AppOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}">
<StackPanel Orientation="Horizontal">
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<NumberBox
MinWidth="156"
Padding="10,8,0,0"
Maximum="720"
Minimum="60"
SpinButtonPlacementMode="Inline"
Value="{Binding Options.TargetFps, Mode=TwoWay}"/>
Value="{Binding LaunchOptions.TargetFps, Mode=TwoWay}"/>
<ToggleSwitch
Width="120"
IsOn="{Binding Options.UnlockFps, Mode=TwoWay}"
IsOn="{Binding LaunchOptions.UnlockFps, Mode=TwoWay}"
OffContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOff}"
OnContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOn}"/>
</StackPanel>
@@ -290,13 +290,13 @@
Description="{shcm:ResourceString Name=ViewPageLaunchGamePlayTimeDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGamePlayTimeHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xEC92;}">
<ToggleSwitch Width="120" IsOn="{Binding Options.UseStarwardPlayTimeStatistics, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.UseStarwardPlayTimeStatistics, Mode=TwoWay}"/>
</cwc:SettingsCard>
<cwc:SettingsCard
Description="{shcm:ResourceString Name=ViewPageLaunchGameDiscordActivityDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameDiscordActivityHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE8CF;}">
<ToggleSwitch Width="120" IsOn="{Binding Options.SetDiscordActivityWhenPlaying, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.SetDiscordActivityWhenPlaying, Mode=TwoWay}"/>
</cwc:SettingsCard>
</StackPanel>
</Grid>

View File

@@ -203,7 +203,7 @@
<shc:SizeRestrictedContentControl>
<ComboBox
DisplayMemberPath="Name"
ItemsSource="{Binding Options.Cultures}"
ItemsSource="{Binding AppOptions.Cultures}"
SelectedItem="{Binding SelectedCulture, Mode=TwoWay}"/>
</shc:SizeRestrictedContentControl>
</cwc:SettingsCard>
@@ -214,7 +214,7 @@
<shc:SizeRestrictedContentControl>
<ComboBox
DisplayMemberPath="Name"
ItemsSource="{Binding Options.BackdropTypes}"
ItemsSource="{Binding AppOptions.BackdropTypes}"
SelectedItem="{Binding SelectedBackdropType, Mode=TwoWay}"/>
</shc:SizeRestrictedContentControl>
</cwc:SettingsCard>
@@ -312,7 +312,7 @@
<cwc:SettingsCard.Description>
<StackPanel>
<TextBlock Foreground="{ThemeResource SystemErrorTextColor}" Text="{shcm:ResourceString Name=ViewPageSettingSetGamePathHint}"/>
<TextBlock Text="{Binding Options.GamePath}"/>
<TextBlock Text="{Binding AppOptions.GamePath}"/>
</StackPanel>
</cwc:SettingsCard.Description>
</cwc:SettingsCard>
@@ -326,7 +326,7 @@
<cwc:SettingsCard.Description>
<StackPanel>
<TextBlock Text="{shcm:ResourceString Name=ViewPageSettingSetPowerShellDescription}"/>
<TextBlock Text="{Binding Options.PowerShellPath}"/>
<TextBlock Text="{Binding AppOptions.PowerShellPath}"/>
</StackPanel>
</cwc:SettingsCard.Description>
</cwc:SettingsCard>
@@ -345,7 +345,7 @@
Header="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE81C;}">
<ToggleSwitch
IsOn="{Binding Options.IsEmptyHistoryWishVisible, Mode=TwoWay}"
IsOn="{Binding AppOptions.IsEmptyHistoryWishVisible, Mode=TwoWay}"
OffContent="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleOff}"
OnContent="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleOn}"/>
</cwc:SettingsCard>
@@ -397,13 +397,13 @@
<TextBlock
Foreground="{ThemeResource SystemFillColorCriticalBrush}"
Text="{shcm:ResourceString Name=ViewPageSettingFeaturesDangerousHint}"
Visibility="{Binding Options.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}"/>
<TextBlock Text="{shcm:ResourceString Name=ViewPageSettingIsAdvancedLaunchOptionsEnabledDescription}" Visibility="{Binding Options.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
Visibility="{Binding AppOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}"/>
<TextBlock Text="{shcm:ResourceString Name=ViewPageSettingIsAdvancedLaunchOptionsEnabledDescription}" Visibility="{Binding AppOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
</StackPanel>
</cwc:SettingsCard.Description>
<StackPanel Orientation="Horizontal">
<shvc:Elevation Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<ToggleSwitch Width="120" IsOn="{Binding Options.IsAdvancedLaunchOptionsEnabled, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding AppOptions.IsAdvancedLaunchOptionsEnabled, Mode=TwoWay}"/>
</StackPanel>
</cwc:SettingsCard>
<cwc:SettingsCard
@@ -417,7 +417,7 @@
<TextBlock
Foreground="{ThemeResource SystemFillColorCriticalBrush}"
Text="{shcm:ResourceString Name=ViewPageSettingDangerousHint}"
Visibility="{Binding Options.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}"/>
Visibility="{Binding AppOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}"/>
<TextBlock Text="{shcm:ResourceString Name=ViewPageSettingDeleteUserDescription}"/>
</StackPanel>
</cwc:SettingsCard.Description>

View File

@@ -26,8 +26,8 @@ internal sealed partial class DailyNoteViewModel : Abstraction.ViewModel
{
private readonly IContentDialogFactory contentDialogFactory;
private readonly IDailyNoteService dailyNoteService;
private readonly DailyNoteOptions dailyNoteOptions;
private readonly IInfoBarService infoBarService;
private readonly DailyNoteOptions options;
private readonly RuntimeOptions runtimeOptions;
private readonly ITaskContext taskContext;
private readonly IUserService userService;
@@ -35,15 +35,11 @@ internal sealed partial class DailyNoteViewModel : Abstraction.ViewModel
private ObservableCollection<UserAndUid>? userAndUids;
private ObservableCollection<DailyNoteEntry>? dailyNoteEntries;
/// <summary>
/// 选项
/// </summary>
public DailyNoteOptions Options { get => options; }
public DailyNoteOptions DailyNoteOptions { get => dailyNoteOptions; }
public RuntimeOptions RuntimeOptions { get => runtimeOptions; }
[SuppressMessage("", "CA1822")]
public IWebViewerSource VerifyUrlSource { get => new DailyNoteWebViewerSource(); }
public IWebViewerSource VerifyUrlSource { get; } = new DailyNoteWebViewerSource();
/// <summary>
/// 用户与角色集合
@@ -128,13 +124,13 @@ internal sealed partial class DailyNoteViewModel : Abstraction.ViewModel
private async Task ConfigDailyNoteWebhookUrlAsync()
{
DailyNoteWebhookDialog dialog = await contentDialogFactory.CreateInstanceAsync<DailyNoteWebhookDialog>().ConfigureAwait(true);
dialog.Text = options.WebhookUrl;
dialog.Text = dailyNoteOptions.WebhookUrl;
(bool isOk, string url) = await dialog.GetInputUrlAsync().ConfigureAwait(false);
if (isOk)
{
await taskContext.SwitchToMainThreadAsync();
options.WebhookUrl = url;
dailyNoteOptions.WebhookUrl = url;
infoBarService.Information(SH.ViewModelDailyNoteConfigWebhookUrlComplete);
}
}

View File

@@ -88,21 +88,12 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel
/// </summary>
public GameAccount? SelectedGameAccount { get => selectedGameAccount; set => SetProperty(ref selectedGameAccount, value); }
/// <summary>
/// 启动选项
/// </summary>
public LaunchOptions Options { get => launchOptions; }
public LaunchOptions LaunchOptions { get => launchOptions; }
public LaunchStatusOptions LaunchStatusOptions { get => launchStatusOptions; }
/// <summary>
/// 胡桃选项
/// </summary>
public RuntimeOptions HutaoOptions { get => runtimeOptions; }
public RuntimeOptions RuntimeOptions { get => runtimeOptions; }
/// <summary>
/// 应用选项
/// </summary>
public AppOptions AppOptions { get => appOptions; }
/// <summary>

View File

@@ -39,7 +39,7 @@ internal sealed partial class AnnouncementViewModel : Abstraction.ViewModel
/// <summary>
/// 用户选项
/// </summary>
public HutaoUserOptions UserOptions { get => hutaoUserOptions; }
public HutaoUserOptions HutaoUserOptions { get => hutaoUserOptions; }
/// <summary>
/// 欢迎语

View File

@@ -62,10 +62,7 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
private NameValue<CultureInfo>? selectedCulture;
private IPInformation? ipInformation;
/// <summary>
/// 应用程序设置
/// </summary>
public AppOptions Options { get => appOptions; }
public AppOptions AppOptions { get => appOptions; }
public RuntimeOptions HutaoOptions { get => runtimeOptions; }
@@ -79,24 +76,24 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
public NameValue<BackdropType>? SelectedBackdropType
{
get => selectedBackdropType ??= Options.BackdropTypes.Single(t => t.Value == Options.BackdropType);
get => selectedBackdropType ??= AppOptions.BackdropTypes.Single(t => t.Value == AppOptions.BackdropType);
set
{
if (SetProperty(ref selectedBackdropType, value) && value is not null)
{
Options.BackdropType = value.Value;
AppOptions.BackdropType = value.Value;
}
}
}
public NameValue<CultureInfo>? SelectedCulture
{
get => selectedCulture ??= Options.GetCurrentCultureForSelectionOrDefault();
get => selectedCulture ??= AppOptions.GetCurrentCultureForSelectionOrDefault();
set
{
if (SetProperty(ref selectedCulture, value) && value is not null)
{
Options.CurrentCulture = value.Value;
AppOptions.CurrentCulture = value.Value;
AppInstance.Restart(string.Empty);
}
}
@@ -149,7 +146,7 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
await taskContext.SwitchToMainThreadAsync();
try
{
Options.GamePath = path;
AppOptions.GamePath = path;
}
catch (SqliteException ex)
{
@@ -167,14 +164,14 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
if (isOk && Path.GetFileNameWithoutExtension(file).EqualsAny(["POWERSHELL", "PWSH"], StringComparison.OrdinalIgnoreCase))
{
await taskContext.SwitchToMainThreadAsync();
Options.PowerShellPath = file;
AppOptions.PowerShellPath = file;
}
}
[Command("DeleteGameWebCacheCommand")]
private void DeleteGameWebCache()
{
string gamePath = Options.GamePath;
string gamePath = AppOptions.GamePath;
if (!string.IsNullOrEmpty(gamePath))
{