mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 00:54:26 +08:00
settings_re10
This commit is contained in:
@@ -198,11 +198,16 @@ public partial class MainWindow
|
||||
|
||||
private ThemeColorContext BuildAdaptiveThemeContext()
|
||||
{
|
||||
var palette = _themeSettingsService.BuildPalette(_isNightMode, _wallpaperPath, _selectedThemeColor.ToString());
|
||||
var accentColor = palette.MonetColors is { Count: > 0 }
|
||||
? palette.MonetColors[0]
|
||||
: _selectedThemeColor;
|
||||
return new ThemeColorContext(
|
||||
_selectedThemeColor,
|
||||
accentColor,
|
||||
IsLightBackground: !_isNightMode,
|
||||
IsLightNavBackground: !_isNightMode,
|
||||
IsNightMode: _isNightMode);
|
||||
IsNightMode: _isNightMode,
|
||||
MonetColors: palette.MonetColors);
|
||||
}
|
||||
|
||||
private void ApplyAdaptiveThemeResources()
|
||||
@@ -386,7 +391,7 @@ public partial class MainWindow
|
||||
return;
|
||||
}
|
||||
|
||||
var palette = _themeSettingsService.BuildPalette(enabled, _wallpaperPath);
|
||||
var palette = _themeSettingsService.BuildPalette(enabled, _wallpaperPath, _selectedThemeColor.ToString());
|
||||
_recommendedColors = palette.RecommendedColors;
|
||||
_monetColors = palette.MonetColors;
|
||||
}
|
||||
@@ -406,6 +411,32 @@ public partial class MainWindow
|
||||
|
||||
private void TriggerAutoUpdateCheckIfEnabled()
|
||||
{
|
||||
var versionText = _settingsFacade.ApplicationInfo.GetAppVersionText();
|
||||
if (!Version.TryParse(versionText, out var currentVersion))
|
||||
{
|
||||
currentVersion = new Version(0, 0, 0);
|
||||
}
|
||||
|
||||
var normalizedVersion = new Version(
|
||||
Math.Max(0, currentVersion.Major),
|
||||
Math.Max(0, currentVersion.Minor),
|
||||
Math.Max(0, currentVersion.Build));
|
||||
|
||||
DispatcherTimer.RunOnce(
|
||||
async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await HostUpdateWorkflowServiceProvider
|
||||
.GetOrCreate()
|
||||
.AutoCheckIfEnabledAsync(normalizedVersion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AppLogger.Warn("UpdateWorkflow", "Automatic update check failed after startup.", ex);
|
||||
}
|
||||
},
|
||||
TimeSpan.FromSeconds(3));
|
||||
}
|
||||
|
||||
private void PersistSettings()
|
||||
@@ -489,6 +520,7 @@ public partial class MainWindow
|
||||
private AppSettingsSnapshot BuildAppSettingsSnapshot()
|
||||
{
|
||||
var latestWeatherState = _weatherSettingsService.Get();
|
||||
var latestUpdateState = _updateSettingsService.Get();
|
||||
return new AppSettingsSnapshot
|
||||
{
|
||||
GridShortSideCells = _targetShortSideCells,
|
||||
@@ -513,6 +545,16 @@ public partial class MainWindow
|
||||
WeatherNoTlsRequests = latestWeatherState.NoTlsRequests,
|
||||
AutoStartWithWindows = _autoStartWithWindows,
|
||||
AppRenderMode = _selectedAppRenderMode,
|
||||
AutoCheckUpdates = latestUpdateState.AutoCheckUpdates,
|
||||
IncludePrereleaseUpdates = latestUpdateState.IncludePrereleaseUpdates,
|
||||
UpdateChannel = latestUpdateState.UpdateChannel,
|
||||
UpdateMode = latestUpdateState.UpdateMode,
|
||||
UpdateDownloadSource = latestUpdateState.UpdateDownloadSource,
|
||||
UpdateDownloadThreads = latestUpdateState.UpdateDownloadThreads,
|
||||
PendingUpdateInstallerPath = latestUpdateState.PendingUpdateInstallerPath,
|
||||
PendingUpdateVersion = latestUpdateState.PendingUpdateVersion,
|
||||
PendingUpdatePublishedAtUtcMs = latestUpdateState.PendingUpdatePublishedAtUtcMs,
|
||||
LastUpdateCheckUtcMs = latestUpdateState.LastUpdateCheckUtcMs,
|
||||
TopStatusComponentIds = [.. _topStatusComponentIds],
|
||||
PinnedTaskbarActions = [.. _pinnedTaskbarActions.Select(v => v.ToString())],
|
||||
EnableDynamicTaskbarActions = _enableDynamicTaskbarActions,
|
||||
|
||||
@@ -6,96 +6,71 @@
|
||||
xmlns:fi="using:FluentIcons.Avalonia.Fluent"
|
||||
x:Class="LanMountainDesktop.Views.SettingsPages.AboutSettingsPage"
|
||||
x:DataType="vm:AboutSettingsPageViewModel">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Classes="settings-page-container">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="StackPanel.about-page-container">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="Spacing" Value="0" />
|
||||
<Setter Property="Margin" Value="0,12,0,24" />
|
||||
</Style>
|
||||
|
||||
<!-- 应用信息分组 -->
|
||||
<controls:IconText Icon="Info"
|
||||
Text="{Binding AppInfoHeader}"
|
||||
Margin="0,0,0,4" />
|
||||
<Style Selector="Border.about-hero-card">
|
||||
<Setter Property="Background" Value="{DynamicResource AdaptiveSurfaceRaisedBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource AdaptiveGlassPanelBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="24" />
|
||||
<Setter Property="ClipToBounds" Value="True" />
|
||||
<Setter Property="Margin" Value="0,0,0,18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
<ui:SettingsExpander Header="{Binding AppInfoHeader}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<Style Selector="ui|InfoBar.about-static-info">
|
||||
<Setter Property="IsOpen" Value="True" />
|
||||
<Setter Property="IsClosable" Value="False" />
|
||||
<Setter Property="Severity" Value="Informational" />
|
||||
<Setter Property="Margin" Value="0,0,0,12" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Classes="about-page-container">
|
||||
<Border x:Name="AboutHeroCard"
|
||||
Classes="about-hero-card"
|
||||
Height="240">
|
||||
<Image Source="/Assets/about_banner.png"
|
||||
Stretch="Uniform"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
<TextBlock Classes="settings-subsection-title"
|
||||
Text="{Binding AppInfoHeader}" />
|
||||
|
||||
<ui:InfoBar Classes="about-static-info"
|
||||
Title="{Binding VersionLabel}"
|
||||
Message="{Binding VersionText}">
|
||||
<ui:InfoBar.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Info" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Text="{Binding VersionLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Opacity="0.82"
|
||||
Text="{Binding VersionText}" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Text="{Binding RenderBackendLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Opacity="0.82"
|
||||
Text="{Binding RenderBackendText}" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
</ui:InfoBar.IconSource>
|
||||
</ui:InfoBar>
|
||||
|
||||
<Separator Classes="settings-separator" />
|
||||
|
||||
<!-- 更新设置分组 -->
|
||||
<controls:IconText Icon="ArrowSync"
|
||||
Text="{Binding UpdateHeader}"
|
||||
Margin="0,0,0,4" />
|
||||
|
||||
<ui:SettingsExpander Header="{Binding UpdateHeader}"
|
||||
IsExpanded="True">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="ArrowSync" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Text="{Binding AutoCheckUpdatesLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<ToggleSwitch Grid.Column="1"
|
||||
IsChecked="{Binding AutoCheckUpdates}" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Text="{Binding IncludePrereleaseUpdatesLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<ToggleSwitch Grid.Column="1"
|
||||
IsChecked="{Binding IncludePrereleaseUpdates}" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Text="{Binding UpdateChannelLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Width="180"
|
||||
ItemsSource="{Binding UpdateChannels}"
|
||||
SelectedItem="{Binding SelectedUpdateChannel}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:SelectionOption">
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
<ui:SettingsExpanderItem>
|
||||
<StackPanel Spacing="8">
|
||||
<Button Command="{Binding CheckForUpdatesCommand}"
|
||||
Content="{Binding CheckForUpdatesButtonText}" />
|
||||
<TextBlock Opacity="0.76"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
Text="{Binding UpdateStatus}" />
|
||||
</StackPanel>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
<ui:InfoBar Classes="about-static-info"
|
||||
Title="{Binding CodenameLabel}"
|
||||
Message="{Binding CodenameText}">
|
||||
<ui:InfoBar.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Bookmark" />
|
||||
</ui:InfoBar.IconSource>
|
||||
</ui:InfoBar>
|
||||
|
||||
<Border Classes="settings-section-card">
|
||||
<StackPanel Spacing="12">
|
||||
<controls:IconText Icon="WindowConsole"
|
||||
Text="{Binding RenderBackendLabel}" />
|
||||
<TextBlock Classes="settings-item-description"
|
||||
Text="{Binding RenderBackendText}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
@@ -11,9 +14,12 @@ namespace LanMountainDesktop.Views.SettingsPages;
|
||||
IconKey = "Info",
|
||||
SortOrder = 40,
|
||||
TitleLocalizationKey = "settings.about.title",
|
||||
DescriptionLocalizationKey = "settings.about.description")]
|
||||
DescriptionLocalizationKey = "settings.about.description",
|
||||
HidePageTitle = true)]
|
||||
public partial class AboutSettingsPage : SettingsPageBase
|
||||
{
|
||||
private const double HeroAspectRatio = 9d / 16d;
|
||||
|
||||
public AboutSettingsPage()
|
||||
: this(new AboutSettingsPageViewModel(HostSettingsFacadeProvider.GetOrCreate()))
|
||||
{
|
||||
@@ -24,7 +30,34 @@ public partial class AboutSettingsPage : SettingsPageBase
|
||||
ViewModel = viewModel;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
if (AboutHeroCard is not null)
|
||||
{
|
||||
AboutHeroCard.SizeChanged += OnAboutHeroCardSizeChanged;
|
||||
UpdateHeroCardHeight(AboutHeroCard.Bounds.Width);
|
||||
}
|
||||
}
|
||||
|
||||
public AboutSettingsPageViewModel ViewModel { get; }
|
||||
|
||||
private void OnAboutHeroCardSizeChanged(object? sender, SizeChangedEventArgs e)
|
||||
{
|
||||
_ = sender;
|
||||
UpdateHeroCardHeight(e.NewSize.Width);
|
||||
}
|
||||
|
||||
private void UpdateHeroCardHeight(double width)
|
||||
{
|
||||
if (AboutHeroCard is null || width <= 1d)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var targetHeight = Math.Round(width * HeroAspectRatio, 2);
|
||||
if (Math.Abs(AboutHeroCard.Height - targetHeight) <= 0.5d)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AboutHeroCard.Height = targetHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,39 +39,6 @@
|
||||
<ColorPicker Color="{Binding ThemeColorPickerValue}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<Separator Classes="settings-separator" />
|
||||
|
||||
<controls:IconText Icon="Clock"
|
||||
Text="{Binding ClockHeader}"
|
||||
Margin="0,0,0,4" />
|
||||
|
||||
<ui:SettingsExpander Header="{Binding ClockHeader}"
|
||||
Description="{Binding ClockDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Clock" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ToggleSwitch IsChecked="{Binding ShowClock}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Text="{Binding ClockFormatLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Width="180"
|
||||
ItemsSource="{Binding ClockFormats}"
|
||||
SelectedItem="{Binding SelectedClockFormat}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:SelectionOption">
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:LanMountainDesktop.ViewModels"
|
||||
xmlns:controls="using:LanMountainDesktop.Controls"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
xmlns:fi="using:FluentIcons.Avalonia.Fluent"
|
||||
x:Class="LanMountainDesktop.Views.SettingsPages.StatusBarSettingsPage"
|
||||
x:DataType="vm:StatusBarSettingsPageViewModel">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Classes="settings-page-container">
|
||||
<controls:IconText Icon="Apps"
|
||||
Text="{Binding ComponentsHeader}"
|
||||
Margin="0,0,0,4" />
|
||||
|
||||
<ui:SettingsExpander Header="{Binding ClockHeader}"
|
||||
Description="{Binding ClockDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Clock" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ToggleSwitch IsChecked="{Binding ShowClock}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*"
|
||||
ColumnSpacing="16">
|
||||
<TextBlock Text="{Binding ClockFormatLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Width="220"
|
||||
IsEnabled="{Binding ShowClock}"
|
||||
ItemsSource="{Binding ClockFormats}"
|
||||
SelectedItem="{Binding SelectedClockFormat}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:SelectionOption">
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<Separator Classes="settings-separator" />
|
||||
|
||||
<controls:IconText Icon="Apps"
|
||||
Text="{Binding SpacingHeader}"
|
||||
Margin="0,0,0,4" />
|
||||
|
||||
<ui:SettingsExpander Header="{Binding SpacingHeader}"
|
||||
Description="{Binding SpacingDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Apps" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ComboBox Width="180"
|
||||
ItemsSource="{Binding SpacingModes}"
|
||||
SelectedItem="{Binding SelectedSpacingMode}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:SelectionOption">
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ui:SettingsExpander.Footer>
|
||||
<ui:SettingsExpanderItem IsVisible="{Binding IsCustomSpacingVisible}">
|
||||
<Grid ColumnDefinitions="Auto,*"
|
||||
ColumnSpacing="16">
|
||||
<TextBlock Text="{Binding CustomSpacingLabel}"
|
||||
VerticalAlignment="Center" />
|
||||
<ui:NumberBox Grid.Column="1"
|
||||
Width="160"
|
||||
Minimum="0"
|
||||
Maximum="30"
|
||||
SmallChange="1"
|
||||
LargeChange="4"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{Binding CustomSpacingPercent}" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,30 @@
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
|
||||
namespace LanMountainDesktop.Views.SettingsPages;
|
||||
|
||||
[SettingsPageInfo(
|
||||
"status-bar",
|
||||
"Status Bar",
|
||||
SettingsPageCategory.Appearance,
|
||||
IconKey = "Apps",
|
||||
SortOrder = 17,
|
||||
TitleLocalizationKey = "settings.status_bar.title",
|
||||
DescriptionLocalizationKey = "settings.status_bar.description")]
|
||||
public partial class StatusBarSettingsPage : SettingsPageBase
|
||||
{
|
||||
public StatusBarSettingsPage()
|
||||
: this(new StatusBarSettingsPageViewModel(HostSettingsFacadeProvider.GetOrCreate()))
|
||||
{
|
||||
}
|
||||
|
||||
public StatusBarSettingsPage(StatusBarSettingsPageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public StatusBarSettingsPageViewModel ViewModel { get; }
|
||||
}
|
||||
224
LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml
Normal file
224
LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml
Normal file
@@ -0,0 +1,224 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:LanMountainDesktop.ViewModels"
|
||||
xmlns:controls="using:LanMountainDesktop.Controls"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
xmlns:fi="using:FluentIcons.Avalonia.Fluent"
|
||||
x:Class="LanMountainDesktop.Views.SettingsPages.UpdateSettingsPage"
|
||||
x:DataType="vm:UpdateSettingsPageViewModel">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="Border.update-status-card">
|
||||
<Setter Property="Padding" Value="24" />
|
||||
<Setter Property="Margin" Value="0,0,0,18" />
|
||||
<Setter Property="CornerRadius" Value="24" />
|
||||
<Setter Property="Background" Value="{DynamicResource AdaptiveSurfaceRaisedBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource AdaptiveGlassPanelBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BoxShadow" Value="0 6 18 #15000000" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.update-kv-label">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Opacity" Value="0.68" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource AdaptiveTextPrimaryBrush}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.update-kv-value">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource AdaptiveTextPrimaryBrush}" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Classes="settings-page-container">
|
||||
<TextBlock Classes="settings-section-title"
|
||||
Text="{Binding PageTitle}" />
|
||||
<TextBlock Classes="settings-section-description"
|
||||
Text="{Binding PageDescription}" />
|
||||
|
||||
<Border Classes="update-status-card">
|
||||
<StackPanel Spacing="18">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto"
|
||||
ColumnSpacing="16">
|
||||
<Border Classes="settings-section-card-icon-host"
|
||||
Width="48"
|
||||
Height="48">
|
||||
<Viewbox Stretch="Uniform">
|
||||
<fi:SymbolIcon Symbol="ArrowSync" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Spacing="4">
|
||||
<TextBlock Classes="settings-card-header"
|
||||
Margin="0"
|
||||
Text="{Binding StatusCardTitle}" />
|
||||
<TextBlock Classes="settings-item-description"
|
||||
Text="{Binding StatusCardDescription}" />
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="settings-accent-button"
|
||||
Command="{Binding CheckForUpdatesCommand}"
|
||||
Content="{Binding CheckForUpdatesButtonText}" />
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,*"
|
||||
ColumnSpacing="14"
|
||||
RowSpacing="12">
|
||||
<StackPanel Grid.Column="0"
|
||||
Spacing="4">
|
||||
<TextBlock Classes="update-kv-label"
|
||||
Text="{Binding CurrentVersionLabel}" />
|
||||
<TextBlock Classes="update-kv-value"
|
||||
Text="{Binding CurrentVersionText}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Spacing="4"
|
||||
IsVisible="{Binding IsLatestVersionVisible}">
|
||||
<TextBlock Classes="update-kv-label"
|
||||
Text="{Binding LatestVersionLabel}" />
|
||||
<TextBlock Classes="update-kv-value"
|
||||
Text="{Binding LatestVersionText}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Spacing="4"
|
||||
IsVisible="{Binding IsPublishedAtVisible}">
|
||||
<TextBlock Classes="update-kv-label"
|
||||
Text="{Binding PublishedAtLabel}" />
|
||||
<TextBlock Classes="update-kv-value"
|
||||
Text="{Binding PublishedAtText}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Spacing="4"
|
||||
IsVisible="{Binding IsLastCheckedVisible}">
|
||||
<TextBlock Classes="update-kv-label"
|
||||
Text="{Binding LastCheckedLabel}" />
|
||||
<TextBlock Classes="update-kv-value"
|
||||
Text="{Binding LastCheckedText}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Classes="settings-item-description"
|
||||
Text="{Binding UpdateStatus}" />
|
||||
|
||||
<ProgressBar Minimum="0"
|
||||
Maximum="100"
|
||||
Value="{Binding DownloadProgressValue}"
|
||||
IsVisible="{Binding IsDownloadProgressVisible}" />
|
||||
|
||||
<TextBlock Classes="settings-item-description"
|
||||
IsVisible="{Binding IsDownloadProgressVisible}"
|
||||
Text="{Binding DownloadProgressText}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
<Button Command="{Binding DownloadLatestReleaseCommand}"
|
||||
Content="{Binding DownloadButtonText}"
|
||||
IsVisible="{Binding IsDownloadButtonVisible}" />
|
||||
<Button Classes="settings-accent-button"
|
||||
Command="{Binding InstallPendingUpdateCommand}"
|
||||
Content="{Binding InstallNowButtonText}"
|
||||
IsVisible="{Binding IsInstallButtonVisible}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<TextBlock Classes="settings-subsection-title"
|
||||
Text="{Binding PreferencesHeader}" />
|
||||
<TextBlock Classes="settings-section-description"
|
||||
Margin="0,0,0,18"
|
||||
Text="{Binding PreferencesDescription}" />
|
||||
|
||||
<ui:SettingsExpander Classes="settings-expander-card"
|
||||
Header="{Binding UpdateChannelLabel}"
|
||||
Description="{Binding SelectedUpdateChannelDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="BranchFork" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ComboBox Width="220"
|
||||
ItemsSource="{Binding UpdateChannelOptions}"
|
||||
SelectedItem="{Binding SelectedUpdateChannelOption}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Classes="settings-expander-card"
|
||||
Header="{Binding UpdateSourceLabel}"
|
||||
Description="{Binding SelectedUpdateSourceDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="GlobeArrowForward" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ComboBox Width="220"
|
||||
ItemsSource="{Binding UpdateSourceOptions}"
|
||||
SelectedItem="{Binding SelectedUpdateSourceOption}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Classes="settings-expander-card"
|
||||
Header="{Binding UpdateModeLabel}"
|
||||
Description="{Binding SelectedUpdateModeDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Options" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ComboBox Width="260"
|
||||
ItemsSource="{Binding UpdateModeOptions}"
|
||||
SelectedItem="{Binding SelectedUpdateModeOption}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Classes="settings-expander-card"
|
||||
Header="{Binding DownloadThreadsLabel}"
|
||||
Description="{Binding DownloadThreadsDescription}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="ArrowDownload" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ui:NumberBox Width="160"
|
||||
Minimum="1"
|
||||
Maximum="128"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{Binding DownloadThreadsSliderValue}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Classes="settings-expander-card"
|
||||
Header="{Binding AutoCheckUpdatesLabel}">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="ClockAlarm" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<ToggleSwitch IsChecked="{Binding AutoCheckUpdates}" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
</ui:SettingsExpander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,30 @@
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
|
||||
namespace LanMountainDesktop.Views.SettingsPages;
|
||||
|
||||
[SettingsPageInfo(
|
||||
"update",
|
||||
"Update",
|
||||
SettingsPageCategory.About,
|
||||
IconKey = "ArrowSync",
|
||||
SortOrder = 35,
|
||||
TitleLocalizationKey = "settings.update.title",
|
||||
DescriptionLocalizationKey = "settings.update.description")]
|
||||
public partial class UpdateSettingsPage : SettingsPageBase
|
||||
{
|
||||
public UpdateSettingsPage()
|
||||
: this(new UpdateSettingsPageViewModel(HostSettingsFacadeProvider.GetOrCreate()))
|
||||
{
|
||||
}
|
||||
|
||||
public UpdateSettingsPage(UpdateSettingsPageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public UpdateSettingsPageViewModel ViewModel { get; }
|
||||
}
|
||||
@@ -216,8 +216,11 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
||||
ViewModel.CurrentPageTitle = descriptor.Title;
|
||||
ViewModel.CurrentPageDescription = descriptor.Description;
|
||||
ViewModel.CurrentPageId = descriptor.PageId;
|
||||
ViewModel.IsPageTitleVisible = !descriptor.HidePageTitle;
|
||||
TrySelectNavigationItem(descriptor.PageId);
|
||||
SyncTitleText();
|
||||
UpdateResponsiveLayout();
|
||||
RequestResponsiveLayoutRefresh();
|
||||
}
|
||||
|
||||
private SettingsPageDescriptor? ResolveDescriptor(string? pageId)
|
||||
|
||||
Reference in New Issue
Block a user