private void Window_Loaded(object sender, RoutedEventArgs e) { video = business.NewVideo(); this.DataContext = video; StartDownloadCheckBox.IsChecked = StartDownloadDefault; CategoryCombo.ItemsSource = business.GetCategories(video.MediaTypeId); }
private async void Window_Loaded(object sender, RoutedEventArgs e) { if (videoId != null) { video = business.GetVideoById(videoId.Value); if (video.MediaId == Guid.Empty) { throw new InvalidDataException("This Media information has an invalid empty GUID."); } } else { video = business.GetVideoByFileName(fileName); if (video == null) { video = business.NewVideo(); video.FileName = fileName; video.MediaTypeId = (int)EditVideoBusiness.GetFileType(fileName); video.DownloadName = System.IO.Path.GetFileNameWithoutExtension(fileName); isNew = true; } } this.DataContext = video; CategoryCombo.ItemsSource = business.GetCategories(video.MediaTypeId); Custom1Combo.ItemsSource = business.GetCustomRatingCategories(); Custom2Combo.ItemsSource = Custom1Combo.ItemsSource; ratingBusiness = business.GetRatings(video); RatingsGrid.DataContext = ratingBusiness; EditRating_LostFocus(null, null); if (video.FileName != null) { if (File.Exists(Settings.NaturalGroundingFolder + video.FileName)) { await LoadMediaInfoAsync(); } else { // Try to auto-attach same path with different extension. if (!EditPlaylistBusiness.AutoAttachFile(video, Path.ChangeExtension(video.FileName, null))) { fileNotFound = true; ErrorText.Text = "File not found."; } } } }