forked from vipoo/iRacingReplayOverlay.net
-
Notifications
You must be signed in to change notification settings - Fork 5
/
AdvancedGeneralSettingsDlg.cs
188 lines (141 loc) · 6.9 KB
/
AdvancedGeneralSettingsDlg.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
using iRacingReplayDirector.Support;
using System;
using System.Windows.Forms;
using WK.Libraries.HotkeyListenerNS;
namespace iRacingReplayDirector
{
public partial class AdvancedGeneralSettingsDlg : Form
{
private Action onSave;
private Settings settings;
//dataBindings for variables to change
private Binding dataCameraStickyPeriod;
private Binding dataBattleStickyPeriod;
private Binding dataBattleGap;
private Binding dataHighlightVideoTargetDuration;
private Binding dataFollowLeaderBeforeRaceEndPeriod;
private Binding dataFollowLeaderAtRaceStartPeriod;
BindingManagerBase dataBinding;
internal static HotkeySelector hotKeySelectorStopStart = new HotkeySelector();
internal static HotkeySelector hotKeySelectorPauseResume = new HotkeySelector();
public AdvancedGeneralSettingsDlg(Settings settings)
{
this.settings = settings;
InitializeComponent();
//dataBinding.AddNew();
//DataBindings.Add(this.tbCameraStickyPeriod.DataBindings.Add("Text", this.settings, "CameraStickyPeriod", true, DataSourceUpdateMode.OnPropertyChanged));
//DataBindings.Add(this.tbCameraStickyPeriod.DataBindings.Add("Text", this.settings, "CameraStickyPeriod", true, DataSourceUpdateMode.OnPropertyChanged));
dataCameraStickyPeriod = this.tbCameraStickyPeriod.DataBindings.Add("Text", this.settings, "CameraStickyPeriod", true, DataSourceUpdateMode.OnPropertyChanged);
dataBattleStickyPeriod = this.tbBattleStickyPeriod.DataBindings.Add("Text", this.settings, "BattleStickyPeriod", true, DataSourceUpdateMode.OnPropertyChanged);
dataBattleGap = this.tbBattleGap.DataBindings.Add("Text", this.settings, "BattleGap", true, DataSourceUpdateMode.OnPropertyChanged);
dataHighlightVideoTargetDuration = this.tbHighlightVideoTargetDuration.DataBindings.Add("Text", this.settings, "HighlightVideoTargetDuration", true, DataSourceUpdateMode.OnPropertyChanged);
dataFollowLeaderBeforeRaceEndPeriod = this.tbFollowLeaderBeforeRaceEndPeriod.DataBindings.Add("Text", this.settings, "FollowLeaderBeforeRaceEndPeriod", true, DataSourceUpdateMode.OnPropertyChanged);
dataFollowLeaderAtRaceStartPeriod = this.tbFollowLeaderAtRaceStartPeriod.DataBindings.Add("Text", this.settings, "FollowLeaderAtRaceStartPeriod", true, DataSourceUpdateMode.OnPropertyChanged);
}
private void label1_Click(object sender, EventArgs e)
{
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBoxSettingDescription_TextChanged(object sender, EventArgs e)
{
}
private void tbCameraStickyPeriod_MouseHover(object sender, EventArgs e)
{
textBoxSettingDescription.Text = "The time period that must elapse before a new random camera is selected";
}
private void AdvanceGeneralSettingsDlg_Load(object sender, EventArgs e)
{
hotKeySelectorStopStart.Enable(tbHotKeyStopStart, new Hotkey(Settings.Default.strHotKeyStopStart));
hotKeySelectorPauseResume.Enable(tbHotKeyPauseResume, new Hotkey(Settings.Default.strHotKeyPauseResume));
}
private void label6_Click(object sender, EventArgs e)
{
}
private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{
}
private void checkBox_PerferedDriversOnly_CheckedChanged(object sender, EventArgs e)
{
if (sender.GetType() == typeof(CheckBox))
{
//enable/disable groupBox Drivers depending on status of checkbox
Boolean bChecked = ((CheckBox)sender).Checked;
groupBox_Drivers.Enabled = bChecked;
foreach (Control ctrl in groupBox_Drivers.Controls)
ctrl.Enabled = bChecked;
}
}
private void tabPageTiming_Click(object sender, EventArgs e)
{
}
private void tbBattleGap_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{
}
private void tbCameraStickyPeriod_MouseLeave(object sender, EventArgs e)
{
ClearToolTipTextbox();
}
private void ClearToolTipTextbox()
{
textBoxSettingDescription.Text = "";
}
private void tbBattleStickyPeriod_MouseHover(object sender, EventArgs e)
{
textBoxSettingDescription.Text = "The time period that must elapsed before a new battle is randomly selected.";
}
private void tbBattleStickyPeriod_MouseLeave(object sender, EventArgs e)
{
ClearToolTipTextbox();
}
private void ok_button_Click(object sender, EventArgs e)
{
//Undo of changes of databinding doesn't work at the moment. Even when DataSourceUpdateMode.Never is used.
/*dataCameraStickyPeriod.WriteValue();
dataBattleGap.WriteValue();
dataBattleStickyPeriod.WriteValue();
dataBattleGap.WriteValue();
dataHighlightVideoTargetDuration.WriteValue();
dataFollowLeaderBeforeRaceEndPeriod.WriteValue();
dataFollowLeaderAtRaceStartPeriod.WriteValue();*/
//Store hotkeys to control recording software
Settings.Default.strHotKeyStopStart = tbHotKeyStopStart.Text;
Settings.Default.strHotKeyPauseResume = tbHotKeyPauseResume.Text;
Settings.Default.Save();
//set Dialog Status to close form
this.DialogResult = DialogResult.OK;
}
private void cancel_button_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void btTestStopStartHotKey_Click(object sender, EventArgs e)
{
//send hotkey to test "Stop/Start" hotkey with your recording software
Hotkey newHotKey = HotkeyListener.Convert(tbHotKeyStopStart.Text);
KeyboardEmulator.SendHotkey(newHotKey);
}
private void btTestPauseResumeHotKey_Click(object sender, EventArgs e)
{
//send hotkey to test "Pause/Resume" hotkey with your recording software
Hotkey newHotKey = HotkeyListener.Convert(tbHotKeyPauseResume.Text);
KeyboardEmulator.SendHotkey(newHotKey);
}
private void tbHotKeyStopStart_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged_1(object sender, EventArgs e)
{
}
private void cbCaptureOpeningScenes_CheckedChanged(object sender, EventArgs e)
{
}
}
}