Add a Library page reachable from the navigation. It lists all songs from the SQLite database, filters them by title or artist, edits title, artist, license and attribution in a dialog, and deletes a song after a confirmation prompt. File path, duration and source stay read-only. LibraryController wraps SongRepository so the view only forwards user actions. Changes are written to the database immediately, and the list reloads every time the page is shown. Refs #3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
986 B
C#
35 lines
986 B
C#
using System.Windows;
|
|
using Radiosender.Models;
|
|
using Wpf.Ui.Controls;
|
|
|
|
namespace Radiosender.Views;
|
|
|
|
/// <summary>Dialog for the editable song metadata. Only collects input; saving is done by the caller.</summary>
|
|
public partial class SongEditWindow : FluentWindow
|
|
{
|
|
public SongEditWindow(Song song)
|
|
{
|
|
InitializeComponent();
|
|
TitleBox.Text = song.Title;
|
|
ArtistBox.Text = song.Artist;
|
|
LicenseBox.Text = song.License;
|
|
AttributionBox.Text = song.Attribution;
|
|
}
|
|
|
|
public string SongTitle => TitleBox.Text;
|
|
public string Artist => ArtistBox.Text;
|
|
public string License => LicenseBox.Text;
|
|
public string Attribution => AttributionBox.Text;
|
|
|
|
private void OnSave(object sender, RoutedEventArgs e)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(SongTitle) || string.IsNullOrWhiteSpace(Artist))
|
|
{
|
|
ErrorText.Visibility = Visibility.Visible;
|
|
return;
|
|
}
|
|
|
|
DialogResult = true;
|
|
}
|
|
}
|