diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.Designer.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.Designer.cs index 94f2128..ead5216 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.Designer.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.Designer.cs @@ -156,7 +156,7 @@ resources.GetString("comboTimeFrame.Items5"), resources.GetString("comboTimeFrame.Items6"), resources.GetString("comboTimeFrame.Items7"), - resources.GetString("comboTimeFrame.Items8")}); + resources.GetString("comboTimeFrame.Items101")}); // custom time frame value this.comboTimeFrame.Name = "comboTimeFrame"; this.comboTimeFrame.SelectedIndexChanged += new System.EventHandler(this.comboTimeFrame_SelectedIndexChanged); // diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.cs index bccaa5e..a6bf911 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.cs @@ -36,6 +36,8 @@ namespace Acacia.Features.SyncState private readonly Button[] _syncButtons; + private readonly System.ComponentModel.ComponentResourceManager resources; + private ZPushAccount SelectedAccount { get @@ -48,6 +50,9 @@ namespace Acacia.Features.SyncState { InitializeComponent(); + // Used for handling custom time frame values. + resources = new System.ComponentModel.ComponentResourceManager(typeof(SyncStateDialog)); + // Ensure these are in sync with ResyncOption _syncButtons = new Button[] { @@ -81,6 +86,9 @@ namespace Acacia.Features.SyncState if (SelectedAccount == null) comboTimeFrame.SelectedIndex = 0; + // Custom values handling. Custom values will be appended into comboTimeFrame after the last standard value (7) + else if (SelectedAccount.SyncTimeFrame == (SyncTimeFrame)(int)SyncTimeFrame.YEAR_1) // 1 year + comboTimeFrame.SelectedIndex = comboTimeFrame.Items.IndexOf(resources.GetString("comboTimeFrame.Items101")); else comboTimeFrame.SelectedIndex = (int)SelectedAccount.SyncTimeFrame; @@ -97,8 +105,17 @@ namespace Acacia.Features.SyncState if (SelectedAccount != null) { SyncTimeFrame timeFrame = (SyncTimeFrame)comboTimeFrame.SelectedIndex; - bool isDirty = timeFrame != SelectedAccount.SyncTimeFrame; - buttonApplyTimeFrame.Enabled = buttonResetTimeFrame.Enabled = isDirty; + // Handle custom values + if ((int)timeFrame == comboTimeFrame.Items.IndexOf(resources.GetString("comboTimeFrame.Items101"))) + { + bool isDirty = SelectedAccount.SyncTimeFrame != (SyncTimeFrame)(int)SyncTimeFrame.YEAR_1; + buttonApplyTimeFrame.Enabled = buttonResetTimeFrame.Enabled = isDirty; + } + else + { + bool isDirty = timeFrame != SelectedAccount.SyncTimeFrame; + buttonApplyTimeFrame.Enabled = buttonResetTimeFrame.Enabled = isDirty; + } } else { @@ -118,8 +135,16 @@ namespace Acacia.Features.SyncState { Busy = true; - // TODO: do this in the background - _feature.SetDeviceOptions(SelectedAccount, (SyncTimeFrame)comboTimeFrame.SelectedIndex); + // Custom values handling. Custom values will be appended into comboTimeFrame after the last standard value (7) + if (comboTimeFrame.SelectedItem.Equals(resources.GetString("comboTimeFrame.Items101"))) + { + _feature.SetDeviceOptions(SelectedAccount, (SyncTimeFrame)(int)SyncTimeFrame.YEAR_1); + } + else + { + // TODO: do this in the background + _feature.SetDeviceOptions(SelectedAccount, (SyncTimeFrame)comboTimeFrame.SelectedIndex); + } CheckTimeFrameDirty(); } } diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.resx b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.resx index ce5dc53..c7427bd 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.resx +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SyncState/SyncStateDialog.resx @@ -444,7 +444,7 @@ 6 months - + 1 year diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushTypes.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushTypes.cs index 06947c5..8306e65 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushTypes.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushTypes.cs @@ -162,7 +162,7 @@ namespace Acacia.ZPush MONTH_1, MONTH_3, MONTH_6, - YEAR_1 + YEAR_1 = 101 // Custom value } public static class SyncTimeFrameMethods