private bool SaveChanges() {
SaveButton.Focus();
video.Artist = video.Artist.Trim();
video.Album = video.Album.Trim();
video.Title = video.Title.Trim();
video.DownloadName = video.DownloadName.Trim();
video.DownloadUrl = video.DownloadUrl.Trim();
video.BuyUrl = video.BuyUrl.Trim();
ErrorText.Text = "";
if (TitleText.Text.Length == 0) {
ErrorText.Text = "Title is required.";
return false;
}
if (business.IsTitleDuplicate(video)) {
ErrorText.Text = "Artist and title already exist in the database.";
return false;
}
// Only update EditedOn when directly editing from the Edit window.
if (!isPopup)
video.EditedOn = DateTime.UtcNow;
ratingBusiness.UpdateChanges();
business.Save();
isFormSaved = true;
// Update grid when in popup mode. Otherwise Callback is called in Window_Closing.
if (isPopup)
callback(video);
return true;
}