-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMapTimesForm.cs
55 lines (46 loc) · 1.3 KB
/
MapTimesForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
namespace LiveSplit.SourceSplit
{
public partial class MapTimesForm : Form
{
private static MapTimesForm _instance;
public static MapTimesForm Instance => _instance ?? (_instance = new MapTimesForm());
private MapTimesForm()
{
InitializeComponent();
}
public void AddMapTime(string map, string time)
{
this.lvMapTimes.Items.Add(new ListViewItem(new[] {map, time}));
}
public void Reset()
{
this.lvMapTimes.Items.Clear();
}
private void btnCopy_Click(object sender, EventArgs e)
{
var str = new StringBuilder();
foreach (ListViewItem lvi in this.lvMapTimes.Items)
{
str.AppendLine(lvi.SubItems[0].Text + " " + lvi.SubItems[1].Text);
}
try
{
Clipboard.SetText(str.ToString());
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
protected override void OnClosing(CancelEventArgs e)
{
this.Hide();
e.Cancel = true;
}
}
}