NaturalGroundingPlayer.EditVideoWindow.Window_Loaded C# (CSharp) 메소드

Window_Loaded() 개인적인 메소드

private Window_Loaded ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
리턴 void
        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 (player == null)
                PlayButton.Visibility = System.Windows.Visibility.Hidden;

            if (video.FileName != null) {
                if (File.Exists(Settings.NaturalGroundingFolder + video.FileName))
                    await LoadMediaInfoAsync();
                else {
                    fileNotFound = true;
                    ErrorText.Text = "File not found.";
                }
            }
        }

Usage Example

 /// <summary>
 /// Displays a popup containing the FileBinding menu features.
 /// </summary>
 public static EditVideoWindow InstancePopup(UIElement target, PlacementMode placement, Guid? videoId, string fileName, IMediaPlayerBusiness player, ClosingCallback callback) {
     EditVideoWindow NewForm = new EditVideoWindow();
     NewForm.isPopup = true;
     NewForm.videoId = videoId;
     if (videoId != null && videoId != Guid.Empty)
         NewForm.videoId = videoId;
     else
         NewForm.fileName = fileName;
     NewForm.player = player;
     NewForm.callback = callback;
     WindowHelper.SetScale(NewForm.FileBindingButton.ContextMenu);
     NewForm.Window_Loaded(null, null);
     NewForm.ShowFileBindingMenu(target, placement);
     return NewForm;
 }
All Usage Examples Of NaturalGroundingPlayer.EditVideoWindow::Window_Loaded