From 2004cb531c241c3b7e2ee0493e0cee124756706f Mon Sep 17 00:00:00 2001 From: clover-yan Date: Sun, 4 Jun 2023 12:12:05 +0800 Subject: [PATCH] Commit --- DateCountdown/MainWindow.xaml.cs | 28 +++++++++--------------- DateCountdown/Properties/AssemblyInfo.cs | 4 ++-- README.md | 10 ++++++--- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/DateCountdown/MainWindow.xaml.cs b/DateCountdown/MainWindow.xaml.cs index 3deeb48..cf3145c 100644 --- a/DateCountdown/MainWindow.xaml.cs +++ b/DateCountdown/MainWindow.xaml.cs @@ -116,22 +116,11 @@ private void DispatcherTimer_Tick(object sender, EventArgs e) reded = true; TextBlockDays.Foreground = new SolidColorBrush(Colors.Red) { Opacity = alpha ? 0.5 : 1 }; } - string detailStr = Math.Abs(detailNum).ToString(StringFormat); - if (detailStr.StartsWith("1.")) + string detailStr = StringFormat == "." ? "" : Math.Abs(detailNum).ToString(StringFormat); + if (detailStr.StartsWith("1")) { - try - { - detailStr = "."; - int n = int.Parse(App.StartArgs[7]); - while (n-- > 0) - { - detailStr += "9"; - } - } - catch - { - detailStr = ".999"; - } + TextBlockDays.Text = ((timeSpan.Days < 0 || detailNum < 0.0) && neg ? "-" + (Math.Abs(timeSpan.Days)+1).ToString() : (Math.Abs(timeSpan.Days)+1).ToString()); + detailStr = StringFormat; } TextBlockDaysDetails.Text = detailStr; @@ -190,9 +179,12 @@ private void Window_Loaded(object sender, RoutedEventArgs e) StringFormat = "."; try { - TextBlockTitle.Text = App.StartArgs[0]; - if (TextBlockTitle.Text == "") { - TextBlockTitle.Text = "距离高考还有"; + string[] text = App.StartArgs[0].Split('|'); + if (text.Length == 1) + TextBlockTitle.Text = text[0] == "" ? text[0] : "距离高考还有"; + else { + TextBlockTitle.Text = text[0]; + AfterText.Text = text[1]; } } catch diff --git a/DateCountdown/Properties/AssemblyInfo.cs b/DateCountdown/Properties/AssemblyInfo.cs index 616f2eb..ece9dea 100644 --- a/DateCountdown/Properties/AssemblyInfo.cs +++ b/DateCountdown/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/README.md b/README.md index 07884b0..2c4f68b 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,15 @@ ### 参数 1 -指定将在计数数字前显示的**描述文本**。 +指定将在计数数字前后显示的**描述文本**。 -默认值为 `距离高考还有`。 +前后文本以管道符(`|`)分割。第二个管道符(`|`)后的内容会被忽略。 -> **请注意:如果想要不传递此参数,而传递之后的参数,请将此参数留空(设为 `""`)。** +如果文本不带有管道符(`|`),则只会改变前面的文本。 + +默认值为 `距离高考还有|天`。 + +> **请注意:如果想要不传递此参数,而传递之后的参数,请将此参数留空(设为 `""`)。如果需要只显示数字,请将此参数设为一个管道符(`|`)。** ### 参数 2 ~ 7