mirror of
https://github.com/muskit/MercuryConverter.git
synced 2026-06-02 20:24:26 -07:00
wire up Selection's Sidebar Info
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:MercuryConverter.UI.Dialogs"
|
|
||||||
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
||||||
|
xmlns:local="clr-namespace:MercuryConverter.UI.Dialogs"
|
||||||
x:Class="MercuryConverter.UI.Dialogs.DataScanning"
|
x:Class="MercuryConverter.UI.Dialogs.DataScanning"
|
||||||
>
|
>
|
||||||
<Panel Margin="12">
|
<Panel Margin="12">
|
||||||
|
|||||||
@@ -29,11 +29,8 @@ public partial class DataScanning : UserControl
|
|||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var path = ""; // TODO: set to current/saved data path
|
var path = ""; // TODO: set to current/saved data path (move to config?)
|
||||||
|
|
||||||
// Content selection
|
|
||||||
var selectedPath = await BeginDirSelection();
|
var selectedPath = await BeginDirSelection();
|
||||||
Console.WriteLine($"selectedPath=[{selectedPath}]");
|
|
||||||
|
|
||||||
if (selectedPath == "") // cancelled opening folder
|
if (selectedPath == "") // cancelled opening folder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ using System.Threading.Tasks;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using MercuryConverter.Data;
|
using MercuryConverter.Data;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using System.IO;
|
||||||
|
using Avalonia.Media.Imaging;
|
||||||
|
|
||||||
namespace MercuryConverter.UI.Views;
|
namespace MercuryConverter.UI.Views;
|
||||||
|
|
||||||
@@ -14,6 +18,7 @@ public partial class Selection : Panel
|
|||||||
public Selection()
|
public Selection()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ListingTable.CellPointerPressed += OnCellClicked;
|
||||||
ListingTable.SelectionMode = DataGridSelectionMode.Extended;
|
ListingTable.SelectionMode = DataGridSelectionMode.Extended;
|
||||||
|
|
||||||
foreach (var (k, v) in Consts.NUM_SOURCE)
|
foreach (var (k, v) in Consts.NUM_SOURCE)
|
||||||
@@ -39,7 +44,26 @@ public partial class Selection : Panel
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DataContext = this;
|
private void OnCellClicked(object? sender, DataGridCellPointerPressedEventArgs e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{e.PointerPressedEventArgs.KeyModifiers} - {e.Cell}");
|
||||||
|
|
||||||
|
if (e.Row.DataContext is Song song)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{song.Id}: {song.Artist} - {song.Name}");
|
||||||
|
Dispatcher.UIThread.Post(() =>
|
||||||
|
{
|
||||||
|
if (song.Jacket != null)
|
||||||
|
{
|
||||||
|
var file = File.OpenRead(song.Jacket);
|
||||||
|
InfoImageJacket.Source = new Bitmap(file);
|
||||||
|
}
|
||||||
|
InfoNameText.Text = song.Name;
|
||||||
|
InfoArtistText.Text = song.Artist;
|
||||||
|
InfoSourceText.Text = song.SourceName;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user