SmolFennec.SharpSchedule 1.2.0

.NET 6.0 .NET Standard 1.3
Install-Package SmolFennec.SharpSchedule -Version 1.2.0
dotnet add package SmolFennec.SharpSchedule --version 1.2.0
<PackageReference Include="SmolFennec.SharpSchedule" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SmolFennec.SharpSchedule --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SmolFennec.SharpSchedule, 1.2.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SmolFennec.SharpSchedule as a Cake Addin
#addin nuget:?package=SmolFennec.SharpSchedule&version=1.2.0

// Install SmolFennec.SharpSchedule as a Cake Tool
#tool nuget:?package=SmolFennec.SharpSchedule&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SmolFennec.SharpSchedule

SmolFennec is a collective name for small libraries and tools released by Levi licensed under MIT and hosted on github. SharpSchedule is a DateTime scheduler for .NET that allows running code at specific times or intervals.

<img src="https://raw.githubusercontent.com/Levi--G/SmolFennec.SpeCLI/master/SpeCLI/SmolFennec.png" width="300" height="300">

NuGet version (SmolFennec.SharpSchedule)

Support

Supported platforms:

  • .Net Standard 1.3+ (limited features)
  • .Net Standard 2.0+

When in trouble: Submit an issue

Usage

There are currently 2 types:

  • Scheduler: The original synchronous scheduler using threads.
  • AsyncScheduler: A scheduler based on async delays

There are multiple ways to schedule an execution:

  • Schedule(Action/Func<Task>, DateTime, (optional)TimeSpan): Schedules an Action or Task to run synchronous with the scheduler for a specified time and optionally repeats this every x time. Recommended for console applications or when actions should be executed in order.
  • ScheduleAsync(Action/Func<Task>, DateTime, (optional)TimeSpan): Schedules an Action or Task to run asynchronous with the scheduler allowing multiple scheduled items to run at the same time. Recommended when the time is more important than the thread its executed on.
  • ScheduleSynchronized(Action/Func<Task>, DateTime, (optional)TimeSpan): Schedules an Action or Task to run on the current SynchronisationContext, handy for applications with a UI/Message pump.
  • ScheduleSynchronizedAsync(Action/Func<Task>, DateTime, (optional)TimeSpan): Async version of the Synchronised call. Recommended for most UI applications.
  • Schedule(ScheduleItem): Schedules a fully configured item as you want it.
Scheduler Scheduler = new Scheduler() { Precision = 10000 };
Scheduler.Schedule(ExecutesEveryHour, DateTime.Now, TimeSpan.FromHours(1));
Scheduler.Schedule(ExecutesOnce, DateTime.Now.AddMinutes(10));
Scheduler.Schedule(StopAll, DateTime.Now.AddHours(5).AddMinutes(1));
Scheduler.StartThread(); // Starts a thread to run the scheduled items

void ExecutesOnce()
{
    Console.WriteLine("10 minutes have passed");
}

void ExecutesEveryHour()
{
    Console.WriteLine("1 hour has passed");
}

void StopAll()
{
    Scheduler.Stop();
}

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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.2.0 97 4/21/2022
1.1.1 6,005 11/24/2021
1.1.0 221 11/23/2020
1.0.0 239 11/22/2020

Added better spinning option (UseBetterPrecision) to Threaded scheduler