59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using NLog;
|
|
|
|
namespace MP.SPEC.Components
|
|
{
|
|
public partial class CmpFooter : IDisposable
|
|
{
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
if (aTimer != null)
|
|
{
|
|
aTimer.Elapsed -= ElapsedTimer;
|
|
aTimer.Stop();
|
|
aTimer.Dispose();
|
|
}
|
|
}
|
|
|
|
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
|
{
|
|
var pUpd = Task.Run(async () =>
|
|
{
|
|
await Task.Delay(1);
|
|
await InvokeAsync(() => StateHasChanged());
|
|
});
|
|
pUpd.Wait();
|
|
}
|
|
|
|
public void StartTimer()
|
|
{
|
|
int tOutPeriod = 5000;
|
|
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
|
aTimer = new System.Timers.Timer(tOutPeriod);
|
|
aTimer.Elapsed += ElapsedTimer;
|
|
aTimer.Enabled = true;
|
|
aTimer.Start();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
var rawVers = typeof(Program).Assembly.GetName().Version; ;
|
|
version = rawVers != null ? rawVers : new Version("0.0.0.0");
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private System.Timers.Timer aTimer = null!;
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
private Version version = null!;
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |