|
|
|
@ -37,7 +37,6 @@ public partial class PlaylistsPage : ContentPage
|
|
|
|
|
void ResetAll(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ResetSubMenus(sender, e);
|
|
|
|
|
ResetRenaming(sender, e);
|
|
|
|
|
IsNewPlaylist = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -49,22 +48,6 @@ public partial class PlaylistsPage : ContentPage
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ResetRenaming(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
foreach (var Playlist in playlists)
|
|
|
|
|
{
|
|
|
|
|
Playlist.IsRenaming = false;
|
|
|
|
|
if (!CheckRenaming(Playlist))
|
|
|
|
|
{
|
|
|
|
|
Playlist.NewName = Playlist.Name;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Playlist.Name = Playlist.NewName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add methods
|
|
|
|
|
|
|
|
|
@ -127,41 +110,6 @@ public partial class PlaylistsPage : ContentPage
|
|
|
|
|
|
|
|
|
|
// Change methods
|
|
|
|
|
|
|
|
|
|
void RenamePlaylist(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ResetSubMenus(sender, e);
|
|
|
|
|
if (sender is Button button)
|
|
|
|
|
{
|
|
|
|
|
if (button.BindingContext is Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
if (!playlist.IsRenaming)
|
|
|
|
|
{
|
|
|
|
|
ResetRenaming(sender, e);
|
|
|
|
|
playlist.IsRenaming = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ResetRenaming(sender, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (sender is Entry entry)
|
|
|
|
|
{
|
|
|
|
|
if (entry.BindingContext is Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
if (!CheckRenaming(playlist))
|
|
|
|
|
{
|
|
|
|
|
entry.TextColor = Color.FromRgb(255,0,0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ResetRenaming(sender, e);
|
|
|
|
|
playlist.Name = playlist.NewName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void ChangeImage(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var result = await FilePicker.PickAsync(new PickOptions
|
|
|
|
@ -198,35 +146,6 @@ public partial class PlaylistsPage : ContentPage
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check methods
|
|
|
|
|
|
|
|
|
|
void CheckNewName(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (sender is Entry entry)
|
|
|
|
|
{
|
|
|
|
|
if (entry.BindingContext is Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
if (!CheckRenaming(playlist))
|
|
|
|
|
{
|
|
|
|
|
entry.TextColor = Color.FromRgb(255, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entry.TextColor = Color.FromRgb(255, 255, 255);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CheckRenaming(Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
if (playlist.NewName.Length > Manager.MAX_NAME_LENGTH || string.IsNullOrWhiteSpace(playlist.NewName) || HasSameName(playlist.NewName))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Navigation
|
|
|
|
|
|
|
|
|
|
async void GoToPlaylist(object sender, EventArgs e)
|
|
|
|
|