Files
Common-VS2019/SacsMobileMaui/Maui/Utils/SamTimerUtil.cs
T

29 lines
886 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace Sarand.Net.Mobile.Maui.Utils
{
//=======================================================================
public static class SamTimerUtil
{
//-------------------------------------------------------------------
// Timer utilities.
//-------------------------------------------------------------------
public static IDispatcherTimer DoTimer (BindableObject bindable, TimeSpan interval, bool isRepeating, EventHandler handler)
{
IDispatcherTimer timer = bindable.Dispatcher.CreateTimer();
timer.Interval = interval;
timer.IsRepeating = isRepeating;
timer.Tick += handler;
timer.Start();
return timer;
}
}
//=======================================================================
}