Interaction logic for EditVideoWindow.xaml
Inheritance: System.Windows.Window
        private void menuEdit_Click(object sender, RoutedEventArgs e)
        {
            var Item = DownloadsView.SelectedItem as DownloadItem;

            if (Item != null)
            {
                EditVideoWindow.Instance((Item.Data as DownloadItemData).Media.MediaId, null, null);
            }
        }
 /// <summary>
 /// Displays a window to edit specified video.
 /// </summary>
 public static EditVideoWindow Instance(Guid? videoId, string fileName, IMediaPlayerBusiness player, ClosingCallback callback) {
     EditVideoWindow NewForm = new EditVideoWindow();
     if (videoId != null && videoId != Guid.Empty)
         NewForm.videoId = videoId;
     else
         NewForm.fileName = fileName;
     NewForm.player = player;
     NewForm.callback = callback;
     SessionCore.Instance.Windows.Show(NewForm);
     return NewForm;
 }
Exemple #3
0
 private void FilesView_ItemDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (FilesView.SelectedItem != null)
     {
         MoveFileItem Item = (MoveFileItem)FilesView.SelectedItem;
         EditVideoWindow.Instance(Item.VideoId, null, delegate(Media result) {
             if (result != null)
             {
                 business.Load(result.MediaId);
                 DisplayData();
             }
         });
     }
 }
 /// <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;
 }
        /// <summary>
        /// Displays a window to edit specified video.
        /// </summary>
        public static EditVideoWindow Instance(Guid?videoId, string fileName, ClosingCallback callback)
        {
            EditVideoWindow NewForm = new EditVideoWindow();

            if (videoId != null && videoId != Guid.Empty)
            {
                NewForm.videoId = videoId;
            }
            else
            {
                NewForm.fileName = fileName;
            }
            NewForm.callback = callback;
            SessionCore.Instance.Windows.Show(NewForm);
            return(NewForm);
        }
Exemple #6
0
        private void CommandBinding_EditVideo(object sender, ExecutedRoutedEventArgs e)
        {
            if (!menuEditVideo.IsEnabled)
            {
                return;
            }

            SessionCore.Instance.RatingViewer.UpdatePreference();
            if (SessionCore.Instance.Business.CurrentVideo != null)
            {
                EditVideoWindow.Instance(SessionCore.Instance.Business.CurrentVideo.MediaId, null, delegate(Media result) {
                    if (result != null)
                    {
                        SessionCore.Instance.Business.ReloadVideoInfo();
                    }
                });
            }
        }
        /// <summary>
        /// Displays a popup containing the FileBinding menu features.
        /// </summary>
        public static EditVideoWindow InstancePopup(UIElement target, PlacementMode placement, Guid?videoId, string fileName, 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.callback = callback;
            WindowHelper.SetScale(NewForm.FileBindingButton.ContextMenu);
            NewForm.Window_Loaded(null, null);
            NewForm.ShowFileBindingMenu(target, placement);
            return(NewForm);
        }
        private async void menuSelectFile_Click(object sender, RoutedEventArgs e)
        {
            if (!isNew)
            {
                // Bind to another file.
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.InitialDirectory = Settings.NaturalGroundingFolder;
                if (video.MediaType == MediaType.Video)
                {
                    dlg.Filter = string.Format("Video Files|*{0})", string.Join(";*", AppPaths.VideoExtensions));
                }
                else if (video.MediaType == MediaType.Audio)
                {
                    dlg.Filter = string.Format("Audio Files|*{0})", string.Join(";*", AppPaths.AudioExtensions));
                }
                else if (video.MediaType == MediaType.Image)
                {
                    dlg.Filter = string.Format("Image Files|*{0})", string.Join(";*", AppPaths.ImageExtensions));
                }
                if (dlg.ShowDialog(IsLoaded ? this : Owner).Value == true)
                {
                    if (!dlg.FileName.StartsWith(Settings.NaturalGroundingFolder))
                    {
                        MessageBox.Show("You must select a file within your Natural Grounding folder.", "Error", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        string BindFile = dlg.FileName.Substring(Settings.NaturalGroundingFolder.Length);
                        if (business.GetVideoByFileName(BindFile) == null)
                        {
                            video.FileName = BindFile;
                            video.Length   = null;
                            video.Height   = null;
                            await LoadMediaInfoAsync();

                            if (isPopup)
                            {
                                SaveChanges();
                            }
                        }
                        else
                        {
                            MessageBox.Show("This file is already in the database.", "Error", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                    fileNotFound = false;
                }
            }
            else
            {
                // Bind file to an existing entry.
                SearchSettings settings = new SearchSettings()
                {
                    MediaType        = (MediaType)video.MediaTypeId,
                    ConditionField   = FieldConditionEnum.FileExists,
                    ConditionValue   = BoolConditionEnum.No,
                    ListIsInDatabase = true
                };
                VideoListItem Result = SearchVideoWindow.Instance(settings);
                if (Result != null)
                {
                    // Close and re-open selected entry.
                    Close();
                    EditVideoWindow NewForm = Instance(Result.MediaId, null, callback);
                    NewForm.video.FileName = video.FileName;
                    NewForm.video.Length   = null;
                    NewForm.video.Height   = null;
                    await NewForm.LoadMediaInfoAsync();
                }
            }
        }
 private void menuEdit_Click(object sender, RoutedEventArgs e)
 {
     EditVideoWindow.Instance(video.MediaId, video.FileName, callback);
 }
 private void ShowEditFormPopup(VideoListItem item, UIElement target)
 {
     EditVideoWindow.InstancePopup(target, PlacementMode.Mouse, item.MediaId, item.FileName, EditForm_Closed);
 }
 private void ShowEditForm(VideoListItem item)
 {
     EditVideoWindow.Instance(item.MediaId, item.FileName, EditForm_Closed);
 }