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; } ListItemAction action = actionObj as ListItemAction; item = mediaItemObj as ListItem; if (action == null || item == null) { return; } if (action.ConfirmationMessage(item) != null) { ShowConfirmation(action, item); } else { _ = InvokeAction(action, item); } }
protected void ShowConfirmation(ListItemAction action, ListItem item) { IDialogManager dialogManager = ServiceRegistration.Get <IDialogManager>(); string header = LocalizationHelper.Translate(Consts.RES_CONFIRM_HEADER); string text = LocalizationHelper.Translate(action.ConfirmationMessage(item)); Guid handle = dialogManager.ShowDialog(header, text, DialogType.YesNoDialog, false, DialogButtonType.No); _dialogCloseWatcher = new DialogCloseWatcher(this, handle, async dialogResult => { if (dialogResult == DialogResult.Yes) { await InvokeAction(action, item); } _dialogCloseWatcher?.Dispose(); }); }