Skip to content

Commit

Permalink
Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
clover-yan committed Jun 4, 2023
1 parent 9174972 commit 2004cb5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
28 changes: 10 additions & 18 deletions DateCountdown/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions DateCountdown/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@

### 参数 1

指定将在计数数字前显示的**描述文本**
指定将在计数数字前后显示的**描述文本**

默认值为 `距离高考还有`
前后文本以管道符(`|`)分割。第二个管道符(`|`)后的内容会被忽略

> **请注意:如果想要不传递此参数,而传递之后的参数,请将此参数留空(设为 `""`)。**
如果文本不带有管道符(`|`),则只会改变前面的文本。

默认值为 `距离高考还有|天`

> **请注意:如果想要不传递此参数,而传递之后的参数,请将此参数留空(设为 `""`)。如果需要只显示数字,请将此参数设为一个管道符(`|`)。**
### 参数 2 ~ 7

Expand Down

0 comments on commit 2004cb5

Please sign in to comment.