| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TeamAAS_VP.Models.Lights
- {
- /// <summary>
- /// 表示单个灯通道的配置项。
- /// 包含通道名称、描述、控制器内索引、系统全局索引以及默认亮度等信息。
- /// 该类继承自 <see cref="BindableBase"/>,支持属性变更通知,适用于 WPF 数据绑定。
- /// </summary>
- public class ChannelConfig: BindableBase
- {
- private string _Name;
- /// <summary>
- /// 通道名称。
- /// 用于界面显示和识别通道,可为空字符串。
- /// </summary>
- public string Name
- {
- get { return _Name; }
- set { SetProperty(ref _Name, value); }
- }
- private string _Description;
- /// <summary>
- /// 通道描述。
- /// 对通道的补充说明,可用于显示在工具提示或详细信息面板中。
- /// </summary>
- public string Description
- {
- get { return _Description; }
- set { SetProperty(ref _Description, value); }
- }
- private int _LocalIndex;
- /// <summary>
- /// 控制器内的通道索引(局部索引)。
- /// 表示该通道在所属控制器中的位置,通常从 0 或 1 开始,取决于系统约定。
- /// </summary>
- public int LocalIndex
- {
- get { return _LocalIndex; }
- set { SetProperty(ref _LocalIndex, value); }
- }
- private int _GlobalIndex;
- /// <summary>
- /// 系统中的全局通道索引(全局唯一)。
- /// 在多控制器环境中用于唯一标识一个通道。
- /// </summary>
- public int GlobalIndex
- {
- get { return _GlobalIndex; }
- set { SetProperty(ref _GlobalIndex, value); }
- }
- private int _DefaultBrightness = 255;
- /// <summary>
- /// 默认亮度(百分比)。
- /// 范围通常为 0 到 100,表示通道的默认亮度设置。默认值为 100(表示最大亮度)。
- /// </summary>
- public int DefaultBrightness
- {
- get { return _DefaultBrightness; }
- set { SetProperty(ref _DefaultBrightness, value); }
- }
- /// <summary>
- /// 初始化 <see cref="ChannelConfig"/> 的新实例。
- /// 创建一个默认的通道配置对象,属性使用默认值。
- /// </summary>
- public ChannelConfig()
- {
- }
- /// <summary>
- /// 使用指定的索引和可选信息初始化 <see cref="ChannelConfig"/> 的新实例。
- /// </summary>
- /// <param name="localIndex">控制器内的通道索引(局部索引)。</param>
- /// <param name="globalIndex">系统中的全局通道索引(全局唯一)。</param>
- /// <param name="name">通道名称,可选,默认为空字符串。</param>
- /// <param name="description">通道描述,可选,默认为空字符串。</param>
- /// <param name="defaultBrightness">默认亮度(百分比),可选,默认值为 100。期望范围为 0 到 100。</param>
- public ChannelConfig(int localIndex, int globalIndex, string name = "", string description = "", int defaultBrightness = 100)
- {
- LocalIndex = localIndex;
- GlobalIndex = globalIndex;
- Name = name;
- Description = description;
- DefaultBrightness = defaultBrightness;
- }
- }
- public class ChannelConfigEx: ChannelConfig
- {
- //是否选中
- private bool _IsSelected;
- public bool IsSelected
- {
- get { return _IsSelected; }
- set { SetProperty(ref _IsSelected, value); }
- }
- public ChannelConfigEx() : base()
- {
- }
- public ChannelConfigEx(ChannelConfig channelConfig)
- {
- this.LocalIndex = channelConfig.LocalIndex;
- this.GlobalIndex = channelConfig.GlobalIndex;
- this.Name = channelConfig.Name;
- this.Description = channelConfig.Description;
- this.DefaultBrightness = channelConfig.DefaultBrightness;
- }
- public ChannelConfig ToChannelConfig()
- {
- return new ChannelConfig(this.LocalIndex, this.GlobalIndex, this.Name, this.Description, this.DefaultBrightness);
- }
- }
- }
|