/// <summary> /// 返回所有相位表数据 /// </summary> /// <returns></returns> public static List<Phase> GetPhase() { TscData td = (TscData)Application.Current.Properties[Define.TSC_DATA]; byte[] byt = Udp.recvUdp(td.Node.sIpAddress, Define.GBT_PORT, Define.GET_PHASE); if (!CheckGBT(byt, "相位")) { return null; } List<Phase> listPhase = new List<Phase>(); //取得) byte[] phaseArray = new byte[Convert.ToInt32(byt[3]) * Define.PAHSE_BYTE_SIZE]; Array.Copy(byt, 4, phaseArray, 0, Convert.ToInt32(byt[3]) * Define.PAHSE_BYTE_SIZE); byte[,] twoArray = ByteUtils.oneArray2TwoArray(phaseArray, Convert.ToInt32(byt[3]), Define.PAHSE_BYTE_SIZE); Phase phase; for (int i = 0; i < Convert.ToInt32(byt[3]); i++) { phase = new Phase(); phase.ucId = twoArray[i, 0]; phase.ucPedestrianGreen = twoArray[i, 1]; phase.ucPedestrianClear = twoArray[i, 2]; phase.ucMinGreen = twoArray[i, 3]; phase.ucGreenDelayUnit = twoArray[i, 4]; phase.ucMaxGreen1 = twoArray[i, 5]; phase.ucMaxGreen2 = twoArray[i, 6]; phase.ucFixedGreen = twoArray[i, 7]; phase.ucGreenFlash = twoArray[i, 8]; phase.ucType = twoArray[i, 9]; phase.ucOption = twoArray[i, 10]; phase.ucExtend = twoArray[i, 11]; listPhase.Add(phase); } return listPhase; }
public static void SetPhaseByCurrent(Phase p) { Application.Current.Properties[Define.SELECTED_PHASE_OVERLAP] = p; }