Skip to content

Commit b5e6a0c

Browse files
committed
Disable GR selector elements when running
1 parent a89db39 commit b5e6a0c

2 files changed

Lines changed: 135 additions & 121 deletions

File tree

Settings.cs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public Settings()
2020
LoadConfig();
2121

2222
// Load checkbox state for userTopMost pref
23-
onTopCheckBox.CheckState = Properties.Settings.Default.userTopMost
24-
? CheckState.Checked
25-
: CheckState.Unchecked;
23+
onTopCheckBox.CheckState = Properties.Settings.Default.userTopMost
24+
? CheckState.Checked
25+
: CheckState.Unchecked;
2626

2727
// Dismiss the settings window unless the user has oppened it manually
2828
if (Properties.Settings.Default.settingsChosen)
@@ -39,7 +39,7 @@ private void LoadConfig()
3939
else
4040
{
4141
string[] configBuffer = File.ReadAllLines(@"temp\RiftTimer.config");
42-
string[] configLineBuffer;
42+
string[] configLineBuffer;
4343

4444
foreach (string line in configBuffer)
4545
{
@@ -62,26 +62,26 @@ private void LoadConfig()
6262
private void SaveConfig()
6363
{
6464
string[] configBuffer = new string[]
65-
{
66-
$"playerClass:{Properties.Settings.Default.playerClass}",
67-
$"difficulty:{Properties.Settings.Default.difficulty}",
68-
$"posX:{Properties.Settings.Default.posX}",
65+
{
66+
$"playerClass:{Properties.Settings.Default.playerClass}",
67+
$"difficulty:{Properties.Settings.Default.difficulty}",
68+
$"posX:{Properties.Settings.Default.posX}",
6969
$"posY:{Properties.Settings.Default.posY}",
7070
$"settingsChosen:{Properties.Settings.Default.settingsChosen}",
7171
$"userTopMost:{Properties.Settings.Default.userTopMost}",
7272
$"isNormalRifts:{Properties.Settings.Default.isNormalRifts}"
73-
};
73+
};
7474

7575
File.WriteAllLines(@"temp\RiftTimer.config", configBuffer);
7676
}
7777

78-
// Center within default location of Rift Timer window
78+
// Center within default location of Rift Timer window
7979
private void Settings_Shown(object sender, EventArgs e)
8080
{
8181
int posX = Properties.Settings.Default.posX;
8282
int posY = Properties.Settings.Default.posY;
8383

84-
// (490, 321) is the base Size of the Rift Timer window
84+
// (490, 321) is the base Size of the Rift Timer window
8585
int locX = (posX + ((490 - this.Width) / 2));
8686
int locY = (posY + ((321 - this.Height) / 2));
8787

@@ -99,34 +99,34 @@ private void Settings_Shown(object sender, EventArgs e)
9999
private void Accept_Click(object sender, EventArgs e)
100100
{
101101
// Save selected options
102-
Properties.Settings.Default.userTopMost = onTopCheckBox.CheckState == CheckState.Checked;
102+
Properties.Settings.Default.userTopMost = onTopCheckBox.CheckState == CheckState.Checked;
103103
Properties.Settings.Default.settingsChosen = true;
104104
Properties.Settings.Default.Save();
105105

106-
Theme.Default.RiftTimer riftTimer = new Theme.Default.RiftTimer(
107-
timesList,
108-
isSessionLogged,
109-
logFileName
110-
);
111-
112-
this.Hide();
113-
114-
riftTimer.ShowDialog();
115-
116-
if (riftTimer.DialogResult == DialogResult.OK)
117-
{
118-
this.Show();
119-
Settings_Shown(this, e);
120-
121-
timesList = riftTimer.riftsList;
122-
isSessionLogged = riftTimer.isSessionLogged;
123-
logFileName = riftTimer.logFileName;
124-
}
125-
else if (riftTimer.DialogResult == DialogResult.Cancel)
126-
{
127-
SaveConfig();
128-
Close();
129-
}
130-
}
106+
Theme.Default.RiftTimer riftTimer = new Theme.Default.RiftTimer(
107+
timesList,
108+
isSessionLogged,
109+
logFileName
110+
);
111+
112+
this.Hide();
113+
114+
riftTimer.ShowDialog();
115+
116+
if (riftTimer.DialogResult == DialogResult.OK)
117+
{
118+
this.Show();
119+
Settings_Shown(this, e);
120+
121+
timesList = riftTimer.riftsList;
122+
isSessionLogged = riftTimer.isSessionLogged;
123+
logFileName = riftTimer.logFileName;
124+
}
125+
else if (riftTimer.DialogResult == DialogResult.Cancel)
126+
{
127+
SaveConfig();
128+
Close();
129+
}
130+
}
131131
}
132132
}

Theme/Default/RiftTimer.cs

