58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using NLog;
|
|
|
|
namespace MP.Mon.Components
|
|
{
|
|
public partial class CmpFooter
|
|
{
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
//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();
|
|
//Log.Trace($"Elapsed Timer Footer");
|
|
}
|
|
|
|
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 currAssembly = typeof(Program).Assembly.GetName();
|
|
version = currAssembly.Version != null ? currAssembly.Version : new Version();
|
|
StartTimer();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static System.Timers.Timer aTimer = null!;
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
private Version version = null!;
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |