| 12345678910111213141516171819202122232425 |
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- namespace LocalizationTool.Models
- {
- /// <summary>表格行:一条中文源文 + 各语言译文单元格。</summary>
- public class RowVm : INotifyPropertyChanged
- {
- public int Index { get; set; }
- public string Key { get; set; }
- /// <summary>单元格字典,key = 语言代码(如 "en-US")。用 Dictionary 是为了支持 XAML 的 Cells[code] 字符串索引绑定。</summary>
- public Dictionary<string, CellVm> Cells { get; set; } = new Dictionary<string, CellVm>();
- public int MissingCount => Cells.Values.Count(c => c.IsMissing);
- public string MissingText => MissingCount == 0 ? "全译" : $"缺 {MissingCount}";
- public bool HasMissing => MissingCount > 0;
- public event PropertyChangedEventHandler PropertyChanged;
- public void Touch() => OnPropertyChanged(nameof(MissingCount));
- private void OnPropertyChanged(string n) =>
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
- }
- }
|