|
|
|
@ -12,6 +12,7 @@ using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Core.BoxFoam.ViewModels
|
|
|
|
|
{
|
|
|
|
@ -29,10 +30,17 @@ namespace Aucma.Core.BoxFoam.ViewModels
|
|
|
|
|
FoamMachinesPageView foamMachinesPageView = new FoamMachinesPageView();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MainWindowViewModel()
|
|
|
|
|
{
|
|
|
|
|
UserContent = firstPage;
|
|
|
|
|
|
|
|
|
|
// 创建一个DispatcherTimer对象
|
|
|
|
|
DispatcherTimer timer = new DispatcherTimer();
|
|
|
|
|
timer.Interval = TimeSpan.FromSeconds(1);
|
|
|
|
|
timer.Tick += Timer_Tick;
|
|
|
|
|
timer.Start();
|
|
|
|
|
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
init();
|
|
|
|
@ -419,5 +427,36 @@ namespace Aucma.Core.BoxFoam.ViewModels
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
public string CurrentDateTime
|
|
|
|
|
{
|
|
|
|
|
get => _currentDateTime;
|
|
|
|
|
set => SetProperty(ref _currentDateTime, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string _shiftStr = string.Empty;
|
|
|
|
|
public string ShiftStr
|
|
|
|
|
{
|
|
|
|
|
get => _shiftStr;
|
|
|
|
|
set => SetProperty(ref _shiftStr, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Timer_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
// 判断当前是否是白班时间段
|
|
|
|
|
if (now.Hour >= 8 && now.Hour < 20)
|
|
|
|
|
{
|
|
|
|
|
ShiftStr = $"白班 08点-20点";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ShiftStr = $"夜班 20点-08点";
|
|
|
|
|
}
|
|
|
|
|
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|