ktsu.Invoker
1.0.1-pre.1
Prefix Reserved
See the version list below for details.
dotnet add package ktsu.Invoker --version 1.0.1-pre.1
NuGet\Install-Package ktsu.Invoker -Version 1.0.1-pre.1
<PackageReference Include="ktsu.Invoker" Version="1.0.1-pre.1" />
<PackageVersion Include="ktsu.Invoker" Version="1.0.1-pre.1" />
<PackageReference Include="ktsu.Invoker" />
paket add ktsu.Invoker --version 1.0.1-pre.1
#r "nuget: ktsu.Invoker, 1.0.1-pre.1"
#addin nuget:?package=ktsu.Invoker&version=1.0.1-pre.1&prerelease
#tool nuget:?package=ktsu.Invoker&version=1.0.1-pre.1&prerelease
ktsu.Invoker
ktsu.Invoker is a .NET library that provides methods to ensure delegates are executed on the intended thread. It is designed to simplify task execution and thread management in .NET applications where delegates are required to run within a specific context, such as the UI thread in WPF or WinForms applications, or the window thread in OpenGL or DirectX applications.
Installation
To install Invoker, you can use the .NET CLI:
dotnet add package ktsu.Invoker
Or you can use the NuGet Package Manager in Visual Studio to search for and install the ktsu.Invoker package.
Usage
See the Sample project for a complete example including Async overloads.
Basic Example
// Initialize an instance on the owning thread
var invoker = new Invoker();
// Queue a task from a different thread, which blocks until the delegate has been executed via DoInvokes() on the owning thread
invoker.Invoke(() => Console.WriteLine("Hello, World!"));
// Call DoInvokes() on the owning thread to execute queued tasks
invoker.DoInvokes();
// NOTE: If you queue from the owning thread the delegate will be executed immediately, bypassing DoInvokes()
// Delegates with return values are supported
string result = invoker.Invoke(() => "Hello, World!");
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Acknowledgements
Special thanks to all contributors and the .NET community for their support.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ktsu.Invoker:
Package | Downloads |
---|---|
ktsu.ImGuiApp
A scaffolding library to create Dear ImGui applications in .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.1-pre.1 | 106 | 4/4/2025 |
1.1.0 | 337 | 3/30/2025 |
1.0.1-pre.2 | 62 | 3/29/2025 |
1.0.1-pre.1 | 443 | 3/25/2025 |
1.0.0 | 589 | 3/19/2025 |
0.0.1 | 465 | 3/25/2025 |
## v1.0.0 (major)
Changes since v0.0.1:
- Update changelog script to include additional version check for the initial version ([@matt-edmondson](https://github.com/matt-edmondson))
## v0.0.1 (patch)
Changes since 0.0.0.0:
- Fix DoInvokesSameThreadShouldExecuteAllTasks test ([@matt-edmondson](https://github.com/matt-edmondson))
- Initial commit ([@matt-edmondson](https://github.com/matt-edmondson))
- Remove exclusion of LICENSE.md from project ([@matt-edmondson](https://github.com/matt-edmondson))
- Update changelog script to include additional version check for the initial version ([@matt-edmondson](https://github.com/matt-edmondson))
- Update README.md for ktsu.Invoker usage examples ([@matt-edmondson](https://github.com/matt-edmondson))
- Update README.md with improved usage examples ([@matt-edmondson](https://github.com/matt-edmondson))
- Update sample project file to disable packing ([@matt-edmondson](https://github.com/matt-edmondson))
- Update Sample.csproj to executable output type ([@matt-edmondson](https://github.com/matt-edmondson))