Skip to content

Commit a2c9aab

Browse files
committed
[fix] ShowNotificationAsync
1 parent 7bc690e commit a2c9aab

File tree

7 files changed

+16
-24
lines changed

7 files changed

+16
-24
lines changed

Ink Canvas/MainWindow_cs/MW_AutoFold.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ await Dispatcher.InvokeAsync(() =>
3434
{
3535
if (foldFloatingBarByUser && inkCanvas.Strokes.Count > 2)
3636
{
37-
ShowNotification("正在清空墨迹并收纳至侧边栏,可进入批注模式后通过【撤销】功能来恢复原先墨迹。");
37+
ShowNotificationAsync("正在清空墨迹并收纳至侧边栏,可进入批注模式后通过【撤销】功能来恢复原先墨迹。");
3838
}
3939
}
4040
CursorWithDelIcon_Click(null, null);

Ink Canvas/MainWindow_cs/MW_Notification.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using Ink_Canvas.Helpers;
2-
using System;
32
using System.Linq;
4-
using System.Threading;
53
using System.Threading.Tasks;
64
using System.Windows;
75

@@ -14,23 +12,17 @@ public partial class MainWindow : Window
1412

1513
public static void ShowNewMessage(string notice, bool isShowImmediately = true)
1614
{
17-
(Application.Current?.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow)?.ShowNotification(notice, isShowImmediately);
15+
(Application.Current?.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow)?.ShowNotificationAsync(notice, isShowImmediately);
1816
}
1917

20-
public void ShowNotification(string notice, bool isShowImmediately = true)
18+
public async Task ShowNotificationAsync(string notice, bool isShowImmediately = true)
2119
{
2220
try
2321
{
24-
lastNotificationShowTime = Environment.TickCount;
25-
2622
TextBlockNotice.Text = notice;
2723
AnimationsHelper.ShowWithSlideFromBottomAndFade(GridNotifications);
28-
29-
Task.Run(async () =>
30-
{
31-
await Task.Delay(300);
32-
AnimationsHelper.HideWithSlideAndFade(GridNotifications);
33-
});
24+
await Task.Delay(2000);
25+
AnimationsHelper.HideWithSlideAndFade(GridNotifications);
3426
}
3527
catch { }
3628
}

Ink Canvas/MainWindow_cs/MW_Save&OpenStrokes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ private void SaveInkCanvasStrokes(bool newNotice = true, bool saveByUser = false
4848
inkCanvas.Strokes.Save(fs);
4949
if (newNotice)
5050
{
51-
ShowNotification("墨迹成功保存至 " + savePathWithName);
51+
ShowNotificationAsync("墨迹成功保存至 " + savePathWithName);
5252
}
5353
}
5454
catch (Exception Ex)
5555
{
56-
ShowNotification("墨迹保存失败");
56+
ShowNotificationAsync("墨迹保存失败");
5757
LogHelper.WriteLogToFile("墨迹保存失败 | " + Ex.ToString(), LogHelper.LogType.Error);
5858
}
5959
}
@@ -106,7 +106,7 @@ private void SymbolIconOpenStrokes_MouseUp(object sender, MouseButtonEventArgs e
106106
}
107107
catch
108108
{
109-
ShowNotification("墨迹打开失败");
109+
ShowNotificationAsync("墨迹打开失败");
110110
}
111111
}
112112
}

Ink Canvas/MainWindow_cs/MW_Screenshot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private void SaveScreenshot(bool isHideNotification, string fileName = null)
2929
}
3030
if (!isHideNotification)
3131
{
32-
ShowNotification("截图成功保存至 " + savePath);
32+
ShowNotificationAsync("截图成功保存至 " + savePath);
3333
}
3434
}
3535

@@ -38,7 +38,7 @@ private void SaveScreenShotToDesktop()
3838
var bitmap = GetScreenshotBitmap();
3939
string savePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
4040
bitmap.Save(savePath + @"\" + DateTime.Now.ToString("u").Replace(':', '-') + ".png", ImageFormat.Png);
41-
ShowNotification("截图成功保存至【桌面" + @"\" + DateTime.Now.ToString("u").Replace(':', '-') + ".png】");
41+
ShowNotificationAsync("截图成功保存至【桌面" + @"\" + DateTime.Now.ToString("u").Replace(':', '-') + ".png】");
4242
if (Settings.Automation.IsAutoSaveStrokesAtScreenshot) SaveInkCanvasStrokes(false, false);
4343
}
4444

Ink Canvas/MainWindow_cs/MW_Settings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private void BtnResetAutoUpdateProxyToGHProxy_Click(object sender, RoutedEventAr
5454
private async void BtnCheckAutoUpdateProxyReturnedData_Click(object sender, RoutedEventArgs e)
5555
{
5656
string ProxyReturnedData = await AutoUpdateHelper.GetRemoteVersion(Settings.Startup.AutoUpdateProxy + "https://raw.githubusercontent.com/ChangSakura/Ink-Canvas/master/AutomaticUpdateVersionControl.txt");
57-
ShowNotification(ProxyReturnedData);
57+
ShowNotificationAsync(ProxyReturnedData);
5858
}
5959

6060
private void AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged(object sender, RoutedEventArgs e)
@@ -718,7 +718,7 @@ private void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
718718
ToggleSwitchRunAtStartup.IsOn = true;
719719
}
720720
catch { }
721-
ShowNotification("设置已重置为默认推荐设置~");
721+
ShowNotificationAsync("设置已重置为默认推荐设置~");
722722
}
723723

724724
private async void SpecialVersionResetToSuggestion_Click()

Ink Canvas/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
// You can specify all the values or you can default the Build and Revision Numbers
5050
// by using the '*' as shown below:
5151
// [assembly: AssemblyVersion("1.0.*")]
52-
[assembly: AssemblyVersion("5.0.0.0")]
53-
[assembly: AssemblyFileVersion("5.0.0.0")]
52+
[assembly: AssemblyVersion("4.9.1.0")]
53+
[assembly: AssemblyFileVersion("4.9.1.0")]

Ink Canvas/Windows/YesOrNoNotificationWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
88
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
99
mc:Ignorable="d" Topmost="True" WindowStartupLocation="CenterScreen" ui:WindowHelper.UseModernWindowStyle="True"
10-
ResizeMode="NoResize" Closed="Window_Closed" ui:ThemeManager.RequestedTheme="Light"
10+
ResizeMode="NoResize" Closed="Window_Closed"
1111
Title="演示文档设置 - Ink Canvas Artistry" Height="160" Width="450">
1212
<Grid Background="{DynamicResource FloatBarBackground}">
1313
<Grid Margin="10">
@@ -18,7 +18,7 @@
1818
<Viewbox HorizontalAlignment="Left" Margin="10" Height="30">
1919
<ui:FontIcon Height="22" Width="30" FontSize="20" FontFamily="{StaticResource FluentIconFontFamily}" Glyph="&#xe786;" Foreground="{DynamicResource FloatBarForeground}"/>
2020
</Viewbox>
21-
<TextBlock TextWrapping="Wrap" Name="Label" Margin="60,0,10,0" VerticalAlignment="Center"/>
21+
<TextBlock TextWrapping="Wrap" Name="Label" Margin="60,0,10,0" VerticalAlignment="Center" Foreground="{DynamicResource FloatBarForeground}"/>
2222
<ikw:SimpleStackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Spacing="10">
2323
<Button Margin="0" Content="" Width="100" Click="ButtonYes_Click" Foreground="White">
2424
<Button.Resources>

0 commit comments

Comments
 (0)