-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCaptureWindow.cs
45 lines (38 loc) · 1.28 KB
/
CaptureWindow.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
using System;
using System.Data;
using System.Linq;
using System.Windows.Forms;
namespace NVStreamer1080 {
public partial class CaptureWindow : Form {
public CaptureWindow(NVStreamerMainUI mainUI) {
MainUI = mainUI;
InitializeComponent();
}
readonly NVStreamerMainUI MainUI;
private void CaptureWindow_KeyDown(object sender, KeyEventArgs e) {
InputDetected();
}
int MouseX = -1;
int MouseY = -1;
private void CaptureWindow_MouseMove(object sender, MouseEventArgs e) {
if (MouseX < 0) {
MouseX = e.X; MouseY = e.Y;
return;
}
if(Math.Abs(MouseX-e.X)>64 || Math.Abs(MouseY - e.Y) > 64)
InputDetected();
}
private void InputDetected() {
// Skip first second to avoid random events
if (DateTime.Now<InitTime.AddSeconds(1))
return;
MainUI.ActionsScheduled= MainUI.ActionsScheduled.Where(a=>!a.ScheduledAction.AbortOnInput).ToList();
MainUI.CaptureOverlay = null;
Close();
}
public DateTime InitTime = DateTime.Now;
private void CaptureWindow_Load(object sender, System.EventArgs e) {
}
}
}