Added playlist renaming functionality.

This commit is contained in:
2026-08-03 23:49:21 -04:00
parent de16ac6240
commit cd6f9c382e
8 changed files with 97 additions and 1 deletions

View File

@@ -5,4 +5,5 @@ namespace Harmonia.WinUI.Messaging;
public interface IMessageService
{
Task<bool> ConfirmAsync(string title, string message);
Task<string> InputTextAsync(string title, string message, string defaultText = "");
}

View File

@@ -27,4 +27,44 @@ public class WindowsMessageService : IMessageService
return result == ContentDialogResult.Primary;
}
public async Task<string> InputTextAsync(string title, string message, string defaultText = "")
{
TextBox inputTextBox = new()
{
Text = defaultText,
Margin = new Thickness(0, 10, 0, 0)
};
inputTextBox.SelectAll();
ContentDialog dialog = new()
{
XamlRoot = MainWindow.Content.XamlRoot,
Style = Application.Current.Resources["DefaultContentDialogStyle"] as Style,
Title = title,
Content = new StackPanel
{
Children =
{
new TextBlock { Text = message },
inputTextBox
}
},
PrimaryButtonText = "OK",
CloseButtonText = "Cancel",
DefaultButton = ContentDialogButton.Primary
};
ContentDialogResult result = await dialog.ShowAsync();
if (result == ContentDialogResult.Primary)
{
return inputTextBox.Text;
}
else
{
return string.Empty;
}
}
}