CalendarAppointment.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.Windows.Media;
  4. using System.Windows.Media.Imaging;
  5. using InABox.WPF;
  6. using Syncfusion.UI.Xaml.Scheduler;
  7. namespace PRSDesktop
  8. {
  9. public interface ICalendarAppointment
  10. {
  11. // object Id { get; }
  12. // String? Subject { get; }
  13. // String? Notes { get; }
  14. // ObservableCollection<object> ResourceIdCollection { get; }
  15. // DateTime StartTime { get; }
  16. // DateTime EndTime { get; }
  17. // Brush Foreground { get; }
  18. // Brush AppointmentBackground { get; }
  19. BitmapImage? Image { get; }
  20. }
  21. public interface ICalendarAppointment<T> : ICalendarAppointment
  22. {
  23. T Model { get; }
  24. }
  25. public abstract class CalendarAppointment<T> : ScheduleAppointment, ICalendarAppointment<T> where T : IModel
  26. {
  27. //public object Id { get; set; }
  28. // public ObservableCollection<object> ResourceIdCollection { get; set; }
  29. //public Brush Foreground { get; set; }
  30. // public Brush AppointmentBackground { get; set; }
  31. //
  32. // public abstract DateTime StartTime { get; set; }
  33. // public abstract DateTime EndTime { get; set; }
  34. // public abstract string? Subject { get; set; }
  35. // public abstract string? Notes { get; set; }
  36. public BitmapImage? Image { get; set; }
  37. public T Model { get; }
  38. public CalendarAppointment(T model, Func<T?,Guid> employeeid, Func<T?,String> color)
  39. {
  40. Model = model;
  41. Id = model.ID;
  42. ResourceIdCollection = new ObservableCollection<object>() { employeeid(model).ToString() };
  43. String c = color(model);
  44. Color c2 = string.IsNullOrWhiteSpace(c)
  45. ? Colors.White
  46. : (Color)ColorConverter.ConvertFromString(c);
  47. AppointmentBackground = new SolidColorBrush(c2);
  48. Foreground = new SolidColorBrush(ImageUtils.GetForegroundColor(c2));
  49. }
  50. }
  51. public class CalendarAppointments : ScheduleAppointmentCollection //ObservableCollection<ICalendarAppointment> { }}
  52. {
  53. }
  54. }