업무용 소스 예제
C# 시간 변경 함수 예제
안요사님
2021. 10. 10. 17:49
728x90
반응형
private void SetBTRTime(int sensorType)
{
try
{
int btrTime = 0;
if (sensorType < 10)
btrTime = ConvertBTRTimeIndex(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[sensorType].BTRTime);
else
btrTime = ConvertBTRTimeIndex(DataManagerUnit1.BDTSystemInfo.stBDTPRSInfo.BTRTime);
switch (sensorType)
{
case 0: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(0)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(0)) CompareWaterfall2.SetBTRTime(btrTime);
if (btrTime.Equals(5))
{
_ts_taskMainBDT[0] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[0].BTRTime + 1, 544);
_ts_taskCompareBDT[0] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[0].BTRTime + 1, 255);
}
else
{
_ts_taskMainBDT[0] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[0].BTRTime, 544);
_ts_taskCompareBDT[0] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[0].BTRTime, 255);
} break;
case 1: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(1)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(1)) CompareWaterfall2.SetBTRTime(btrTime);
_ts_taskMainBDT[1] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[1].BTRTime, 544);
_ts_taskCompareBDT[1] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[1].BTRTime, 255);
break;
case 2: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(2)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(2)) CompareWaterfall2.SetBTRTime(btrTime);
_ts_taskMainNDT[0] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[2].BTRTime, 544);
_ts_taskCompareNDT[0] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[2].BTRTime, 255);
break;
case 3: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(4)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(4)) CompareWaterfall2.SetBTRTime(btrTime);
if (btrTime.Equals(5))
{
_ts_taskMainBDT[2] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[3].BTRTime + 1, 544);
_ts_taskCompareBDT[2] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[3].BTRTime + 1, 255);
}
else
{
_ts_taskMainBDT[2] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[3].BTRTime, 544);
_ts_taskCompareBDT[2] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[3].BTRTime, 255);
} break;
case 4: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(5)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(5)) CompareWaterfall2.SetBTRTime(btrTime);
_ts_taskMainBDT[3] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[4].BTRTime, 544);
_ts_taskCompareBDT[3] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[4].BTRTime, 255);
break;
case 5: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(6)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(6)) CompareWaterfall2.SetBTRTime(btrTime);
_ts_taskMainNDT[1] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[5].BTRTime, 544);
_ts_taskCompareNDT[1] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[5].BTRTime, 255);
break;
case 6: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(7)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(7)) CompareWaterfall2.SetBTRTime(btrTime);
_ts_taskMainNDT[2] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[6].BTRTime, 544);
_ts_taskCompareNDT[2] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[6].BTRTime, 255);
break;
case 7: if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(8)) CompareWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(8)) CompareWaterfall2.SetBTRTime(btrTime);
_ts_taskMainNDT[3] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[7].BTRTime, 544);
_ts_taskCompareNDT[3] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTCInfo[7].BTRTime, 255);
break;
case 10: int prsBTR = DataManagerUnit1.BDTSystemInfo.stBDTPRSInfo.BTRTime;
if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13)) MainWaterfall.SetBTRTime(btrTime);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(sensorType)) CompareWaterfall.SetBTRTime(prsBTR);
else if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(sensorType)) CompareWaterfall2.SetBTRTime(prsBTR);
_ts_taskMainBDT[4] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTPRSInfo.BTRTime, 544);
_ts_taskCompareBDT[4] = GetIntervalTimeSpan(DataManagerUnit1.BDTSystemInfo.stBDTPRSInfo.BTRTime, 255);
break;
}
}
catch (Exception ee)
{
TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
}
}
728x90
C# 시간 변경 함수 예제
728x90
반응형