MyToDoPackage 1.1.2.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package MyToDoPackage --version 1.1.2.3
NuGet\Install-Package MyToDoPackage -Version 1.1.2.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MyToDoPackage" Version="1.1.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MyToDoPackage --version 1.1.2.3
#r "nuget: MyToDoPackage, 1.1.2.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MyToDoPackage as a Cake Addin
#addin nuget:?package=MyToDoPackage&version=1.1.2.3

// Install MyToDoPackage as a Cake Tool
#tool nuget:?package=MyToDoPackage&version=1.1.2.3

This is a C# code snippet that defines a class named ToDoBase with a single method named GetWarningLevel. This method takes in two arguments: a DateTime object and a TimeZoneInfo object.

The GetWarningLevel method returns a value of an enumerated type named WarningLevel. This enumerated type has three possible values: Urgent, Safe, and Late.

The GetWarningLevel method first converts the current UTC time to the local time in the specified time zone (if a time zone is specified). It then calculates the time span between the current local time and the specified DateTime object.

If the time span is less than the URGENT_THRESHOLD_MINUTES constant value (which is currently set to 60 minutes) and greater than the LATE_THRESHOLD_MINUTES constant value (which is currently set to 0 minutes), the method returns WarningLevel.Urgent.

If the time span is greater than the URGENT_THRESHOLD_MINUTES constant value, the method returns WarningLevel.Safe.

Otherwise, the method returns WarningLevel.Late.

This method can be used to determine the warning level for a to-do item based on the time remaining until it is due. For example, if a to-do item is due in 30 minutes, the GetWarningLevel method would return WarningLevel.Urgent. If a to-do item is due in 120 minutes, the method would return WarningLevel.Safe. If a to-do item is overdue, the method would return WarningLevel.Late.

Here is an example of how you might use the GetWarningLevel method in your code:

using MyToDoPackage;

DateTime toDoDueDate = new DateTime(2022, 12, 20, 18, 0, 0); TimeZoneInfo toDoTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");

WarningLevel warningLevel = ToDoBase.GetWarningLevel(toDoDueDate, toDoTimeZone);

if (warningLevel == WarningLevel.Urgent) { Console.WriteLine("This to-do item is urgent!"); } else if (warningLevel == WarningLevel.Safe) { Console.WriteLine("This to-do item is safe."); } else { Console.WriteLine("This to-do item is late."); }

In this example, we create a DateTime object representing the due date and time of the to-do item, and a TimeZoneInfo object representing the time zone in which the to-do item is due. We then pass these two objects to the GetWarningLevel method, and store the returned value in a WarningLevel variable.

Finally, we use an if statement to check the value of the warningLevel variable, and print a message to the console based on the warning level. If the warning level is Urgent, we print "This to-do item is urgent!". If the warning level is Safe, we print "This to-do item is safe.". Otherwise, we print "This to-do item is late.".

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2.5 266 12/20/2022
1.1.2.4 254 12/20/2022
1.1.2.3 261 12/20/2022
1.1.2.2 260 12/20/2022
1.1.1.1 239 12/20/2022

This is the fourth release.