LogDataService.cs 810 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. namespace SKMC.Api.Common
  9. {
  10. public class LogDataService
  11. {
  12. private static LogDataService instance;
  13. private readonly object lockObject = new object();
  14. public ObservableCollection<LoggingEventModel> LogEventModels { get; set; } = new ObservableCollection<LoggingEventModel>();
  15. public static LogDataService Instance()
  16. {
  17. if (instance == null) instance = new LogDataService();
  18. return instance;
  19. }
  20. private LogDataService()
  21. {
  22. BindingOperations.EnableCollectionSynchronization(LogEventModels, lockObject);
  23. }
  24. }
  25. }