AutoUpdateSettings.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using InABox.Configuration;
  2. using InABox.Core;
  3. namespace Comal.Classes
  4. {
  5. public interface IAutoUpdateSettings
  6. {
  7. AutoUpdateType Type { get; set; }
  8. string Location { get; set; }
  9. AutoUpdateChannel Channel { get; set; }
  10. bool Elevated { get; set; }
  11. }
  12. public class AutoUpdateSettings : ILocalConfigurationSettings, IAutoUpdateSettings
  13. {
  14. public AutoUpdateSettings()
  15. {
  16. Channel = AutoUpdateChannel.Stable;
  17. Type = AutoUpdateType.Url;
  18. Location = "https://prsdigital.com.au/updates/prs";
  19. Elevated = false;
  20. }
  21. public AutoUpdateChannel Channel { get; set; }
  22. public AutoUpdateType Type { get; set; }
  23. public string Location { get; set; }
  24. public bool Elevated { get; set; }
  25. public EditableAutoUpdateSettings ToEditable()
  26. {
  27. return new EditableAutoUpdateSettings
  28. {
  29. Channel = Channel,
  30. Type = Type,
  31. Location = Location,
  32. Elevated = Elevated
  33. };
  34. }
  35. public void FromEditable(EditableAutoUpdateSettings editable)
  36. {
  37. Channel = editable.Channel;
  38. Type = editable.Type;
  39. Location = editable.Location;
  40. Elevated = editable.Elevated;
  41. }
  42. }
  43. [Caption("Auto Update Settings")]
  44. public class EditableAutoUpdateSettings : BaseObject, IAutoUpdateSettings
  45. {
  46. [EditorSequence(1)]
  47. [EnumLookupEditor(typeof(AutoUpdateType))]
  48. public AutoUpdateType Type { get; set; }
  49. [EditorSequence(2)]
  50. [TextBoxEditor]
  51. public string Location { get; set; }
  52. [EditorSequence(3)]
  53. [EnumLookupEditor(typeof(AutoUpdateChannel))]
  54. public AutoUpdateChannel Channel { get; set; }
  55. [EditorSequence(4)]
  56. [CheckBoxEditor]
  57. public bool Elevated { get; set; }
  58. }
  59. }