public virtual void Show(IContextMenuBuilder menu, Context context) { if (context.Selection is { Editable : false } selection) { AddSearchSelectionItems(menu, selection.Text); menu.AddSeparator(); menu.AddAction("Apply ROT13", () => App.MessageDialogs.Information("ROT13", StringUtils.ConvertRot13(selection.Text))); menu.AddSeparator(); }
public override void Show(IContextMenuBuilder menu, Context context) { base.Show(menu, context); menu.AddAction("View detail", notificationInterface.ShowTweetDetail); menu.AddAction("Skip tweet", notificationInterface.FinishCurrentNotification); menu.AddActionWithCheck("Freeze", notificationInterface.FreezeTimer, () => notificationInterface.FreezeTimer = !notificationInterface.FreezeTimer); menu.AddSeparator(); if (context.Notification is {} notification) { AddCopyAction(menu, "Copy tweet address", notification.TweetUrl); if (!string.IsNullOrEmpty(notification.QuoteUrl)) { AddCopyAction(menu, "Copy quoted tweet address", notification.QuoteUrl !); } menu.AddSeparator(); } }
/// <summary> /// Adds a <see cref="ToolStripSeparator"/> to the <see cref="ContextMenuStrip"/>. A <see cref="ToolStripSeparator"/> /// is only added if the last item that was added to the <see cref="ContextMenuStrip"/> exists and is not a /// <see cref="ToolStripSeparator"/>. /// </summary> /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns> public RiskeerContextMenuBuilder AddSeparator() { contextMenuBuilder.AddSeparator(); return(this); }