Lines changed: 98 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public RiftTimer(
4343

4444
// recycle rifts list if coming back from settings
4545
if (riftsList != null)
46-
this.riftsList = riftsList;
46+
this.riftsList = riftsList;
4747

48-
this.isSessionLogged = isSessionLogged;
48+
this.isSessionLogged = isSessionLogged;
4949

5050
if (logFileName != null)
51-
this.logFileName = logFileName;
51+
this.logFileName = logFileName;
5252
}
5353

5454
// Handle global hotkey press
@@ -100,7 +100,7 @@ protected override void WndProc(ref Message m)
100100
"Crusader",
101101
"Demon Hunter",
102102
"Monk",
103-
"Necromancer",
103+
"Necromancer",
104104
"Witch Doctor",
105105
"Wizard"
106106
};
@@ -126,57 +126,60 @@ protected override void WndProc(ref Message m)
126126
"Torment XIII",
127127
"Torment XIV",
128128
"Torment XV",
129-
"Torment XVI",
129+
"Torment XVI",
130130
};
131131

132132
private int playerClass = Properties.Settings.Default.playerClass;
133-
private bool isNormalRifts = Properties.Settings.Default.isNormalRifts;
133+
private bool isNormalRifts = Properties.Settings.Default.isNormalRifts;
134134
private int difficulty = Properties.Settings.Default.difficulty;
135-
private int grDifficulty = Properties.Settings.Default.grDifficulty;
135+
private int grDifficulty = Properties.Settings.Default.grDifficulty;
136136

137137
private int posX = Properties.Settings.Default.posX;
138138
private int posY = Properties.Settings.Default.posY;
139139

140140
private bool isTopMost = Properties.Settings.Default.userTopMost;
141141

142-
private bool isCollapsed = false;
142+
private bool isCollapsed = false;
143143

144144
private void RiftTimer_Load(object sender, EventArgs e)
145-
{
146-
Point startPos = new Point(posX, posY);
147-
this.Location = startPos;
145+
{
146+
Point startPos = new Point(posX, posY);
147+
this.Location = startPos;
148+
149+
this.TopMost = isTopMost;
148150

149-
this.TopMost = isTopMost;
151+
CheckTime();
150152

151-
CheckTime();
153+
pauseIndicator.Text = "paused";
154+
pauseIndicator.Hide();
155+
finishIndicator.Text = "finished";
156+
finishIndicator.Hide();
152157

153-
pauseIndicator.Text = "paused";
154-
pauseIndicator.Hide();
155-
finishIndicator.Text = "finished";
156-
finishIndicator.Hide();
158+
pauseButton.Enabled = false;
159+
finishButton.Enabled = false;
160+
resetButton.Enabled = false;
157161

158-
pauseButton.Enabled = false;
159-
finishButton.Enabled = false;
160-
resetButton.Enabled = false;
162+
logBox.DataSource = riftsList;
163+
logBox.DrawMode = DrawMode.OwnerDrawFixed;
161164

162-
logBox.DataSource = riftsList;
163-
logBox.DrawMode = DrawMode.OwnerDrawFixed;
165+
classesDropDown.DataSource = classesList;
166+
classesDropDown.SelectedIndex = playerClass;
167+
difficultyDropDown.DataSource = difficultyList;
168+
difficultyDropDown.SelectedIndex = difficulty;
164169

165-
classesDropDown.DataSource = classesList;
166-
classesDropDown.SelectedIndex = playerClass;
167-
difficultyDropDown.DataSource = difficultyList;
168-
difficultyDropDown.SelectedIndex = difficulty;
169-
grUpDown.Value = grDifficulty;
170+
grUpDown.Minimum = 1;
171+
grUpDown.Maximum = 200;
172+
grUpDown.Value = grDifficulty;
170173

171-
UpdateRiftSelectors();
174+
UpdateRiftSelectors();
172175

173-
internalClock.Interval = 50;
174-
internalClock.Start();
176+
internalClock.Interval = 50;
177+
internalClock.Start();
175178

176-
//debugConsole.Show();
177-
}
179+
//debugConsole.Show();
180+
}
178181

179-
private void RiftTimer_Shown(object sender, EventArgs e)
182+
private void RiftTimer_Shown(object sender, EventArgs e)
180183
{
181184
logBox.ClearSelected();
182185
}
@@ -236,9 +239,9 @@ private void Finish_Click(object sender, EventArgs e)
236239
"Rift #", (riftsList.Count + 1).ToString("D3"), "|",
237240
time.Elapsed.ToString("mm\\:ss\\:ff"), "|",
238241
classesList[classesDropDown.SelectedIndex], "|",
239-
isNormalRifts
240-
? difficultyList[difficultyDropDown.SelectedIndex]
241-
: $"Greater Rift {grDifficulty}"
242+
isNormalRifts
243+
? difficultyList[difficultyDropDown.SelectedIndex]
244+
: $"Greater Rift {grDifficulty}"
242245
);
243246

