Exemplo n.º 1
0
 public void ChangePlaylistNameClick(object param)
 {
     if (TextInput == null)
     {
         PopUpWarning = "Please insert a valid name"; // warning appears when the textbox was left empty
     }
     else if (TextInput.Length >= 32)
     {
         PopUpWarning = "Name can't be longer than 32 characters"; // warning appears when the name is 32 characters long
     }
     else if (TextInput.Equals(PlayListViewModel.PlaylistName))    //If the name didn't change
     {
         PopUpWarning = "The name can't be the same as the old name";
     }
     else
     {
         string sqlquery = $"UPDATE Playlist SET name = '{TextInput}' WHERE {PlaylistID} = idPlaylist"; // also updates the database name
         DatabaseConnector.UpdateQueryDB(sqlquery);
         PlayListViewModel.ChangeName(TextInput);                                                       // changes the name on the application
         TryClose();
     }
 }