-
Notifications
You must be signed in to change notification settings - Fork 535
/
FindObject.cs
54 lines (48 loc) · 1.52 KB
/
FindObject.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
using System;
using System.Linq;
using System.Windows.Forms;
namespace iSpyApplication
{
public partial class FindObject : Form
{
public FindObject()
{
InitializeComponent();
}
private void FindObject_Activated(object sender, EventArgs e)
{
LoadSources();
}
private void LoadSources()
{
ddlObject.Items.Clear();
ddlObject.Items.Add(LocRm.GetString("PleaseSelect"));
var l = ((MainForm)Owner).ControlList;
foreach (var c in l)
{
string name = c.ObjectName.Trim();
ddlObject.Items.Add(name);
}
ddlObject.SelectedIndex = 0;
}
private void FindObject_Load(object sender, EventArgs e)
{
Text = LocRm.GetString("Find");
}
private void ddlObject_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlObject.SelectedIndex > 0)
{
var l = ((MainForm)Owner).ControlList;
var t = l.FirstOrDefault(p => String.Equals(p.ObjectName, ddlObject.SelectedItem.ToString(), StringComparison.CurrentCultureIgnoreCase));
if (t != null)
{
((Control)t).Focus();
((MainForm)Owner)._pnlCameras.ClearHighlights();
t.Highlighted = true;
}
ddlObject.SelectedIndex = 0;
}
}
}
}