Refactor/Fix: Standardize Dialog Themes & Fix WebSocket Fragmentation. Detail: UserInfoDialog design refresh, standardized all dialogs, fixed backend WebSocketServer fragmentation bug.

This commit is contained in:
backuppc
2025-12-30 17:35:02 +09:00
parent 8528d0206c
commit 5fe21528fc
27 changed files with 590 additions and 411 deletions

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Project;
namespace Project.Web
{
public partial class MachineBridge
{
public string GetSettings()
{
try
{
return JsonConvert.SerializeObject(Pub.setting);
}
catch (Exception ex)
{
return JsonConvert.SerializeObject(new { Error = ex.Message });
}
}
public string SaveSettings(string jsonSettings)
{
try
{
if (string.IsNullOrEmpty(jsonSettings))
{
return JsonConvert.SerializeObject(new { Success = false, Message = "Empty settings data" });
}
var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonSettings);
// Update properties using reflection or manual mapping
// Since Setting class inherits arUtil.Setting and might have complex types, manual mapping for known properties or generic reflection is better.
// For now, let's target 'Theme' specifically as requested, and generic handling for others if possible?
// Actually, Pub.setting is an instance. We can try to deserialize INTO it, or update properties.
if (dict.ContainsKey("Theme"))
{
Pub.setting.Theme = dict["Theme"]?.ToString();
}
// Add other setting properties here as needed in the future
// or implement a generic property updater
Pub.setting.Save(); // Save to XML
return JsonConvert.SerializeObject(new { Success = true });
}
catch (Exception ex)
{
return JsonConvert.SerializeObject(new { Success = false, Message = ex.Message });
}
}
}
}