diff --git a/Ink Canvas/MainWindow_cs/MW_Notification.cs b/Ink Canvas/MainWindow_cs/MW_Notification.cs index 334008f1..1c8044c3 100644 --- a/Ink Canvas/MainWindow_cs/MW_Notification.cs +++ b/Ink Canvas/MainWindow_cs/MW_Notification.cs @@ -184,6 +184,9 @@ private void ApplyDynamicNotificationPlacement(NotificationMessage message = nul case "FloatingBarAbove": ApplyDynamicNotificationFloatingBarPlacement(); break; + case "BottomBarAbove": + ApplyDynamicNotificationBottomBarPlacement(); + break; } } @@ -219,6 +222,54 @@ private void ApplyDynamicNotificationFloatingBarPlacement() } } + private void ApplyDynamicNotificationBottomBarPlacement() + { + if (DynamicNotification == null || ViewboxFloatingBar == null) + { + return; + } + try + { + if(ViewboxFloatingBar.Visibility == Visibility.Visible) + { + //这里浮动栏是在的,直接采用浮动栏上方的计算方法 + ApplyDynamicNotificationFloatingBarPlacement(); + return; + } + else + { + if(isFloatingBarFolded && BlackboardCenterSide.Visibility!=Visibility.Visible || BlackboardCenterSide.ActualWidth < 1 || BlackboardCenterSide.ActualHeight < 1) + { + //这时的情况应是点击了浮动栏隐藏或白板未完成布局,直接顶部居中 + DynamicNotification.HorizontalAlignment = HorizontalAlignment.Center; + DynamicNotification.VerticalAlignment = VerticalAlignment.Top; + DynamicNotification.Margin = new Thickness(0); + return; + } + if (BlackboardCenterSide.Visibility == Visibility.Visible) + { + //进白板了 + var topLeft = BlackboardCenterSide.TranslatePoint(new Point(0, 0), this); + var bottomRight = BlackboardCenterSide.TranslatePoint( + new Point(BlackboardCenterSide.ActualWidth, BlackboardCenterSide.ActualHeight), this); + double notificationWidth = DynamicNotification.ActualWidth > 0 ? DynamicNotification.ActualWidth : DynamicNotification.Width; + double notificationHeight = DynamicNotification.ActualHeight > 0 ? DynamicNotification.ActualHeight : 72; + double left = (topLeft.X + bottomRight.X) / 2 - notificationWidth / 2; + double top = topLeft.Y - notificationHeight - 12; + left = Math.Max(12, Math.Min(ActualWidth - notificationWidth - 12, left)); + top = Math.Max(12, top); + + DynamicNotification.HorizontalAlignment = HorizontalAlignment.Left; + DynamicNotification.VerticalAlignment = VerticalAlignment.Top; + DynamicNotification.Margin = new Thickness(left, top, 0, 0); + } + } + } + catch + { + + } + } private void OnAnnouncementUnreadCountChanged() { if (_startupUnreadNotificationShown) return; diff --git a/Ink Canvas/Properties/NotificationStrings.Designer.cs b/Ink Canvas/Properties/NotificationStrings.Designer.cs index c3c2fe8e..7427eb6f 100644 --- a/Ink Canvas/Properties/NotificationStrings.Designer.cs +++ b/Ink Canvas/Properties/NotificationStrings.Designer.cs @@ -106,6 +106,8 @@ public static string GetString(string key) public static string PlacementFloatingBarAbove => ResourceManager.GetString(nameof(PlacementFloatingBarAbove), _resourceCulture); + public static string PlacementBottomBarAbove => ResourceManager.GetString(nameof(PlacementBottomBarAbove), _resourceCulture); + public static string PlacementTopCenter => ResourceManager.GetString(nameof(PlacementTopCenter), _resourceCulture); public static string PlacementTopLeft => ResourceManager.GetString(nameof(PlacementTopLeft), _resourceCulture); diff --git a/Ink Canvas/Properties/NotificationStrings.en-US.resx b/Ink Canvas/Properties/NotificationStrings.en-US.resx index 370d335f..afc1cc77 100644 --- a/Ink Canvas/Properties/NotificationStrings.en-US.resx +++ b/Ink Canvas/Properties/NotificationStrings.en-US.resx @@ -1,4 +1,4 @@ - + @@ -150,6 +150,9 @@ Above floating toolbar + + Above bottom bar + Announcement provider diff --git a/Ink Canvas/Properties/NotificationStrings.resx b/Ink Canvas/Properties/NotificationStrings.resx index 0bd00da9..1501765a 100644 --- a/Ink Canvas/Properties/NotificationStrings.resx +++ b/Ink Canvas/Properties/NotificationStrings.resx @@ -1,4 +1,4 @@ - + @@ -150,6 +150,9 @@ 浮动栏上方 + + 底栏上方 + 公告提供商 diff --git a/Ink Canvas/Properties/NotificationStrings.zh-ME.resx b/Ink Canvas/Properties/NotificationStrings.zh-ME.resx index cb56a2fe..ea63f472 100644 --- a/Ink Canvas/Properties/NotificationStrings.zh-ME.resx +++ b/Ink Canvas/Properties/NotificationStrings.zh-ME.resx @@ -150,6 +150,9 @@ 浮动栏上方 + + 底栏上方 + 公告提供商 diff --git a/Ink Canvas/Windows/SettingsViews/Pages/NotificationPage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/NotificationPage.xaml index 7aeac5e3..883e1497 100644 --- a/Ink Canvas/Windows/SettingsViews/Pages/NotificationPage.xaml +++ b/Ink Canvas/Windows/SettingsViews/Pages/NotificationPage.xaml @@ -130,6 +130,7 @@ +