-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelector.cs
More file actions
60 lines (55 loc) · 1.68 KB
/
Selector.cs
File metadata and controls
60 lines (55 loc) · 1.68 KB
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
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace CopyQueue
{
public partial class Selector : Form
{
public Selector()
{
InitializeComponent();
}
private void btnSelect_Click(object sender, EventArgs e)
{
int result;
bool isparsable = int.TryParse(tbNumber.Text,out result);
if(isparsable)
{
if(result <= Form1.queue.Count)
{
Clipboard.SetText(Form1.queue[result - 1], TextDataFormat.UnicodeText);
Form1.t.changetext("the snippet \"" + viewer.readlist(Form1.queue[result-1]) + "\"has been copied to the clipboard", "snippet copied");
this.Close();
}
else
{
MessageBox.Show(string.Format("There is no snippet at position {0}. the highest position is {1}", result, Form1.queue.Count));
}
}
else
{
MessageBox.Show("That's not a number, please enter a whole number.");
}
}
private void tbNumber_KeyPress(object sender, KeyPressEventArgs e)
{
Console.WriteLine(e.KeyChar);
}
private void tbNumber_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Escape)
{
this.Close();
}
}
private void Selector_Load(object sender, EventArgs e)
{
tbNumber.Select();
}
}
}