TimeShifter 1.0.1
See the version list below for details.
dotnet add package TimeShifter --version 1.0.1
NuGet\Install-Package TimeShifter -Version 1.0.1
<PackageReference Include="TimeShifter" Version="1.0.1" />
paket add TimeShifter --version 1.0.1
#r "nuget: TimeShifter, 1.0.1"
// Install TimeShifter as a Cake Addin #addin nuget:?package=TimeShifter&version=1.0.1 // Install TimeShifter as a Cake Tool #tool nuget:?package=TimeShifter&version=1.0.1
TimeShifter.cs
What is Time Shifter ?
Time Shifter with a one sentences "Do not make a database call, wait ! Oh still user is typing some text. Time to go ? No still typing wait more. Hmm seems good now, lets search make a database request and search on db (or api etc.) !" Time Shifter is a solution to postpone serverside requests/calls for a specific time and making it only on idle time. It is useful for SearchBoxes to make a db call when user is idle. Whenever user continue typing etc. db call or api request pospones for a specific time.
Problem
- Calling DB/Api on every event or on action and can't cancelling previous one
- Recursive database requests or api requests
- Unexpectable user behaviour
Benefits
Useful for search text areas. Prevents several DB or Api calls in every key press or x action.
Purpose of Time Shifter ?
Solves running calls depending on unexpected situations. If you don't know when to make a DB call depending on user key typings TimeShifter will solve that issue. It is not a good way to call db or api on every user typing or call it every x seconds. The better way is "When user stops typing" so timeshifter calls only 1 time when user is idle.
Code Sample
public partial class Form1 : Form
{
TimeShifter<string> shifter;
public Form1()
{
InitializeComponent();
shifter = new TimeShifter<string>(3000, 200);
//test purpose
lblTime.Text = $"{shifter.ShiftingTime.ToString()} milliseconds";
}
private void Form1_Load(object sender, EventArgs e)
{
shifter.OnEndShiftingTime += Shifter_OnEndShiftingTime;
}
private void Shifter_OnEndShiftingTime(string obj)
{
listBox1.Items.Add($"Time to go db !");
listBox1.Items.Add($"Search: {obj}");
}
private async void txtSearch_TextChanged(object sender, EventArgs e)
{
listBox1.Items.Add($"No need to DB Call on text change..");
await shifter.Shift(txtSearch.Text);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.