Skip to content

Commit

Permalink
feat: 移除提醒中默认的Beep声,增加ML房提醒开关
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-kirisame committed Aug 14, 2022
1 parent e51eafd commit f89f8b3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 22 deletions.
8 changes: 3 additions & 5 deletions HousingCheck/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ public class Config
/// <summary>
/// 启用ML房通知提醒
/// </summary>
/// <remarks>
/// 为防止错过提示,此选项永远为True
/// </remarks>
public bool EnableNotifyHouseML => true;
public bool EnableNotifyHouseML { get; set; }

/// <summary>
/// 忽略穹顶皓天
Expand Down Expand Up @@ -132,7 +129,7 @@ public void LoadSettings()
EnableUploadSnapshot = bool.Parse(head?.SelectSingleNode("UploadSnapshot")?.InnerText ?? "true");
EnableTTS = bool.Parse(head?.SelectSingleNode("TTSNotify")?.InnerText ?? "false");
EnableNotification = bool.Parse(head?.SelectSingleNode("ShellNotify")?.InnerText ?? "false");
// EnableNotifyHouseML = true;
EnableNotifyHouseML = bool.Parse(head?.SelectSingleNode("NotifyHouseML")?.InnerText ?? "true");
EnableNotifyHouseS = bool.Parse(head?.SelectSingleNode("NotifyHouseS")?.InnerText ?? "false");
IgnoreEmpyreum = bool.Parse(head?.SelectSingleNode("IgnoreEmpyreum")?.InnerText ?? "true");
EnableNotifyCheck = bool.Parse(head?.SelectSingleNode("NotifyCheck")?.InnerText ?? "false");
Expand Down Expand Up @@ -169,6 +166,7 @@ public void SaveSettings()
xWriter.WriteElementString("TTSNotify", EnableTTS.ToString());
xWriter.WriteElementString("ShellNotify", EnableNotification.ToString());
xWriter.WriteElementString("NotifyHouseS", EnableNotifyHouseS.ToString());
xWriter.WriteElementString("NotifyHouseML", EnableNotifyHouseML.ToString());
xWriter.WriteElementString("IgnoreEmpyreum", IgnoreEmpyreum.ToString());
xWriter.WriteElementString("NotifyCheck", EnableNotifyCheck.ToString());
xWriter.WriteElementString("NotifyCheckAhead", CheckNotifyAheadTime.ToString());
Expand Down
15 changes: 0 additions & 15 deletions HousingCheck/HousingCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ void NotifyEmptyHouse(HousingOnSaleItem onSaleItem, bool exists)
if (onSaleItem.Area == HouseArea.穹顶皓天 && config.IgnoreEmpyreum)
return;

bool fallback = true;
if (config.EnableNotification)
{
var title = string.Format("{0} 第{1}区 {2}号 {3}房",
Expand All @@ -257,7 +256,6 @@ void NotifyEmptyHouse(HousingOnSaleItem onSaleItem, bool exists)
.AddText("新空房")
.AddText(title)
.Show();
fallback = false;
}
if (config.EnableTTS)
{
Expand All @@ -269,20 +267,7 @@ void NotifyEmptyHouse(HousingOnSaleItem onSaleItem, bool exists)
onSaleItem.SizeStr
)
);
fallback = false;
}
if (fallback)
{
PlayAlert();
}
}

/// <summary>
/// 播放提示音
/// </summary>
void PlayAlert()
{
Console.Beep(3000, 1000);
}

void WriteActLog(string message)
Expand Down
2 changes: 1 addition & 1 deletion HousingCheck/HousingCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<RootNamespace>HousingCheck</RootNamespace>
<AssemblyName>HousingCheck</AssemblyName>
<TargetFramework>net472</TargetFramework>
<Version>1.6.6</Version>
<Version>1.6.7</Version>
<Copyright>Copyright ©2021 Bluefissure, Hyperzlib. Copyright ©2021-2022 Lotlab</Copyright>
<ILMergeDebugInfo>false</ILMergeDebugInfo>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions HousingCheck/PluginControlViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public int UploadApiVersion
public bool EnableTTS { get => config.EnableTTS; set { config.EnableTTS = value; OnPropertyChanged(); } }
public bool EnableNotification { get => config.EnableNotification; set { config.EnableNotification = value; OnPropertyChanged(); } }
public bool EnableNotifyHouseS { get => config.EnableNotifyHouseS; set { config.EnableNotifyHouseS = value; OnPropertyChanged(); } }
public bool EnableNotifyHouseML { get => config.EnableNotifyHouseML; set { config.EnableNotifyHouseML = value; OnPropertyChanged(); } }
public bool IgnoreEmpyreum { get => config.IgnoreEmpyreum; set { config.IgnoreEmpyreum = value; OnPropertyChanged(); } }
public bool EnableNotifyCheck { get => config.EnableNotifyCheck; set { config.EnableNotifyCheck = value; OnPropertyChanged(); } }
public string CheckNotifyAheadTime { get => config.CheckNotifyAheadTime.ToString(); set { config.CheckNotifyAheadTime = int.Parse(value); OnPropertyChanged(); } }
Expand Down
2 changes: 1 addition & 1 deletion HousingCheck/PluginControlWpf.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<GroupBox Header="空房通知" Padding="5,2">
<StackPanel Height="26px" VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox VerticalContentAlignment="Center" IsChecked="{Binding EnableNotifyHouseS}">S房</CheckBox>
<CheckBox VerticalContentAlignment="Center" Margin="10, 0, 0, 0" IsChecked="True" IsEnabled="False">M/L房</CheckBox>
<CheckBox VerticalContentAlignment="Center" Margin="10, 0, 0, 0" IsChecked="{Binding EnableNotifyHouseML}">M/L房</CheckBox>
<CheckBox VerticalContentAlignment="Center" Margin="10, 0, 0, 0" IsChecked="{Binding IgnoreEmpyreum}">忽略穹顶皓天</CheckBox>
</StackPanel>
</GroupBox>
Expand Down

0 comments on commit f89f8b3

Please sign in to comment.