public void Select(ListItem item)
        {
            if (item == null)
            {
                return;
            }
            object actionObj;
            object mediaItemObj;

            if (!item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM_ACTION, out actionObj) || !item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM, out mediaItemObj))
            {
                return;
            }

            IMediaItemActionConfirmation confirmation = actionObj as IMediaItemActionConfirmation;
            IMediaItemAction             action       = actionObj as IMediaItemAction;
            MediaItem mediaItem = mediaItemObj as MediaItem;

            if (action == null || mediaItem == null)
            {
                return;
            }

            if (confirmation != null)
            {
                ShowConfirmation(confirmation, mediaItem);
            }
            else
            {
                InvokeAction(action, mediaItem);
            }
        }
        protected void ShowConfirmation(IMediaItemActionConfirmation confirmation, MediaItem mediaItem)
        {
            IDialogManager dialogManager = ServiceRegistration.Get <IDialogManager>();
            string         header        = LocalizationHelper.Translate(Consts.RES_CONFIRM_HEADER);
            string         text          = LocalizationHelper.Translate(confirmation.ConfirmationMessage);
            Guid           handle        = dialogManager.ShowDialog(header, text, DialogType.YesNoDialog, false, DialogButtonType.No);

            _dialogCloseWatcher = new DialogCloseWatcher(this, handle,
                                                         dialogResult =>
            {
                if (dialogResult == DialogResult.Yes)
                {
                    InvokeAction(confirmation, mediaItem);
                }
                _dialogCloseWatcher?.Dispose();
            });
        }
Example #3
0
            public override string ConfirmationMessage(ListItem item)
            {
                IMediaItemActionConfirmation confirmation = _action as IMediaItemActionConfirmation;

                return(confirmation?.ConfirmationMessage);
            }