From 5806ee9b808a01d8609b5e815eb8927772b191b2 Mon Sep 17 00:00:00 2001 From: Patrick Simpson Date: Wed, 18 Jan 2017 14:13:22 +0100 Subject: [PATCH] Made "Background" the default threading option --- src/AcaciaZPushPlugin/AcaciaZPushPlugin/DebugOptions.cs | 8 +++++++- src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/DebugOptions.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/DebugOptions.cs index a5b468c..93127fa 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/DebugOptions.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/DebugOptions.cs @@ -68,19 +68,25 @@ namespace Acacia } public class EnumOption : Option + where EnumType : struct { + private readonly EnumType? _defaultValue; + private EnumType DefaultValue { get { + if (_defaultValue.HasValue) + return (EnumType)_defaultValue; return (EnumType)typeof(EnumType).GetEnumValues().GetValue(0); } } - public EnumOption(string token) + public EnumOption(string token, EnumType? defaultValue = null) : base(token) { + this._defaultValue = defaultValue; } public override string GetToken(EnumType value) diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs index ceca0c8..b31b125 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs @@ -51,7 +51,7 @@ namespace Acacia get { return GetOption(null, THREADING); } set { SetOption(null, THREADING, value); } } - private static readonly EnumOption THREADING = new EnumOption("Threading"); + private static readonly EnumOption THREADING = new EnumOption("Threading", Threading.Background); [AcaciaOption("Enables or disables ZPush account checking. To enable advanced features, it must be known " + "which accounts use ZPush servers. This option checks responses from ActiveSync servers to " +