修改深色模式切换方式,改为Json

This commit is contained in:
czz_y 2024-09-02 17:48:40 +08:00
parent 9390e7ce8a
commit 7f2ccb2ef8

View File

@ -87,7 +87,12 @@ namespace AntdUIDemo
private void Button_color_Click(object sender, EventArgs e)
{
var value = ConfigurationManager.AppSettings["ColorMode"];
// 读取 appsettings.json 文件
var configFilePath = "appsettings.json";
var json = File.ReadAllText(configFilePath);
var jsonObj = JObject.Parse(json);
var appSettings = jsonObj["AppSettings"];
var value = appSettings["ColorMode"]?.ToString();
if (value == "Auto")
{
//反向设置