DLOperationViewModel.cs 888 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections.ObjectModel;
  2. namespace DataLogModule.ViewModels;
  3. internal partial class DLOperationViewModel : ObservableObject
  4. {
  5. public DLOperationViewModel()
  6. {
  7. this.Logs = [];
  8. for (int i = 0; i < 3; i++)
  9. {
  10. OperationLog log = new()
  11. {
  12. AlarmType=(AlarmTypeEnum)i,
  13. Time = DateTime.Now,
  14. System="System",
  15. Description=$"Test Log {i}"
  16. };
  17. this.Logs.Add(log);
  18. }
  19. }
  20. [ObservableProperty]
  21. private ObservableCollection<OperationLog> _Logs;
  22. }
  23. public class OperationLog
  24. {
  25. public AlarmTypeEnum AlarmType { get; set; }
  26. public DateTime Time { get; set; }
  27. public string? System { get; set; }
  28. public string? Description { get; set; }
  29. }
  30. public enum AlarmTypeEnum
  31. {
  32. Info,
  33. Warning,
  34. Alarm
  35. }