Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
增加若干功能
Browse files Browse the repository at this point in the history
  • Loading branch information
SugarMGP committed Jun 29, 2021
1 parent 5852eee commit a3da08d
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Configurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public static class Configurations
/// <summary>
/// <see cref="SeewoHelper.UISettings"/> 配置
/// </summary>
public static readonly Configuration<UISettings> UISettings = new(Path.Combine(Constants.ConfigurationPath, "UISettings.json"), new UISettings(UIStyle.LightBlue, LogLevel.Info, false, false, true));
public static readonly Configuration<UISettings> UISettings = new(Path.Combine(Constants.ConfigurationPath, "UISettings.json"), new UISettings(UIStyle.LightBlue, LogLevel.Info, false, false, true, true));
}
}
60 changes: 56 additions & 4 deletions src/Forms/WindowMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion src/Forms/WindowMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private void WindowMain_Load(object sender, EventArgs e)
LoadComboBoxLogLevel();
LoadAutoCheckUpdate();
LoadHideWhenStart();
LoadHideToNotify();
LoadDoubleClickNotify();
checkBoxAutoStart.Checked = AutoStartUtilities.IsAutoStart();
Program.Logger.Info($"{nameof(WindowMain)} 加载完成");
Expand All @@ -107,6 +108,11 @@ private void LoadDoubleClickNotify()
checkBoxDoubleClickNotify.Checked = Configurations.UISettings.Content.IsDoubleClickNotify;
}

private void LoadHideToNotify()
{
checkBoxHideToNotify.Checked = Configurations.UISettings.Content.IsHideToNotify;
}

private async void LoadAutoCheckUpdate()
{
bool isAutoCheckUpdate = Configurations.UISettings.Content.IsAutoCheckUpdate;
Expand All @@ -121,6 +127,8 @@ private async void LoadAutoCheckUpdate()
private void CreateServiceCheckBox()
{
checkBoxDisableServiceShellHardwareDetection.Tag = new ServiceCheckBox(checkBoxDisableServiceShellHardwareDetection, "ShellHWDetection", true) { PreAction = () => Cursor = Cursors.WaitCursor, PostAction = () => Cursor = Cursors.Default };
checkBoxDisableServiceWindowsUpdate.Tag = new ServiceCheckBox(checkBoxDisableServiceWindowsUpdate, "wuauserv", true) { PreAction = () => Cursor = Cursors.WaitCursor, PostAction = () => Cursor = Cursors.Default };
checkBoxDisableServiceWindowsSearch.Tag = new ServiceCheckBox(checkBoxDisableServiceWindowsSearch, "WSearch", true) { PreAction = () => Cursor = Cursors.WaitCursor, PostAction = () => Cursor = Cursors.Default };
}

private void LoadComboBoxStyle()
Expand Down Expand Up @@ -164,7 +172,7 @@ private void ListViewSubjectStorageInfos_DoubleClick(object sender, EventArgs e)

private void WindowMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
if (checkBoxHideToNotify.Checked && e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
HideWindow();
Expand Down Expand Up @@ -302,5 +310,12 @@ private void CheckBoxDoubleClickNotify_CheckedChanged(object sender, EventArgs e
Configurations.UISettings.Content = Configurations.UISettings.Content with { IsDoubleClickNotify = checkBoxDoubleClickNotify.Checked };
Configurations.UISettings.Save();
}

private void CheckBoxHideToNotify_CheckedChanged(object sender, EventArgs e)
{
checkBoxDoubleClickNotify.Enabled = checkBoxHideToNotify.Checked;
Configurations.UISettings.Content = Configurations.UISettings.Content with { IsHideToNotify = checkBoxHideToNotify.Checked };
Configurations.UISettings.Save();
}
}
}
2 changes: 1 addition & 1 deletion src/Models/UISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace SeewoHelper
/// <summary>
/// 表示 UI 设置
/// </summary>
public record UISettings(UIStyle Style, LogLevel LogLevel, bool IsHideWhenStart, bool IsAutoCheckUpdate, bool IsDoubleClickNotify);
public record UISettings(UIStyle Style, LogLevel LogLevel, bool IsHideWhenStart, bool IsAutoCheckUpdate, bool IsDoubleClickNotify, bool IsHideToNotify);
}
2 changes: 1 addition & 1 deletion src/SeewoHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<StartupObject>SeewoHelper.Program</StartupObject>
<Version>0.4.3</Version>
<Version>0.4.5</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit a3da08d

Please sign in to comment.