Skip to content

Commit

Permalink
added stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mmm12344 committed Jan 4, 2024
1 parent 88765ea commit 1c02dd2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sounders/ApiRequests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public async static Task<bool> RemoveSongFromPlaylist(int playlistID, int songID
{
if (!IsLive().Result)
return false;
var result = client.PostAsync(GetSubUrlApi("remove_song_from_playlist"), GetContentAsJson( new {playlistID = playlistID, songID = songID})).Result;
var result = client.PostAsync(GetSubUrlApi("remove_song_from_playlist"), GetContentAsJson(new { playlistID = playlistID, songID = songID })).Result;
if (!result.IsSuccessStatusCode)
{
return false;
Expand Down
1 change: 1 addition & 0 deletions Sounders/Views/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
Expand Down
2 changes: 1 addition & 1 deletion Sounders/Views/PlaylistPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<StackPanel Orientation="Horizontal" Tag="{Binding songID}">
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem x:Name="addToQueueItem" Header="Play" Click="addToQueueItem_Click"/>

<MenuItem x:Name="removeFromPLaylist" Header="Remove" Click="removeFromPLaylist_Click" Tag="{Binding songID}"/>
</ContextMenu>
</StackPanel.ContextMenu>
Expand Down
17 changes: 15 additions & 2 deletions Sounders/Views/PlaylistPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ public partial class PlaylistPage : Page
private List<SongData> playlistSongs = new List<SongData>();
MainWindow mainWindow;
PlayerQueue mainQueue;
int playlistID;
Playlist playlist;
public PlaylistPage(Playlist playlist, MainWindow mainWindow)
{
InitializeComponent();

HelperMethods.OpenSignInIfNotSigned();
this.mainWindow = mainWindow;
this.mainQueue = mainWindow.mainQueue;

playlistID = playlist.playlistID;
this.playlist = playlist;

playlistImage.Source = HelperMethods.GetBitmapImgFromBytes(playlist.picture);
this.playlistName.Text = playlist.name;
Expand Down Expand Up @@ -63,7 +66,17 @@ public PlaylistPage(Playlist playlist, MainWindow mainWindow)

private void removeFromPLaylist_Click(object sender, RoutedEventArgs e)
{

int songID = Convert.ToInt32(((MenuItem)sender).Tag);
var result = ApiRequests.RemoveSongFromPlaylist(playlistID, songID).Result;
if (result)
{
HelperMethods.SuccessMessage("Removed Song From Playlist");
mainWindow.mainFrame.Navigate(new PlaylistPage(playlist, mainWindow));
}
else
{
HelperMethods.ErrorMessage("Error, Please Try Again.");
}
}

private void ListenButton_Click(object sender, RoutedEventArgs e)
Expand Down
5 changes: 3 additions & 2 deletions Sounders/Views/ShowAllPlaylistListPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<DataTemplate>

<StackPanel Orientation="Horizontal">

<ContentControl >

<Border CornerRadius="20" Margin="10,5,10,5">
Expand All @@ -51,8 +52,8 @@
</LinearGradientBrush>
</Border.Background>
<StackPanel Width="150" Tag="{Binding playlistID}" VerticalAlignment="Stretch" Margin="10,5,10,5" MouseLeftButtonDown="Playlist_MouseDown">

<Image Height="120" Stretch="Fill" IsEnabled="True" Source="{Binding playlistPic}" Margin="20,20,20,0"/>
<Image Height="120" Stretch="Fill" IsEnabled="True" Source="{Binding playlistPic}" Margin="20,20,20,0"/>
<TextBlock Foreground="#beb1c2" FontSize="20" FontWeight="Black" TextTrimming="WordEllipsis" HorizontalAlignment="Center" Text="{Binding playlistName}" Margin="0,5,0,10" />
</StackPanel>
</Border>
Expand Down
1 change: 1 addition & 0 deletions Sounders/Views/ShowAllPlaylistListPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public ShowAllPlaylistListPage(MainWindow mainWindow, string type)
{
result = ApiRequests.GetOwnPlaylists().Result;
listNameTextBlock.Text = "Added Playlists";

}
if (result != null)
{
Expand Down

0 comments on commit 1c02dd2

Please sign in to comment.