diff options
author | sr55 <[email protected]> | 2014-12-20 16:10:21 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-12-20 16:10:21 +0000 |
commit | 3db4de8fa29af0c883f0bd90333629d79d64183b (patch) | |
tree | ecebde015efd41ffc6e7b96912d881e320be2dcc | |
parent | 1242ef643baa3d47818774058116cc185985b5da (diff) |
WinGui: Fix the Check for update frequency setting. (Removed daily as an option to reduce server load)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6624 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/CS/HandBrakeWPF/Services/UpdateService.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 17 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/defaultsettings.xml | 2 |
3 files changed, 9 insertions, 16 deletions
diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs index 2064e8e5c..ed093baf9 100644 --- a/win/CS/HandBrakeWPF/Services/UpdateService.cs +++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs @@ -64,8 +64,10 @@ namespace HandBrakeWPF.Services // Make sure it's running on the calling thread
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UpdateStatus))
{
- if (DateTime.Now.Subtract(this.userSettingService.GetUserSetting<DateTime>(UserSettingConstants.LastUpdateCheckDate)).TotalDays
- > this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck))
+ DateTime lastUpdateCheck = this.userSettingService.GetUserSetting<DateTime>(UserSettingConstants.LastUpdateCheckDate);
+ int checkFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck) == 0 ? 7 : 30;
+
+ if (DateTime.Now.Subtract(lastUpdateCheck).TotalDays > checkFrequency)
{
this.userSettingService.SetUserSetting(UserSettingConstants.LastUpdateCheckDate, DateTime.Now);
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index bb303aef5..38c1dcd55 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1417,22 +1417,13 @@ namespace HandBrakeWPF.ViewModels // Days between update checks
this.checkForUpdatesFrequencies.Clear();
- this.checkForUpdatesFrequencies.Add("Daily");
this.checkForUpdatesFrequencies.Add("Weekly");
this.checkForUpdatesFrequencies.Add("Monthly");
- // TODO Refactor this.
- switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck))
- {
- case 1:
- this.CheckForUpdatesFrequency = 0;
- break;
- case 7:
- this.CheckForUpdatesFrequency = 1;
- break;
- default:
- this.CheckForUpdatesFrequency = 2;
- break;
+ this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck);
+ if (this.CheckForUpdatesFrequency > 1)
+ {
+ this.CheckForUpdatesFrequency = 1;
}
// On Encode Completeion Action
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml index 80fee8569..5525a2e05 100644 --- a/win/CS/HandBrakeWPF/defaultsettings.xml +++ b/win/CS/HandBrakeWPF/defaultsettings.xml @@ -197,7 +197,7 @@ <string>daysBetweenUpdateCheck</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">30</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">1</anyType>
</value>
</item>
<item>
|