This commit is contained in:
2025-10-29 11:42:58 +08:00
parent 7f6f84cd0e
commit a178c3550e
190 changed files with 81361 additions and 92 deletions

View File

@@ -0,0 +1,88 @@
using FATrace.WPLApp.Models;
using Prism.Events;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FATrace.WPLApp.Services
{
public class SysRunService : BindableBase
{
public SysRunService(IEventAggregator eventAggregator)
{
// 创建一个定时器设置间隔时间为2000毫秒即2秒
CurTimer = new System.Timers.Timer(5000);
CurTimer.AutoReset = true;
// 设置Elapsed事件处理程序
CurTimer.Elapsed += CurTimer_Elapsed;
// 启动定时器
CurTimer.Start();
}
private string? _CurUser;
/// <summary>
/// 当前的用户
/// </summary>
public string? CurUser
{
get { return _CurUser; }
set
{
if (_CurUser != value)
{
_CurUser = value;
if (string.IsNullOrEmpty(value))
{
IsLogin = false;
}
else
{
IsLogin = true;
}
RaisePropertyChanged();
}
}
}
private bool _IsLogin;
/// <summary>
/// 登录
/// </summary>
public bool IsLogin
{
get { return _IsLogin; }
set { _IsLogin = value; RaisePropertyChanged(); }
}
/// <summary>
/// 运行状态
/// </summary>
public SysRunState SysRunState { get; set; } = new SysRunState();
/// <summary>
/// 定时器
/// </summary>
private System.Timers.Timer CurTimer { get; set; }
private DateTime _CurDateTime;
/// <summary>
/// 当前时间信息
/// </summary>
public DateTime CurDateTime
{
get { return _CurDateTime; }
set { _CurDateTime = value; RaisePropertyChanged(); }
}
private void CurTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
CurDateTime = DateTime.Now;
}
}
}