Skip to content

Commit

Permalink
修复开播提醒导致程序崩溃的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Jun 25, 2024
1 parent a205449 commit 912696f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Desktop/Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2535.41" />
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="2.0.5" />
<PackageReference Include="Notifications.Wpf" Version="0.1.1" />
<PackageReference Include="Notification.Wpf" Version="8.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.4" />
<PackageReference Include="WPF-UI" Version="3.0.4" />
</ItemGroup>
Expand Down
14 changes: 9 additions & 5 deletions Desktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Desktop.Views.Windows;
using Masuit.Tools.Win32;
using Microsoft.Extensions.DependencyInjection;
using Notifications.Wpf;
using Notification.Wpf;
using System.Diagnostics;
using System.Reflection;
using System.Text;
Expand Down Expand Up @@ -264,12 +264,16 @@ private void DetectRoom_LiveStart(object? sender, (RoomCardClass Card, bool Danm
List<TriggerType> triggerTypes = sender as List<TriggerType> ?? new List<TriggerType>();
if (roomCard.IsRemind && triggerTypes.Contains(TriggerType.RegularTasks))
{
notificationManager.Show(new NotificationContent
Dispatcher.Invoke(() =>
{
Title = "DDTV-开播提醒",
Message = $"{roomCard.Name}】的直播开始啦",
Type = NotificationType.Information
notificationManager.Show(new NotificationContent
{
Title = "DDTV-开播提醒",
Message = $"{roomCard.Name}】的直播开始啦",
Type = NotificationType.Information
});
});

}
}

Expand Down
8 changes: 4 additions & 4 deletions Desktop/Views/Windows/AddRoom.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,23 @@ private void RemindChechBox_Click(object sender, RoutedEventArgs e)
{
if ((bool)RemindChechBox.IsChecked)
{
_IsDanmu = true;
_IsRemind= true;
}
else
{
_IsDanmu = false;
_IsRemind = false;
}
}

private void RecDanmuChechBox_Click(object sender, RoutedEventArgs e)
{
if ((bool)RecDanmuChechBox.IsChecked)
{
_IsRemind = true;
_IsDanmu = true;
}
else
{
_IsRemind = false;
_IsDanmu = false;
}
}

Expand Down
18 changes: 12 additions & 6 deletions Desktop/Views/Windows/VlcPlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using LibVLCSharp.WPF;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.DependencyInjection;
using Notifications.Wpf;
using Notification.Wpf;
using SharpCompress.Common;
using SkiaSharp;
using System;
Expand Down Expand Up @@ -549,14 +549,20 @@ private void MenuItem_Switch_Danma_Exhibition_Click(object sender, RoutedEventAr
}
}

private void SetNotificatom(string Title, string Message="'")
private void SetNotificatom(string Title, string Message = "'")
{
MainWindow.notificationManager.Show(new NotificationContent
Dispatcher.Invoke(() =>
{
Title = Title,
Message = Message,
Type = NotificationType.Success
MainWindow.notificationManager.Show(new NotificationContent
{
Title = Title,
Message = Message,
Type = NotificationType.Success,
Background = (System.Windows.Media.Brush)new BrushConverter().ConvertFromString("#00CC33")
});
});

}

private void MenuItem_TopMost_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 912696f

Please sign in to comment.