Files
ATV_STDLabelAttach/Handler/Project/RunCode/StateMachine/_SM_RUN.cs
2025-07-17 16:11:46 +09:00

44 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace Project
{
public partial class FMain
{
#region "Common Utility"
/// <summary>
/// 지정된 시간만큼 대기하며 완료되면 true를 반환합니다.
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
Boolean WaitForSeconds(eWaitType wait, double timems)
{
var idx = (byte)wait;
if (PUB.Result.WaitForVar[idx] == null || PUB.Result.WaitForVar[idx].Year == 1982)
{
PUB.Result.WaitForVar[idx] = PUB.Result.WaitForVar[idx] = DateTime.Now;
//Pub.log.Add(string.Format("Wait for [{0}], Wait Time:{1}ms", wait, timems));
}
var ts = DateTime.Now - PUB.Result.WaitForVar[idx];
if (ts.TotalSeconds >= timems) return true;
else return false;
}
void ResetWaitForSeconds(eWaitType wait)
{
var idx = (byte)wait;
PUB.Result.WaitForVar[idx] = DateTime.Parse("1982-11-23");
}
#endregion
}//cvass
}