127 lines
3.1 KiB
C#
127 lines
3.1 KiB
C#
|
|
using System;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 数据持久化服务接口
|
|||
|
|
/// 负责应用设置、用户数据、系统配置的保存和加载
|
|||
|
|
/// </summary>
|
|||
|
|
public interface IDataPersistenceService : IService
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存系统设置
|
|||
|
|
/// </summary>
|
|||
|
|
bool SaveSettings(SystemSettings settings);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 加载系统设置
|
|||
|
|
/// </summary>
|
|||
|
|
SystemSettings LoadSettings();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存用户偏好设置
|
|||
|
|
/// </summary>
|
|||
|
|
bool SaveUserPreferences(string userId, UserPreferences preferences);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 加载用户偏好设置
|
|||
|
|
/// </summary>
|
|||
|
|
UserPreferences LoadUserPreferences(string userId);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存应用配置
|
|||
|
|
/// </summary>
|
|||
|
|
bool SaveAppConfig(AppConfig config);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 加载应用配置
|
|||
|
|
/// </summary>
|
|||
|
|
AppConfig LoadAppConfig();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导出数据到指定路径
|
|||
|
|
/// </summary>
|
|||
|
|
bool ExportData(string filePath, ExportDataType dataType);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 清除所有持久化数据
|
|||
|
|
/// </summary>
|
|||
|
|
void ClearAllData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 系统设置数据结构
|
|||
|
|
/// </summary>
|
|||
|
|
[System.Serializable]
|
|||
|
|
public class SystemSettings
|
|||
|
|
{
|
|||
|
|
public float brightness = 50f;
|
|||
|
|
public int volume = 50;
|
|||
|
|
public int muteDurationMinutes = 3;
|
|||
|
|
public DateTime systemTime = DateTime.MinValue;
|
|||
|
|
public bool useCustomSystemTime = false;
|
|||
|
|
public long customTimeOffsetTicks = 0;
|
|||
|
|
public NetworkConfig network = new NetworkConfig
|
|||
|
|
{
|
|||
|
|
Mode = NetworkMode.Dhcp,
|
|||
|
|
IPv4 = "",
|
|||
|
|
Mask = "",
|
|||
|
|
Gateway = "",
|
|||
|
|
Dns1 = "",
|
|||
|
|
Dns2 = ""
|
|||
|
|
};
|
|||
|
|
public string version = "1.0.0";
|
|||
|
|
public bool autoBackup = true;
|
|||
|
|
public int dataRetentionDays = 30;
|
|||
|
|
|
|||
|
|
// 串口通信相关设置
|
|||
|
|
public string serialPortName = "COM1";
|
|||
|
|
public int serialBaudRate = 115200;
|
|||
|
|
public bool enableSerialCommunication = true;
|
|||
|
|
|
|||
|
|
// BFI阈值设置
|
|||
|
|
public float bfiLowThreshold = 30f; // BFI低值阈值,默认30
|
|||
|
|
public float bfiHighThreshold = 70f; // BFI高值阈值,默认70
|
|||
|
|
public int bfiAlarmPriority = 2; // BFI报警优先级,默认高优先级(2)
|
|||
|
|
public bool enableBFIAlarm = true; // 是否启用BFI报警,默认启用
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 用户偏好设置
|
|||
|
|
/// </summary>
|
|||
|
|
[System.Serializable]
|
|||
|
|
public class UserPreferences
|
|||
|
|
{
|
|||
|
|
public string userId;
|
|||
|
|
public string theme = "default";
|
|||
|
|
public bool soundEnabled = true;
|
|||
|
|
public float uiScale = 1.0f;
|
|||
|
|
public string language = "zh-CN";
|
|||
|
|
public bool autoLogin = false;
|
|||
|
|
public DateTime lastLoginTime;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 应用配置
|
|||
|
|
/// </summary>
|
|||
|
|
[System.Serializable]
|
|||
|
|
public class AppConfig
|
|||
|
|
{
|
|||
|
|
public string appName = "DCX系统";
|
|||
|
|
public string companyName = "瑞懿为";
|
|||
|
|
public bool debugMode = false;
|
|||
|
|
public int maxLogFiles = 10;
|
|||
|
|
public bool enableLogging = true;
|
|||
|
|
public string logLevel = "Info";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导出数据类型
|
|||
|
|
/// </summary>
|
|||
|
|
public enum ExportDataType
|
|||
|
|
{
|
|||
|
|
Settings,
|
|||
|
|
UserData,
|
|||
|
|
AlarmRecords,
|
|||
|
|
PatientInfo,
|
|||
|
|
SystemLogs,
|
|||
|
|
All
|
|||
|
|
}
|