TimeShifter 1.0.2

dotnet add package TimeShifter --version 1.0.2                
NuGet\Install-Package TimeShifter -Version 1.0.2                
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="TimeShifter" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TimeShifter --version 1.0.2                
#r "nuget: TimeShifter, 1.0.2"                
#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 TimeShifter as a Cake Addin
#addin nuget:?package=TimeShifter&version=1.0.2

// Install TimeShifter as a Cake Tool
#tool nuget:?package=TimeShifter&version=1.0.2                

TimeShifter.cs

timeshifter

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.

Project Types

  • Mobile Projects
  • Desktop Projects
  • Web Projects
  • Backend projects that have unpredictable transactions

Code Sample

public partial class Form1 : Form
{
    TimeShifter<string> shifter;

    public Form1()
    {
        InitializeComponent();

        //Wait for 3 sec idle time to action, check that every 200 msec precision
        shifter = new TimeShifter<string>(3000, 200);
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        shifter.OnEndShiftingTime += Shifter_OnEndShiftingTime;
    }

    private void Shifter_OnEndShiftingTime(string obj)
    {
        //Do you job here
        //After 3sec idle time this method will be called
        //Whenever you call the Shift method this call will be postpone
        //For ex: Go db and search obj
    }

    private async void txtSearch_TextChanged(object sender, EventArgs e)
    {
        //No need to do your job here like go db and search a text every key press

        //Notify shifter that user still typing so this will postpone the OnEndShiftingTime method call
        await shifter.Shift(txtSearch.Text);
    }
}
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last updated
1.0.2 495 4/4/2022
1.0.1 429 4/3/2022
1.0.0 426 4/3/2022