🚨 捕获异常, 取消崩溃通知

This commit is contained in:
BookerLiu
2023-04-23 21:42:55 +08:00
parent ac8302280f
commit 1d6830b30b
6 changed files with 77 additions and 58 deletions

View File

@@ -124,11 +124,14 @@ namespace ShowSeconds
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (ScreenUtil.IsPrimaryFullScreen()) return;
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
{
try
{
int x = e.X;
int y = e.Y;
@@ -197,8 +200,8 @@ namespace ShowSeconds
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
int sx = (int)(SystemParameters.PrimaryScreenWidth * lProportion);
int sMarginBottom = (int)(SystemParameters.WorkArea.Height * tProportion);
@@ -209,7 +212,7 @@ namespace ShowSeconds
}
else
{
BGBorder.Visibility= Visibility.Collapsed;
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
@@ -217,22 +220,25 @@ namespace ShowSeconds
else if (true)
{
if ((expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 598 / h * height
|| y > 1020 / h * height)
)
|| !expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 950 / h * height
|| y > 1020 / h * height)
)
|| x > 1906 / w * width
|| y < 598 / h * height
|| y > 1020 / h * height)
)
|| !expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 950 / h * height
|| y > 1020 / h * height)
)
{
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
}
catch (Exception) { }
}));
}
}