NaturalGroundingPlayer.EditVideoWindow.ShowFileBindingMenu C# (CSharp) Method

ShowFileBindingMenu() public method

public ShowFileBindingMenu ( UIElement target, PlacementMode placement ) : void
target UIElement
placement PlacementMode
return void
        public void ShowFileBindingMenu(UIElement target, PlacementMode placement) {
            // Set context menu items visibility.
            if (player == null)
                FileBindingButton.ContextMenu.Items.Remove(menuPlay);
            else
                menuPlay.IsEnabled = (!fileNotFound && video.FileName != null);
            if (!isPopup)
                FileBindingButton.ContextMenu.Items.Remove(menuEdit);
            string DefaultFileName = GetDefaultFileName();
            menuMoveFile.IsEnabled = (video.Title.Length > 0 && video.FileName != null && video.FileName != DefaultFileName);
            if (menuMoveFile.IsEnabled)
                menuMoveFile.Header = string.Format("_Move to \"{0}\"", DefaultFileName);
            else
                menuMoveFile.Header = "_Move to Default Location";
            if (isNew)
                menuSelectFile.Header = "_Select Existing Entry...";
            else
                menuSelectFile.Header = "_Select Another File...";
            menuDownloadVideo.IsEnabled = (!downloaded && (fileNotFound || video.FileName == null) && video.DownloadUrl.Length > 0);
            menuExtractAudio.IsEnabled = (!fileNotFound && video.FileName != null);
            menuRemoveBinding.IsEnabled = (!isNew && video.FileName != null);
            menuDeleteVideo.IsEnabled = (!fileNotFound && video.FileName != null);
            if (isNew)
                menuDeleteVideo.Header = "Delete _File";
            else
                menuDeleteVideo.Header = "Delete Attached _File";
            menuDeleteEntry.IsEnabled = !isNew;

            // Show context menu.
            FileBindingButton.ContextMenu.IsEnabled = true;
            FileBindingButton.ContextMenu.PlacementTarget = target;
            FileBindingButton.ContextMenu.Placement = placement;
            FileBindingButton.ContextMenu.IsOpen = true;
        }

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::ShowFileBindingMenu