diff --git a/DailyDesktop.Core/DailyDesktopCore.cs b/DailyDesktop.Core/DailyDesktopCore.cs
index ff27a0f..4028f8a 100644
--- a/DailyDesktop.Core/DailyDesktopCore.cs
+++ b/DailyDesktop.Core/DailyDesktopCore.cs
@@ -18,11 +18,14 @@ public class DailyDesktopCore
private const string TASK_NAME_PREFIX = "Daily Desktop";
private const string TASK_EXECUTABLE = "DailyDesktop.Task.exe";
private const string DEFAULT_UPDATE_TIME = "12:00 AM";
+ private const int DEFAULT_BLUR_STRENGTH = 40;
private readonly ProviderStore store;
private readonly Task task;
private bool enabled;
+ private bool doBlurredFit;
+ private int blurStrength;
private IProvider currentProvider;
private DateTime updateTime;
@@ -40,6 +43,26 @@ public bool Enabled
}
}
+ public bool DoBlurredFit
+ {
+ get => doBlurredFit;
+ set
+ {
+ doBlurredFit = value;
+ updateTask();
+ }
+ }
+
+ public int BlurStrength
+ {
+ get => blurStrength;
+ set
+ {
+ blurStrength = value;
+ updateTask();
+ }
+ }
+
public IProvider CurrentProvider
{
get => currentProvider;
@@ -105,6 +128,17 @@ private ExecAction execAction
}
}
+ private string[] execArguments
+ {
+ get => execAction.Arguments?.Split(" ");
+ set
+ {
+ execAction.Arguments = string.Join(" ", value);
+ }
+ }
+
+ private int execArgumentsCount => execArguments?.Length ?? 0;
+
//-----------------------------------------------------------------METHODS
public DailyDesktopCore()
@@ -144,24 +178,34 @@ public DailyDesktopCore()
};
taskDefinition.Actions.Add(newExecAction);
+#if (!DEBUG)
+ taskDefinition.Settings.Hidden = true;
+#endif
+
task = TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, taskDefinition);
- currentProvider = null;
}
else
{
- string key = execAction.Arguments;
+ string key = (execArgumentsCount < 1) ? null : execArguments[0];
if (key != null && store.Providers.ContainsKey(key))
store.Providers.TryGetValue(key, out currentProvider);
- else
- currentProvider = null;
execAction.Path = taskExecutablePath;
task.RegisterChanges();
}
- updateTime = dailyTrigger.StartBoundary;
enabled = dailyTrigger.Enabled;
+ updateTime = dailyTrigger.StartBoundary;
+
+ if (execArgumentsCount >= 2 && int.TryParse(execArguments[1], out blurStrength))
+ {
+ doBlurredFit = true;
+ } else
+ {
+ doBlurredFit = false;
+ blurStrength = DEFAULT_BLUR_STRENGTH;
+ }
}
public void UpdateWallpaper()
@@ -172,7 +216,9 @@ public void UpdateWallpaper()
private void updateTask()
{
dailyTrigger.StartBoundary = updateTime;
- execAction.Arguments = currentProvider?.Key ?? string.Empty;
+ string key = currentProvider?.Key ?? string.Empty;
+ string blur = doBlurredFit ? blurStrength.ToString() : string.Empty;
+ execArguments = new string[] { key, blur };
dailyTrigger.Enabled = enabled;
logonTrigger.Enabled = enabled;
task.RegisterChanges();
diff --git a/DailyDesktop.Desktop/MainForm.Designer.cs b/DailyDesktop.Desktop/MainForm.Designer.cs
index 7f75319..e4efe8d 100644
--- a/DailyDesktop.Desktop/MainForm.Designer.cs
+++ b/DailyDesktop.Desktop/MainForm.Designer.cs
@@ -233,10 +233,9 @@ private void InitializeComponent()
this.blurredFitCheckBox.Size = new System.Drawing.Size(114, 19);
this.blurredFitCheckBox.TabIndex = 4;
this.blurredFitCheckBox.Text = "Blurred-fit mode";
- this.mainToolTip.SetToolTip(this.blurredFitCheckBox, "Sizes wallpaper to fit the display resolution like Windows\r\nwallpaper Fit mode, b" +
- "ut the background is an enlarged\r\nand blurred portion of the picture instead of " +
- "a solid color.");
+ this.mainToolTip.SetToolTip(this.blurredFitCheckBox, resources.GetString("blurredFitCheckBox.ToolTip"));
this.blurredFitCheckBox.UseVisualStyleBackColor = true;
+ this.blurredFitCheckBox.CheckedChanged += new System.EventHandler(this.blurredFitCheckBox_CheckedChanged);
//
// updateTimePicker
//
@@ -260,8 +259,8 @@ private void InitializeComponent()
this.enabledCheckBox.Size = new System.Drawing.Size(68, 19);
this.enabledCheckBox.TabIndex = 2;
this.enabledCheckBox.Text = "Enabled";
- this.mainToolTip.SetToolTip(this.enabledCheckBox, "Whether automatic desktop background update triggers should be enabled or disable" +
- "d.");
+ this.mainToolTip.SetToolTip(this.enabledCheckBox, "Whether automatic desktop wallpaper update triggers should be enabled or disabled" +
+ ".");
this.enabledCheckBox.UseVisualStyleBackColor = false;
this.enabledCheckBox.CheckedChanged += new System.EventHandler(this.enabledCheckBox_CheckedChanged);
//
@@ -273,7 +272,7 @@ private void InitializeComponent()
this.updateTimeLabel.Size = new System.Drawing.Size(72, 15);
this.updateTimeLabel.TabIndex = 1;
this.updateTimeLabel.Text = "Update time";
- this.mainToolTip.SetToolTip(this.updateTimeLabel, "When in the day to trigger an automatic desktop background update. If the time is" +
+ this.mainToolTip.SetToolTip(this.updateTimeLabel, "When in the day to trigger an automatic desktop wallpaper update.\r\nIf the time is" +
" missed, then it will trigger on next logon.");
//
// providersDirectoryButton
@@ -296,7 +295,7 @@ private void InitializeComponent()
this.updateWallpaperButton.Name = "updateWallpaperButton";
this.updateWallpaperButton.Size = new System.Drawing.Size(338, 23);
this.updateWallpaperButton.TabIndex = 6;
- this.updateWallpaperButton.Text = "Update desktop background";
+ this.updateWallpaperButton.Text = "Update desktop wallpaper";
this.updateWallpaperButton.UseVisualStyleBackColor = true;
this.updateWallpaperButton.Click += new System.EventHandler(this.updateWallpaperButton_Click);
//
@@ -357,7 +356,6 @@ private void InitializeComponent()
private System.Windows.Forms.Panel optionsPanel;
private System.Windows.Forms.Label providerDescriptionLabel;
private System.Windows.Forms.CheckBox blurredFitCheckBox;
- private System.Windows.Forms.CheckBox blurredFitCheckBox1;
private System.Windows.Forms.Label blurStrengthLabel;
private System.Windows.Forms.TrackBar blurStrengthTrackBar;
private System.Windows.Forms.ToolTip mainToolTip;
diff --git a/DailyDesktop.Desktop/MainForm.cs b/DailyDesktop.Desktop/MainForm.cs
index 9b0bfd9..4d06b21 100644
--- a/DailyDesktop.Desktop/MainForm.cs
+++ b/DailyDesktop.Desktop/MainForm.cs
@@ -28,6 +28,10 @@ private void MainForm_Load(object sender, EventArgs e)
enabledCheckBox.Checked = core.Enabled;
updateTimePicker.Value = core.UpdateTime;
+ updateTimePicker.Enabled = enabledCheckBox.Checked;
+ blurredFitCheckBox.Checked = core.DoBlurredFit;
+ blurStrengthTrackBar.Value = core.BlurStrength;
+ blurStrengthTrackBar.Enabled = blurredFitCheckBox.Checked;
updateBlurStrengthToolTip();
}
@@ -72,6 +76,7 @@ private void updateTimePicker_ValueChanged(object sender, EventArgs e)
private void enabledCheckBox_CheckedChanged(object sender, EventArgs e)
{
core.Enabled = enabledCheckBox.Checked;
+ updateTimePicker.Enabled = enabledCheckBox.Checked;
}
private void updateWallpaperButton_Click(object sender, EventArgs e)
@@ -96,6 +101,7 @@ private void okButton_Click(object sender, EventArgs e)
private void blurStrengthTrackBar_Scroll(object sender, EventArgs e)
{
+ core.BlurStrength = blurStrengthTrackBar.Value;
updateBlurStrengthToolTip();
}
@@ -104,5 +110,11 @@ private void updateBlurStrengthToolTip()
string strength = (blurStrengthTrackBar.Value / 100f).ToString("0.00");
mainToolTip.SetToolTip(blurStrengthTrackBar, strength);
}
+
+ private void blurredFitCheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ core.DoBlurredFit = blurredFitCheckBox.Checked;
+ blurStrengthTrackBar.Enabled = blurredFitCheckBox.Checked;
+ }
}
}
diff --git a/DailyDesktop.Desktop/MainForm.resx b/DailyDesktop.Desktop/MainForm.resx
index 3f0a50f..5a78a96 100644
--- a/DailyDesktop.Desktop/MainForm.resx
+++ b/DailyDesktop.Desktop/MainForm.resx
@@ -57,6 +57,18 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Sizes wallpaper to fit within the display's dimensions,
+but the leftover background is filled with an enlarged
+and blurred portion of the picture instead of a solid color.
+This effect is only noticeable if the wallpaper's aspect
+ratio is different from the primary display's aspect ratio.
+
+If you want to change the official fit mode, the option
+is in the Personalization settings in Windows, the same
+as normal.
+
+
diff --git a/DailyDesktop.Task/Properties/launchSettings.json b/DailyDesktop.Task/Properties/launchSettings.json
index 485ecce..7835800 100644
--- a/DailyDesktop.Task/Properties/launchSettings.json
+++ b/DailyDesktop.Task/Properties/launchSettings.json
@@ -1,7 +1,7 @@
{
- "profiles": {
- "DailyDesktop.Task": {
- "commandName": "Project"
- }
+ "profiles": {
+ "DailyDesktop.Task": {
+ "commandName": "Project"
}
-}
+ }
+}
\ No newline at end of file