244247
riftsList.Add(entryStr);
@@ -312,12 +315,21 @@ private void InternalClock_Tick(object sender, EventArgs e)
312315
{
313316
classesDropDown.Enabled = false;
314317
difficultyDropDown.Enabled = false;
318+
toggleRiftType.Enabled = false;
319+
320+
grUpDown.Enabled = false;
321+
grUpDown.Minimum = grUpDown.Value;
322+
grUpDown.Maximum = grUpDown.Value;
315323
}
316324
else
317325
{
318326
classesDropDown.Enabled = true;
319327
difficultyDropDown.Enabled = true;
320-
//pauseButton.Enabled = false;
328+
toggleRiftType.Enabled = true;
329+
330+
grUpDown.Enabled = true;
331+
grUpDown.Minimum = 1;
332+
grUpDown.Maximum = 200;
321333
}
322334

323335
if (isPaused)
@@ -378,10 +390,10 @@ private void logBox_DrawItem(object sender, DrawItemEventArgs e)
378390
if (e.Index > -1)
379391
{
380392
Color color = isSelected
381-
? SystemColors.Highlight
382-
: e.Index % 2 != 0
383-
? Color.SkyBlue
384-
: Color.White;
393+
? SystemColors.Highlight
394+
: e.Index % 2 != 0
395+
? Color.SkyBlue
396+
: Color.White;
385397

386398
SolidBrush bgBrush = new SolidBrush(color);
387399
SolidBrush txtBrush = new SolidBrush(e.ForeColor);
@@ -415,16 +427,16 @@ private void MenuItem_Settings_Click(object sender, EventArgs e)
415427
// Toggle panel height collapse mode via context menu item
416428
private void MenuItem_ToggleCollapse_Click(object sender, EventArgs e)
417429
{
418-
if (!isCollapsed)
419-
{
420-
isCollapsed = true;
421-
this.Size = new Size(490, 117);
422-
}
423-
else
424-
{
425-
isCollapsed = false;
426-
this.Size = new Size(490, 321);
427-
}
430+
if (!isCollapsed)
431+
{
432+
isCollapsed = true;
433+
this.Size = new Size(490, 117);
434+
}
435+
else
436+
{
437+
isCollapsed = false;
438+
this.Size = new Size(490, 321);
439+
}
428440
}
429441

430442
// Open file import log
@@ -444,7 +456,7 @@ private void MenuItem_ImportLog_Click(object sender, EventArgs e)
444456
private void MenuItem_SaveLog_Click(object sender, EventArgs e)
445457
{
446458
if (isSessionLogged)
447-
File.Delete(logFileName);
459+
File.Delete(logFileName);
448460

449461
LogToFile(riftsList);
450462
}
@@ -499,36 +511,38 @@ private void RiftTimer_FormClosed(object sender, FormClosedEventArgs e)
499511
DialogResult = DialogResult.Cancel;
500512
}
501513

502-
// Show the appropriate rift selector
503-
private void UpdateRiftSelectors()
504-
{
505-
if (isNormalRifts)
506-
{
507-
difficultyDropDown.Visible = true;
508-
grLevelLabel.Visible = false;
509-
grUpDown.Visible = false;
510-
}
511-
else
512-
{
513-
grLevelLabel.Visible = true;
514-
grUpDown.Visible = true;
515-
difficultyDropDown.Visible = false;
516-
}
517-
}
518-
519-
private void toggleRiftType_Click(object sender, EventArgs e)
520-
{
521-
isNormalRifts = !isNormalRifts;
522-
Properties.Settings.Default.isNormalRifts = isNormalRifts;
523-
UpdateRiftSelectors();
524-
}
525-
526-
private void grUpDown_ValueChanged(object sender, EventArgs e)
527-
{
528-
grDifficulty = (int)grUpDown.Value;
529-
Properties.Settings.Default.grDifficulty = grDifficulty;
530-
531-
grUpDown.Text = $"Greater Rift {grDifficulty}";
532-
}
533-
}
514+
// Show the appropriate rift selector
515+
private void UpdateRiftSelectors()
516+
{
517+
if (isNormalRifts)
518+
{
519+
difficultyDropDown.Visible = true;
520+
grLevelLabel.Visible = false;
521+
grUpDown.Visible = false;
522+
}
523+
else
524+
{
525+
grLevelLabel.Visible = true;
526+
grUpDown.Visible = true;
527+
difficultyDropDown.Visible = false;
528+
}
529+
}
530+
531+
private void toggleRiftType_Click(object sender, EventArgs e)
532+
{
533+
isNormalRifts = !isNormalRifts;
534+
Properties.Settings.Default.isNormalRifts = isNormalRifts;
535+
Properties.Settings.Default.Save();
536+
UpdateRiftSelectors();
537+
}
538+
539+
private void grUpDown_ValueChanged(object sender, EventArgs e)
540+
{
541+
grDifficulty = (int)grUpDown.Value;
542+
Properties.Settings.Default.grDifficulty = grDifficulty;
543+
Properties.Settings.Default.Save();
544+
545+
grUpDown.Text = $"Greater Rift {grDifficulty}";
546+
}
547+
}
534548
}

0 commit comments

Comments
 (0)