Added playlists view. Added messaging service. Added logic for adding and deleting playlists.
This commit is contained in:
30
Harmonia.WinUI/Messaging/WindowsMessageService.cs
Normal file
30
Harmonia.WinUI/Messaging/WindowsMessageService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Harmonia.WinUI.Messaging;
|
||||
|
||||
public class WindowsMessageService : IMessageService
|
||||
{
|
||||
private static MainWindow MainWindow => App.ServiceProvider.GetRequiredService<MainWindow>();
|
||||
|
||||
public async Task<bool> ConfirmAsync(string title, string message)
|
||||
{
|
||||
ContentDialog dialog = new()
|
||||
{
|
||||
XamlRoot = MainWindow.Content.XamlRoot,
|
||||
Style = Application.Current.Resources["DefaultContentDialogStyle"] as Style,
|
||||
Title = title,
|
||||
Content = message,
|
||||
PrimaryButtonText = "Yes",
|
||||
CloseButtonText = "No",
|
||||
DefaultButton = ContentDialogButton.Primary
|
||||
};
|
||||
|
||||
var result = await dialog.ShowAsync();
|
||||
|
||||
return result == ContentDialogResult.Primary;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user