Skip to content

Commit d038533

Browse files
committed
Add function summaries
1 parent d8386d8 commit d038533

6 files changed

Lines changed: 193 additions & 28 deletions

File tree

app/Project Tracker/Project Tracker/AddNewItem.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public AddNewItem() {
1919
inputBox.Focus();
2020
}
2121

22+
/// <summary>
23+
/// Adds the item to the current table when the return key is pressed.
24+
/// </summary>
2225
private void KeyPress(object sender, KeyEventArgs e) {
2326
if (e.Key == Key.Return) {
2427
if (inputBox.Text != "") {
@@ -42,6 +45,9 @@ private void KeyPress(object sender, KeyEventArgs e) {
4245
}
4346
}
4447

48+
/// <summary>
49+
/// Adds the item to the current table when the finish button is pressed.
50+
/// </summary>
4551
private void finishButton_Click(object sender, RoutedEventArgs e) {
4652
if (inputBox.Text != "") {
4753
if (Passthrough.SelectedIndex == 0) {
@@ -63,11 +69,17 @@ private void finishButton_Click(object sender, RoutedEventArgs e) {
6369
}
6470
}
6571

72+
/// <summary>
73+
/// Cancels the operation and hides the window.
74+
/// </summary>
6675
private void cancelButton_Click(object sender, RoutedEventArgs e) {
6776
Passthrough.IsAdding = false;
6877
this.Hide();
6978
}
7079

80+
/// <summary>
81+
/// Saves the item to the editing file.
82+
/// </summary>
7183
private void Save() {
7284
StringBuilder sb = new StringBuilder();
7385
StringWriter sw = new StringWriter(sb);

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

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ public AddNewProgram() {
5252
projectTitleInputBox.Focus();
5353
}
5454

55-
private void FirstForward() { // Moving from project title to project duration
55+
/// <summary>
56+
/// Moves the form from the project title to the project duration.
57+
/// </summary>
58+
private void FirstForward() {
5659
if (projectTitleInputBox.Text != "") {
5760
level = 1;
5861

@@ -75,7 +78,10 @@ private void FirstForward() { // Moving from project title to project duration
7578
}
7679
}
7780

78-
private void SecondForward() { // Moving from project duration to error list
81+
/// <summary>
82+
/// Moves the form from the project duration to the error list.
83+
/// </summary>
84+
private void SecondForward() {
7985
durationSuccess[0] = CheckValid(projectHourInputBox.Text, "hour");
8086
durationSuccess[1] = CheckValid(projectMinuteInputBox.Text, "minute");
8187
durationSuccess[2] = CheckValid(projectSecondInputBox.Text, "second");
@@ -111,7 +117,10 @@ private void SecondForward() { // Moving from project duration to error list
111117
}
112118
}
113119

114-
private void ThirdForward() { // Moving from error list to feature list
120+
/// <summary>
121+
/// Moves the form from the error list to the feature list.
122+
/// </summary>
123+
private void ThirdForward() {
115124
level = 3;
116125
projectTitleText.Text = "Features";
117126

@@ -124,7 +133,10 @@ private void ThirdForward() { // Moving from error list to feature list
124133
projectFeatureInputBox.Focus();
125134
}
126135

127-
private void FourthForward() { // Moving from feature list to comment list
136+
/// <summary>
137+
/// Moves the form from the feature list to the comment list.
138+
/// </summary>
139+
private void FourthForward() {
128140
level = 4;
129141
projectTitleText.Text = "Comments";
130142

@@ -137,7 +149,10 @@ private void FourthForward() { // Moving from feature list to comment list
137149
projectCommentInputBox.Focus();
138150
}
139151

140-
private void FifthForward() { // Moving from comment list to percent complete
152+
/// <summary>
153+
/// Moves the form from the comment list to the final result
154+
/// </summary>
155+
private void FifthForward() {
141156
level = 5;
142157
projectTitleText.Text = "Percent complete";
143158

@@ -161,6 +176,9 @@ private void FifthForward() { // Moving from comment list to percent complete
161176
commentResult.Visibility = Visibility.Visible;
162177
}
163178

179+
/// <summary>
180+
/// Finalizes the project and writes the files to the data folder.
181+
/// </summary>
164182
private void Finish() { // Creating file for new project
165183
if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/Project Tracker")) {
166184
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/Project Tracker");
@@ -254,6 +272,12 @@ private void FifthForward() { // Moving from comment list to percent complete
254272
* Checks the validitiy of the duration values to make sure they are real numbers.
255273
*/
256274

275+
/// <summary>
276+
/// Checks to make sure that numbers are valid.
277+
/// </summary>
278+
/// <param name="value">The string of the number to test.</param>
279+
/// <param name="identifier">The name for that number.</param>
280+
/// <returns>Returns true if a valid number and false if not.</returns>
257281
private bool CheckValid(string value, string identifier) {
258282
try {
259283
Int32.Parse(value);
@@ -266,6 +290,9 @@ private bool CheckValid(string value, string identifier) {
266290
}
267291
}
268292

293+
/// <summary>
294+
/// Advances to the next item in the form.
295+
/// </summary>
269296
private void nextButton_Click(object sender, RoutedEventArgs e) {
270297
switch (level) {
271298
case 0:
@@ -294,6 +321,12 @@ private void nextButton_Click(object sender, RoutedEventArgs e) {
294321
}
295322
}
296323

324+
/// <summary>
325+
/// Adds a row to the current table.
326+
/// </summary>
327+
/// <param name="value">The value to add to the table.</param>
328+
/// <param name="table">The table to add to.</param>
329+
/// <param name="tableCount">Which table we're adding to (0 = error, 1 = feature, 2 = comment).</param>
297330
private void AddRow(string value, Table table, int tableCount) {
298331
table.RowGroups[0].Rows.Add(new TableRow());
299332

@@ -332,6 +365,9 @@ private void AddRow(string value, Table table, int tableCount) {
332365
newRow.Cells.Add(new TableCell(new Paragraph(new Run(value))));
333366
}
334367

368+
/// <summary>
369+
/// Checks the table input box value and adds a row if valid.
370+
/// </summary>
335371
private void AddValue(object sender, MouseButtonEventArgs e) {
336372
if (level == 2) { // Error table
337373
if (projectErrorInputBox.Text != "") {
@@ -356,6 +392,9 @@ private void AddValue(object sender, MouseButtonEventArgs e) {
356392
}
357393
}
358394

395+
/// <summary>
396+
/// Advances through the thread or adds to the table depending on current view.
397+
/// </summary>
359398
private void KeyPress(object sender, KeyEventArgs e) {
360399
if (e.Key == Key.Return) {
361400
if (level == 0) { // Title page
@@ -394,7 +433,10 @@ private void KeyPress(object sender, KeyEventArgs e) {
394433

395434
}
396435

397-
private void FirstBack() { // From duration to project title
436+
/// <summary>
437+
/// Moves the form from the project duration to the project title.
438+
/// </summary>
439+
private void FirstBack() {
398440
level = 0;
399441

400442
cancelButton.Content = "Cancel";
@@ -410,7 +452,10 @@ private void FirstBack() { // From duration to project title
410452
projectTitleInputBox.Focus();
411453
}
412454

413-
private void SecondBack() { // From errors to duration
455+
/// <summary>
456+
/// Moves the form from the error list to the project duration.
457+
/// </summary>
458+
private void SecondBack() {
414459
level = 1;
415460

416461
this.Height = 190;
@@ -428,7 +473,10 @@ private void SecondBack() { // From errors to duration
428473
errorAddButton.Visibility = Visibility.Hidden;
429474
}
430475

431-
private void ThirdBack() { // From features to errors
476+
/// <summary>
477+
/// Moves the form from the feature list to the error list.
478+
/// </summary>
479+
private void ThirdBack() {
432480
level = 2;
433481

434482
projectTitleText.Text = "Errors";
@@ -441,7 +489,10 @@ private void ThirdBack() { // From features to errors
441489
projectFeatureInputBox.Visibility = Visibility.Hidden;
442490
}
443491

444-
private void FourthBack() { // From comments to features
492+
/// <summary>
493+
/// Moves the form from the comment list to the feature list.
494+
/// </summary>
495+
private void FourthBack() {
445496
level = 3;
446497

447498
projectTitleText.Text = "Features";
@@ -454,7 +505,10 @@ private void FourthBack() { // From comments to features
454505
projectCommentInputBox.Visibility = Visibility.Hidden;
455506
}
456507

457-
private void FifthBack() { // From percent complete to comments
508+
/// <summary>
509+
/// Moves the form from the final window to the comment list.
510+
/// </summary>
511+
private void FifthBack() {
458512
level = 4;
459513

460514
this.Height = 350;
@@ -472,6 +526,9 @@ private void FifthBack() { // From percent complete to comments
472526
commentResult.Visibility = Visibility.Hidden;
473527
}
474528

529+
/// <summary>
530+
/// Moves the form in a reverse order when the back/cancel button is pressed.
531+
/// </summary>
475532
private void cancelButton_Click(object sender, RoutedEventArgs e) {
476533
switch (level) {
477534
case 0:

0 commit comments

Comments
 (0)