更改初版
This commit is contained in:
80
OrpaonEMS.App/Models/DischargeTimeModel.cs
Normal file
80
OrpaonEMS.App/Models/DischargeTimeModel.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.System.Power;
|
||||
|
||||
namespace OrpaonEMS.App.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 放电时间模型
|
||||
/// 7、8月份11点放电
|
||||
/// 其他月份8点开始放点
|
||||
/// </summary>
|
||||
public class DischargeTimeModel
|
||||
{
|
||||
public DischargeTimeModel(DisChargeType disChargeType)
|
||||
{
|
||||
|
||||
CurDisChargeType = disChargeType;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前放电时间
|
||||
/// </summary>
|
||||
public DateTime CurDischargeTime { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// 可以放电吗?
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsCanDischarge()
|
||||
{
|
||||
DateTime currentTime = DateTime.Now;
|
||||
DateTime curDischargeTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, CurDischargeTime.Hour, 0, 0);
|
||||
|
||||
// Check if current time is after the configured discharge time
|
||||
if (currentTime.TimeOfDay >= curDischargeTime.TimeOfDay)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not yet time to discharge
|
||||
return false;
|
||||
}
|
||||
|
||||
private DisChargeType _CurDisChargeType;
|
||||
/// <summary>
|
||||
/// 当前放电模式
|
||||
/// </summary>
|
||||
public DisChargeType CurDisChargeType
|
||||
{
|
||||
get { return _CurDisChargeType; }
|
||||
set
|
||||
{
|
||||
_CurDisChargeType = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 放电类型
|
||||
/// </summary>
|
||||
public enum DisChargeType
|
||||
{
|
||||
/// <summary>
|
||||
/// 放电模式A
|
||||
/// </summary>
|
||||
DischargeA = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 放电模式B
|
||||
/// </summary>
|
||||
DischargeB = 2,
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user