Skip to content

Commit 657a56c

Browse files
authored
Merge pull request #41 from CyanCoding/cyancoding-test-branch
Add plurality to variables
2 parents 8524ede + c3b95e8 commit 657a56c

2 files changed

Lines changed: 40 additions & 41 deletions

File tree

app/Project Tracker/Project Tracker/AddNewProgram.xaml.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public partial class AddNewProgram : Window {
2828

2929
private readonly FontFamily textFont = new FontFamily("Microsoft Sans Serif");
3030

31-
private int errorRowsAdded = 0; // We use a global variable so the AddRow function knows what id of a row to edit
32-
private int featureRowsAdded = 0;
31+
private int errorsRowsAdded = 0; // We use a global variable so the AddRow function knows what id of a row to edit
32+
private int featuresRowsAdded = 0;
3333
private int commentsRowsAdded = 0;
3434
// int rowSelectionID = 0; // We use this to identify which row is currently selected
3535

@@ -333,20 +333,20 @@ private void AddRow(string value, Table table, int tableCount) {
333333
TableRow newRow = null;
334334

335335
if (tableCount == 0) { // Error table
336-
newRow = table.RowGroups[0].Rows[errorRowsAdded];
336+
newRow = table.RowGroups[0].Rows[errorsRowsAdded];
337337

338-
errorRowsAdded++;
338+
errorsRowsAdded++;
339339

340-
if (errorRowsAdded % 2 == 0) { // Every other, change the color for readability purposes
340+
if (errorsRowsAdded % 2 == 0) { // Every other, change the color for readability purposes
341341
newRow.Background = new SolidColorBrush(sortColor);
342342
}
343343
}
344344
else if (tableCount == 1) { // Error table
345-
newRow = table.RowGroups[0].Rows[featureRowsAdded];
345+
newRow = table.RowGroups[0].Rows[featuresRowsAdded];
346346

347-
featureRowsAdded++;
347+
featuresRowsAdded++;
348348

349-
if (featureRowsAdded % 2 == 0) { // Every other, change the color for readability purposes
349+
if (featuresRowsAdded % 2 == 0) { // Every other, change the color for readability purposes
350350
newRow.Background = new SolidColorBrush(sortColor);
351351
}
352352
}

app/Project Tracker/Project Tracker/EditProgram.xaml.cs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public partial class EditProgram : Window {
2323

2424
// We use a list for the items instead of an array because we have to remove values if the user deletes an item
2525
private List<string> errors = new List<string>();
26-
2726
private List<string> errorsData = new List<string>();
2827
private List<string> features = new List<string>();
2928
private List<string> featuresData = new List<string>();
@@ -33,8 +32,8 @@ public partial class EditProgram : Window {
3332
private string percentComplete;
3433

3534
private string editingFile;
36-
private int errorRowsAdded = 0;
37-
private int featureRowsAdded = 0;
35+
private int errorsRowsAdded = 0;
36+
private int featuresRowsAdded = 0;
3837
private int commentsRowsAdded = 0;
3938
private bool isStopwatchRunning = false;
4039
private Thread timerThread;
@@ -77,12 +76,12 @@ private void AddRow(Table table, int rowsAddedValue, string value, int index, Li
7776
TableRow newRow = null;
7877

7978
if (rowsAddedValue == 0) {
80-
newRow = table.RowGroups[0].Rows[errorRowsAdded];
81-
errorRowsAdded++;
79+
newRow = table.RowGroups[0].Rows[errorsRowsAdded];
80+
errorsRowsAdded++;
8281
}
8382
else if (rowsAddedValue == 1) {
84-
newRow = table.RowGroups[0].Rows[featureRowsAdded];
85-
featureRowsAdded++;
83+
newRow = table.RowGroups[0].Rows[featuresRowsAdded];
84+
featuresRowsAdded++;
8685
}
8786
else if (rowsAddedValue == 2) {
8887
newRow = table.RowGroups[0].Rows[commentsRowsAdded];
@@ -170,10 +169,10 @@ private void ResetSelection(Table table, List<string> values, List<string> dataV
170169
}
171170

172171
if (rowsAddedValue == 0) {
173-
errorRowsAdded = 0;
172+
errorsRowsAdded = 0;
174173
}
175174
else if (rowsAddedValue == 1) {
176-
featureRowsAdded = 0;
175+
featuresRowsAdded = 0;
177176
}
178177
else if (rowsAddedValue == 2) {
179178
commentsRowsAdded = 0;
@@ -378,40 +377,40 @@ private void Read() {
378377
this.Dispatcher.Invoke(() =>
379378
{
380379
if (switchLabels.SelectedIndex == 0) { // Errors
381-
errorRowsAdded = 0;
380+
errorsRowsAdded = 0;
382381
try {
383382
for (int i = 0; i < errors.Count; i++) {
384383
errorTable.RowGroups[0].Rows[i].Cells.RemoveRange(0, 1);
385384
}
386385
}
387386
catch (ArgumentOutOfRangeException) {
388387
// They just added a new value
389-
SelectionChange(0, 0, errorRowsAdded, errorTable, errorsData);
388+
SelectionChange(0, 0, errorsRowsAdded, errorTable, errorsData);
390389
}
391390
int index = 0;
392391
foreach (string value in errors) {
393392
AddRow(errorTable, 0, value, index, errorsData);
394393
index++;
395394
}
396-
SelectionChange(rowSelectionID, rowSelectionID, errorRowsAdded, errorTable, errorsData);
395+
SelectionChange(rowSelectionID, rowSelectionID, errorsRowsAdded, errorTable, errorsData);
397396
}
398397
else if (switchLabels.SelectedIndex == 1) { // Features
399-
featureRowsAdded = 0;
398+
featuresRowsAdded = 0;
400399
try {
401400
for (int i = 0; i < features.Count; i++) {
402401
featureTable.RowGroups[0].Rows[i].Cells.RemoveRange(0, 1);
403402
}
404403
}
405404
catch (ArgumentOutOfRangeException) {
406405
// They just added a new value
407-
SelectionChange(0, 0, featureRowsAdded, featureTable, featuresData);
406+
SelectionChange(0, 0, featuresRowsAdded, featureTable, featuresData);
408407
}
409408
int index = 0;
410409
foreach (string value in features) {
411410
AddRow(featureTable, 1, value, index, featuresData);
412411
index++;
413412
}
414-
SelectionChange(rowSelectionID, rowSelectionID, featureRowsAdded, featureTable, featuresData);
413+
SelectionChange(rowSelectionID, rowSelectionID, featuresRowsAdded, featureTable, featuresData);
415414
}
416415
else if (switchLabels.SelectedIndex == 2) { // Comments
417416
commentsRowsAdded = 0;
@@ -569,8 +568,8 @@ private void Startup() {
569568
AddRow(commentTable, 2, comment, index, commentsData);
570569
index++;
571570
}
572-
ResetSelection(errorTable, errors, errorsData, 0, errorRowsAdded);
573-
ResetSelection(featureTable, features, featuresData, 1, featureRowsAdded);
571+
ResetSelection(errorTable, errors, errorsData, 0, errorsRowsAdded);
572+
ResetSelection(featureTable, features, featuresData, 1, featuresRowsAdded);
574573
ResetSelection(commentTable, comments, commentsData, 2, commentsRowsAdded);
575574

576575
errorScrollView.Focus();
@@ -681,10 +680,10 @@ private void KeyPress(object sender, KeyEventArgs e) {
681680
rowSelectionID--;
682681
}
683682
if (switchLabels.SelectedIndex == 0) { // Error table is selected
684-
SelectionChange(oldRowSelectionID, rowSelectionID, errorRowsAdded, errorTable, errorsData);
683+
SelectionChange(oldRowSelectionID, rowSelectionID, errorsRowsAdded, errorTable, errorsData);
685684
}
686685
else if (switchLabels.SelectedIndex == 1) { // Feature table is selected
687-
SelectionChange(oldRowSelectionID, rowSelectionID, featureRowsAdded, featureTable, featuresData);
686+
SelectionChange(oldRowSelectionID, rowSelectionID, featuresRowsAdded, featureTable, featuresData);
688687
}
689688
else { // Comment table is selected
690689
SelectionChange(oldRowSelectionID, rowSelectionID, commentsRowsAdded, commentTable, commentsData);
@@ -704,8 +703,8 @@ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs
704703
// then it'll obviously return an error. So we wait until AFTER
705704
// the tables have been initialized, aka after startup.
706705
if (isTablesGenerated) {
707-
ResetSelection(errorTable, errors, errorsData, 0, errorRowsAdded);
708-
ResetSelection(featureTable, features, featuresData, 1, featureRowsAdded);
706+
ResetSelection(errorTable, errors, errorsData, 0, errorsRowsAdded);
707+
ResetSelection(featureTable, features, featuresData, 1, featuresRowsAdded);
709708
ResetSelection(commentTable, comments, commentsData, 2, commentsRowsAdded);
710709

711710
if (switchLabels.SelectedIndex == 0) { // Errors
@@ -783,21 +782,21 @@ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs
783782
private void RemoveValue(object sender, MouseButtonEventArgs e) {
784783
try {
785784
if (switchLabels.SelectedIndex == 0) { // Errors
786-
SelectionChange(oldRowSelectionID, 0, errorRowsAdded, errorTable, errorsData);
785+
SelectionChange(oldRowSelectionID, 0, errorsRowsAdded, errorTable, errorsData);
787786
errors.RemoveAt(rowSelectionID);
788787
errorsData.RemoveAt(rowSelectionID);
789-
ResetSelection(errorTable, errors, errorsData, 0, errorRowsAdded);
788+
ResetSelection(errorTable, errors, errorsData, 0, errorsRowsAdded);
790789

791790
if (errors.Count == 0) {
792791
checkmarkButton.ToolTip = "Mark as completed";
793792
checkmarkButton.Text = "\xE739";
794793
}
795794
}
796795
else if (switchLabels.SelectedIndex == 1) { // Features
797-
SelectionChange(oldRowSelectionID, 0, featureRowsAdded, featureTable, featuresData);
796+
SelectionChange(oldRowSelectionID, 0, featuresRowsAdded, featureTable, featuresData);
798797
features.RemoveAt(rowSelectionID);
799798
featuresData.RemoveAt(rowSelectionID);
800-
ResetSelection(featureTable, features, featuresData, 1, featureRowsAdded);
799+
ResetSelection(featureTable, features, featuresData, 1, featuresRowsAdded);
801800

802801
if (features.Count == 0) {
803802
checkmarkButton.ToolTip = "Mark as completed";
@@ -867,18 +866,18 @@ private void CheckOff(object sender, MouseButtonEventArgs e) {
867866
if (switchLabels.SelectedIndex == 0) { // Errors
868867
if (errorsData[rowSelectionID] == "0") { // Not checked, check it!
869868
errorsData[rowSelectionID] = "1";
870-
ResetSelection(errorTable, errors, errorsData, 0, errorRowsAdded);
869+
ResetSelection(errorTable, errors, errorsData, 0, errorsRowsAdded);
871870

872-
if (errorRowsAdded == 1) {
871+
if (errorsRowsAdded == 1) {
873872
checkmarkButton.ToolTip = "Mark as incomplete";
874873
checkmarkButton.Text = "\xE73A";
875874
}
876875
}
877876
else { // Uncheck it
878877
errorsData[rowSelectionID] = "0";
879-
ResetSelection(errorTable, errors, errorsData, 0, errorRowsAdded);
878+
ResetSelection(errorTable, errors, errorsData, 0, errorsRowsAdded);
880879

881-
if (errorRowsAdded == 1) {
880+
if (errorsRowsAdded == 1) {
882881
checkmarkButton.ToolTip = "Mark as completed";
883882
checkmarkButton.Text = "\xE739";
884883
}
@@ -887,18 +886,18 @@ private void CheckOff(object sender, MouseButtonEventArgs e) {
887886
else if (switchLabels.SelectedIndex == 1) { // Features
888887
if (featuresData[rowSelectionID] == "0") {
889888
featuresData[rowSelectionID] = "1";
890-
ResetSelection(featureTable, features, featuresData, 1, featureRowsAdded);
889+
ResetSelection(featureTable, features, featuresData, 1, featuresRowsAdded);
891890

892-
if (featureRowsAdded == 1) {
891+
if (featuresRowsAdded == 1) {
893892
checkmarkButton.ToolTip = "Mark as incomplete";
894893
checkmarkButton.Text = "\xE73A";
895894
}
896895
}
897896
else {
898897
featuresData[rowSelectionID] = "0";
899-
ResetSelection(featureTable, features, featuresData, 1, featureRowsAdded);
898+
ResetSelection(featureTable, features, featuresData, 1, featuresRowsAdded);
900899

901-
if (featureRowsAdded == 1) {
900+
if (featuresRowsAdded == 1) {
902901
checkmarkButton.ToolTip = "Mark as completed";
903902
checkmarkButton.Text = "\xE739";
904903
}

0 commit comments

Comments
 (0)