Share current song by double click

This commit is contained in:
Théo Marchal 2021-10-04 20:01:50 +02:00
parent 6e4ed82211
commit 62a3220f7f
2 changed files with 12 additions and 1 deletions

View File

@ -28,7 +28,7 @@
</GroupBox.Header>
<Grid>
<Grid x:Name="CurrentSong" Margin="10,0,10,0" VerticalAlignment="Top" MinHeight="80">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" MouseDown="MouseDownClipboard">
<TextBlock x:Name="SongTitle" TextWrapping="Wrap" TextAlignment="Center" FontWeight="Normal" FontSize="20" Text="Title"/>
<TextBlock x:Name="SongArtist" TextWrapping="Wrap" TextAlignment="Center" FontWeight="Bold" FontSize="18" Text="Artist"/>
<TextBlock x:Name="SongAlbum" TextWrapping="Wrap" TextAlignment="Center" FontWeight="Normal" FontSize="16" Text="Album"/>

View File

@ -266,6 +266,17 @@ namespace unison
hk.Activate(this);
}
private void MouseDownClipboard(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
string CopyText = SongTitle.Text + " - " + SongArtist.Text + "\n";
CopyText += SongAlbum.Text + "\n";
CopyText += SongTitle.ToolTip;
Clipboard.SetText(CopyText);
}
}
public void InitHwnd()
{
WindowInteropHelper helper = new(this);