Made "Background" the default threading option

This commit is contained in:
Patrick Simpson 2017-01-18 14:13:22 +01:00
parent ab37b666df
commit 5806ee9b80
2 changed files with 8 additions and 2 deletions

View File

@ -68,19 +68,25 @@ namespace Acacia
} }
public class EnumOption<EnumType> : Option<EnumType> public class EnumOption<EnumType> : Option<EnumType>
where EnumType : struct
{ {
private readonly EnumType? _defaultValue;
private EnumType DefaultValue private EnumType DefaultValue
{ {
get get
{ {
if (_defaultValue.HasValue)
return (EnumType)_defaultValue;
return (EnumType)typeof(EnumType).GetEnumValues().GetValue(0); return (EnumType)typeof(EnumType).GetEnumValues().GetValue(0);
} }
} }
public EnumOption(string token) public EnumOption(string token, EnumType? defaultValue = null)
: :
base(token) base(token)
{ {
this._defaultValue = defaultValue;
} }
public override string GetToken(EnumType value) public override string GetToken(EnumType value)

View File

@ -51,7 +51,7 @@ namespace Acacia
get { return GetOption(null, THREADING); } get { return GetOption(null, THREADING); }
set { SetOption(null, THREADING, value); } set { SetOption(null, THREADING, value); }
} }
private static readonly EnumOption<Threading> THREADING = new EnumOption<Threading>("Threading"); private static readonly EnumOption<Threading> THREADING = new EnumOption<Threading>("Threading", Threading.Background);
[AcaciaOption("Enables or disables ZPush account checking. To enable advanced features, it must be known " + [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 " + "which accounts use ZPush servers. This option checks responses from ActiveSync servers to " +