diff --git a/PixivFSUWP/BigImage.xaml b/PixivFSUWP/BigImage.xaml index 7bedfc9..be5d275 100644 --- a/PixivFSUWP/BigImage.xaml +++ b/PixivFSUWP/BigImage.xaml @@ -54,11 +54,12 @@ - + - + diff --git a/PixivFSUWP/BigImage.xaml.cs b/PixivFSUWP/BigImage.xaml.cs index daf8c19..c20f815 100644 --- a/PixivFSUWP/BigImage.xaml.cs +++ b/PixivFSUWP/BigImage.xaml.cs @@ -130,6 +130,32 @@ private async void BtnSaveImage_Click(object sender, RoutedEventArgs e) await saveImage(); } + List<(string, int)> tips = new List<(string, int)>(); + bool _tip_busy = false; + + public async Task ShowTip(string Message, int Seconds = 3) + { + tips.Add((Message, Seconds)); + if (!_tip_busy) + { + _tip_busy = true; + while (tips.Count > 0) + { + (var m, var s) = tips[0]; + txtTip.Text = m; + grdTip.Visibility = Visibility.Visible; + storyTipShow.Begin(); + await Task.Delay(200); + await Task.Delay(TimeSpan.FromSeconds(s)); + storyTipHide.Begin(); + await Task.Delay(200); + grdTip.Visibility = Visibility.Collapsed; + tips.RemoveAt(0); + } + _tip_busy = false; + } + } + private async Task saveImage() { FileSavePicker picker = new FileSavePicker(); @@ -163,10 +189,7 @@ private async Task saveImage() } else { - var messageDialog = new MessageDialog("图片已保存"); - messageDialog.Commands.Add(new UICommand("好的")); - messageDialog.DefaultCommandIndex = 0; - await messageDialog.ShowAsync(); + await ShowTip("图片已保存"); } } } @@ -221,19 +244,13 @@ private async Task saveStrokes() } else { - var messageDialog = new MessageDialog("墨迹已保存"); - messageDialog.Commands.Add(new UICommand("好的")); - messageDialog.DefaultCommandIndex = 0; - await messageDialog.ShowAsync(); + await ShowTip("墨迹已保存"); } } } else { - var messageDialog = new MessageDialog("没有墨迹可以保存"); - messageDialog.Commands.Add(new UICommand("好的")); - messageDialog.DefaultCommandIndex = 0; - await messageDialog.ShowAsync(); + await ShowTip("没有墨迹可以保存"); } } } diff --git a/PixivFSUWP/MainPage.xaml b/PixivFSUWP/MainPage.xaml index edeedba..d00101f 100644 --- a/PixivFSUWP/MainPage.xaml +++ b/PixivFSUWP/MainPage.xaml @@ -63,11 +63,12 @@ - + - + diff --git a/PixivFSUWP/MainPage.xaml.cs b/PixivFSUWP/MainPage.xaml.cs index 305ff1d..970f3d1 100644 --- a/PixivFSUWP/MainPage.xaml.cs +++ b/PixivFSUWP/MainPage.xaml.cs @@ -154,6 +154,32 @@ public void HandleUri() } } + List<(string, int)> tips = new List<(string, int)>(); + bool _tip_busy = false; + + public async Task ShowTip(string Message, int Seconds = 3) + { + tips.Add((Message, Seconds)); + if (!_tip_busy) + { + _tip_busy = true; + while (tips.Count > 0) + { + (var m, var s) = tips[0]; + txtTip.Text = m; + grdTip.Visibility = Visibility.Visible; + storyTipShow.Begin(); + await Task.Delay(200); + await Task.Delay(TimeSpan.FromSeconds(s)); + storyTipHide.Begin(); + await Task.Delay(200); + grdTip.Visibility = Visibility.Collapsed; + tips.RemoveAt(0); + } + _tip_busy = false; + } + } + private void BtnMe_Click(object sender, RoutedEventArgs e) { ContentFrame.Navigate(typeof(UserDetailPage), currentUser.ID);