添加主题切换,未完成

This commit is contained in:
2025-07-12 12:55:46 +08:00
parent fabc63df44
commit bc23304ea0
6 changed files with 35 additions and 9 deletions

View File

@@ -25,6 +25,24 @@ public partial class SettingViewModel : ViewModelBase
_s7BackgroundService = s7BackgroundService;
_mqttBackgroundService = mqttBackgroundService;
_opcUaBackgroundService = opcUaBackgroundService;
Themes = new List<string> { "浅色", "深色", "跟随系统" };
}
public List<string> Themes { get; }
public string SelectedTheme
{
get => _connectionSettings.Theme;
set
{
if (_connectionSettings.Theme != value)
{
_connectionSettings.Theme = value;
OnPropertyChanged();
_connectionSettings.Save();
ThemeHelper.ApplyTheme(value);
}
}
}
public List<string> AvailableDbTypes { get; set; }
@@ -209,4 +227,4 @@ public partial class SettingViewModel : ViewModelBase
NotificationHelper.ShowError($"连接失败:{ex.Message}", ex);
}
}
}
}