Skip to content

Commit

Permalink
Small quality of life implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-DeForrest-Reynolds committed Dec 3, 2023
1 parent be23d93 commit b4f8cca
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 10 deletions.
1 change: 1 addition & 0 deletions Toolbox/Clearing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void Clear_Content_Boxes()
Clear_Times(MF.CookTime);
MF.TotalTimeValue.Text = "0 Days 0 Hours 0 Minutes";
MF.RecipeDescription.Text = "";
MF.RecipeIngredients.Items.Clear();
}
}
}
8 changes: 4 additions & 4 deletions Toolbox/Recipes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public partial class Toolbox
{
public static string Build_File_Formatted_Recipe(MainForm MF)
{
return $":Name\n{MF.RecipeName.Text}" +
$":Author\n{MF.RecipeAuthor.Text}" +
$":PrepTime\n{MF.PrepDays}:{MF.PrepHours}:{MF.PrepMinutes}\n" +
$":CookTime\n{MF.CookDays}:{MF.CookHours}:{MF.CookMinutes}\n" +
return $":Name\n{MF.RecipeName.Text}\n" +
$":Author\n{MF.RecipeAuthor.Text}\n" +
$":PrepTime\n{MF.PrepDays.Text}:{MF.PrepHours.Text}:{MF.PrepMinutes.Text}\n" +
$":CookTime\n{MF.CookDays.Text}:{MF.CookHours.Text}:{MF.CookMinutes.Text}\n" +
$":Description\n{MF.RecipeDescription.Text}\n" +
$":Ingredients\n{string.Join("|", MF.RecipeIngredients.Items.Cast<string>())}";
}
Expand Down
58 changes: 52 additions & 6 deletions Toolbox/Time.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,32 @@ public TimeSpan Update_TimeSpan(GroupBox TimeGroupBox)

TimeSpan Time = new(Days, Hours, Minutes, 0);

MinutesLabel.Text = Time.Minutes.ToString() + " " + MinutesLabel.Tag.ToString();
HoursLabel.Text = Time.Hours.ToString() + " " + HoursLabel.Tag.ToString();
DaysLabel.Text = Time.Days.ToString() + " " + DaysLabel.Tag.ToString();
if (Time.Days == 1)
{
DaysLabel.Text = Time.Days.ToString() + " Day ";
}
else
{
DaysLabel.Text = Time.Days.ToString() + " Days ";
}

if (Time.Hours == 1)
{
HoursLabel.Text = Time.Hours.ToString() + " Hour ";
}
else
{
HoursLabel.Text = Time.Hours.ToString() + " Hours ";
}

if (Time.Minutes == 1)
{
MinutesLabel.Text = Time.Minutes.ToString() + " Minute";
}
else
{
MinutesLabel.Text = Time.Minutes.ToString() + " Minutes";
}

return Time;
}
Expand All @@ -34,9 +57,32 @@ public string Format_Total_Time(TimeSpan TotalTimeSpan)
{
string FormattedTimeSpan = "";

FormattedTimeSpan += $"{TotalTimeSpan.Days} Days ";
FormattedTimeSpan += $"{TotalTimeSpan.Hours} Hours ";
FormattedTimeSpan += $"{TotalTimeSpan.Minutes} Minutes";
if (TotalTimeSpan.Days == 1)
{
FormattedTimeSpan += $"{TotalTimeSpan.Days} Day ";
}
else
{
FormattedTimeSpan += $"{TotalTimeSpan.Days} Days ";
}

if (TotalTimeSpan.Hours == 1)
{
FormattedTimeSpan += $"{TotalTimeSpan.Hours} Hour ";
}
else
{
FormattedTimeSpan += $"{TotalTimeSpan.Hours} Hours ";
}

if (TotalTimeSpan.Minutes == 1)
{
FormattedTimeSpan += $"{TotalTimeSpan.Minutes} Minute";
}
else
{
FormattedTimeSpan += $"{TotalTimeSpan.Minutes} Minutes";
}

return FormattedTimeSpan;
}
Expand Down

0 comments on commit b4f8cca

Please sign in to comment.