Skip to content

Commit e7461fc

Browse files
committed
Possible to copy link to identified records Closing #203
1 parent fbe6edb commit e7461fc

File tree

3 files changed

+80
-2
lines changed

3 files changed

+80
-2
lines changed

PluginTraceViewer/Controls/RecordLinks.Designer.cs

Lines changed: 43 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PluginTraceViewer/Controls/RecordLinks.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public partial class RecordLinks : Form
1212
{
1313
private const int PANELHEIGHT = 20;
1414
private ConnectionDetail connectionDetail;
15+
private LinkLabel currentlink;
1516

1617
public RecordLinks()
1718
{
@@ -88,6 +89,7 @@ private void AddLinkPanel(string lbltext, string lbltip, string lnktext, string
8889
Text = lnktext,
8990
Tag = lnktag,
9091
LinkArea = new LinkArea(0, lnktext.Length),
92+
ContextMenuStrip = ctxMenu
9193
};
9294
link.LinkClicked += link_LinkClicked;
9395
toolTip1.SetToolTip(link, lnktip);
@@ -109,7 +111,35 @@ private void AddLinkPanel(string lbltext, string lbltip, string lnktext, string
109111

110112
private void link_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
111113
{
112-
UrlUtils.OpenUrl(sender, connectionDetail);
114+
if (e.Button == MouseButtons.Left)
115+
{
116+
UrlUtils.OpenUrl(sender, connectionDetail);
117+
}
118+
else if (sender is LinkLabel link)
119+
{
120+
currentlink = link;
121+
}
122+
}
123+
124+
private void copyURLToolStripMenuItem_Click(object sender, System.EventArgs e)
125+
{
126+
if (currentlink == null)
127+
{
128+
return;
129+
}
130+
var url = currentlink.Tag.ToString();
131+
if (!string.IsNullOrWhiteSpace(url))
132+
{
133+
Clipboard.SetText(url);
134+
lblCopied.Visible = true;
135+
timer1.Start();
136+
}
137+
}
138+
139+
private void timer1_Tick(object sender, System.EventArgs e)
140+
{
141+
timer1.Stop();
142+
lblCopied.Visible = false;
113143
}
114144
}
115145
}

PluginTraceViewer/Controls/RecordLinks.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123+
<metadata name="ctxMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124+
<value>115, 17</value>
125+
</metadata>
126+
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127+
<value>215, 17</value>
128+
</metadata>
123129
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
124130
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
125131
<value>

0 commit comments

Comments
 (0)