private void AddItem([NotNull] string displayText, [NotNull] string textToCopy, Image image, char?hotkey) { if (hotkey.HasValue) { int position = displayText.IndexOf(hotkey.Value.ToString(), StringComparison.InvariantCultureIgnoreCase); if (position >= 0) { displayText = displayText.Insert(position, "&"); } } else { displayText = PrependItemNumber(displayText); } var item = new ToolStripMenuItem { Text = displayText.TrimEnd('\r', '\n'), ShowShortcutKeys = true, Image = image }; item.Click += delegate { ClipboardUtil.TrySetText(textToCopy); }; DropDownItems.Add(item); }
private void copyFilenameToClipboardToolStripMenuItem_Click(object sender, EventArgs e) { if (tvGitTree.SelectedNode?.Tag is GitItem gitItem) { var fileName = _fullPathResolver.Resolve(gitItem.FileName); ClipboardUtil.TrySetText(fileName.ToNativePath()); } }
private void copyParentHashToolStripMenuItem_Click(object sender, EventArgs e) { if (Warnings is not null && Warnings.SelectedRows.Count != 0 && Warnings.SelectedRows[0].DataBoundItem is not null) { var lostObject = (LostObject)Warnings.SelectedRows[0].DataBoundItem; ClipboardUtil.TrySetText(lostObject.Parent?.ToString()); } }
private void CopyToClipboard(Func <GitBlameCommit, string> formatter) { var commit = GetBlameCommit(); if (commit is null) { return; } ClipboardUtil.TrySetText(formatter(commit)); }
private void rtbRevisionHeader_KeyDown(object sender, KeyEventArgs e) { if (!e.Control || e.KeyCode != Keys.C || sender is not RichTextBox rtb) { return; } // Override RichTextBox Ctrl-c handling to copy plain text ClipboardUtil.TrySetText(rtb.GetSelectionPlainText()); e.Handled = true; }
private void copyLogMessageToolStripMenuItem_Click(object sender, EventArgs e) { var commit = GetBlameCommit(); if (commit == null) { return; } ClipboardUtil.TrySetText(commit.Summary); }
private void textLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { var link = ((LinkLabel)sender).Text; if (e.Button == MouseButtons.Right) { // Just copy the text ClipboardUtil.TrySetText(link); } else { System.Diagnostics.Process.Start(link); } } catch { } }
public static void CopyInformation() => ClipboardUtil.TrySetText(GetInformation());
private void copySha1ToolStripMenuItem_Click(object sender, EventArgs e) { ClipboardUtil.TrySetText(GetShaOfRefLine().ToString()); }
private void buttonCopyAsPlainText_Click(object sender, EventArgs e) { string result = CreateTextTable(_lastGeneratedLogLines, true, true); ClipboardUtil.TrySetText(result); }
private void buttonCopyOrigOutput_Click(object sender, EventArgs e) { ClipboardUtil.TrySetText(textBoxResult.Text); }