forked from Ken98045/On-Guard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonitorCameraDialog.cs
50 lines (45 loc) · 1.36 KB
/
MonitorCameraDialog.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeepStackDisplay
{
public partial class MonitorCameraDialog : Form
{
public AllCameras Cameras { get; set; }
public MonitorCameraDialog(AllCameras cameras)
{
Cameras = cameras;
InitializeComponent();
foreach (var camera in cameras.CameraDictionary.Values)
{
ListViewItem item = new ListViewItem(new string[] { camera.cameraPrefix, camera.path })
{
Checked = camera.Monitoring
};
camerasListView.Items.Add(item);
}
}
private void OnItemCheck(object sender, ItemCheckEventArgs e)
{
if (e.NewValue == CheckState.Checked)
{
string key = string.Format("{0}\\{1}", camerasListView.Items[e.Index].SubItems[1].Text, camerasListView.Items[e.Index].Text).ToLower();
Cameras.CameraDictionary[key].Monitoring = (e.NewValue == CheckState.Checked);
}
}
private void OkButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void CancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}