public static void MessageSendCompleted1(object sender, SendOrRecvMsgEventArgs e) { // if (e.Msg.Contains("COUT") && e.Msg.Contains("212880")) try { if (e.Msg.Contains("COUT") && e.Msg.Contains(localCommunicateStr_1)) { String str = e.Msg.ToString(); String[] arraystr = str.Split(','); //if (arraystr.Count() == 10) //{ localCommunicateStr_1 = "8888#####"; MessageBox.Show("北斗卫星指挥机通信成功! \n返回信息:\n" + arraystr[8]); // } } else if (e.Msg.Contains("SJXX") && flag == 1) { String str = e.Msg.ToString(); String[] arraystr = str.Split(','); //string time1 = arraystr[1]; SystemTime MySystemTime = new SystemTime(); //$SJXX,2016,11,4,16,1,3,% MySystemTime.vYear = ushort.Parse(arraystr[1]); MySystemTime.vMonth = ushort.Parse(arraystr[2]); MySystemTime.vDay = ushort.Parse(arraystr[3]); MySystemTime.vHour = ushort.Parse(arraystr[4]); MySystemTime.vMinute = ushort.Parse(arraystr[5]); MySystemTime.vSecond = ushort.Parse(arraystr[6]); SystemTimeConfig.SetLocalTime(MySystemTime); flag = 0; MessageBox.Show("授时成功!"); } } #pragma warning disable CS0168 // 声明了变量“e1”,但从未使用过 catch (Exception e1) #pragma warning restore CS0168 // 声明了变量“e1”,但从未使用过 { } }
public static void MessageSendCompleted1(object sender, SendOrRecvMsgEventArgs e) { // if (e.Msg.Contains("COUT") && e.Msg.Contains("212880")) try { if (e.Msg.Contains("COUT") && e.Msg.Contains(localCommunicateStr)) { String str = e.Msg.ToString(); String[] arraystr = str.Split(','); if (arraystr.Count() == 10) { localCommunicateStr = "99999#####"; MessageBox.Show("北斗卫星普通型本地通信成功! \n返回信息:\n" + arraystr[8]); } } else if (e.Msg.Contains("TINF")) { String str = e.Msg.ToString(); String[] arraystr = str.Split(','); string time1 = arraystr[1]; SystemTime MySystemTime = new SystemTime(); //2016-11-04 11:32:06.67 MySystemTime.vYear = ushort.Parse(time1.Substring(0, 4)); MySystemTime.vMonth = ushort.Parse(time1.Substring(5, 2)); MySystemTime.vDay = ushort.Parse(time1.Substring(8, 2)); MySystemTime.vHour = ushort.Parse(time1.Substring(11, 2)); MySystemTime.vMinute = ushort.Parse(time1.Substring(14, 2)); MySystemTime.vSecond = ushort.Parse(time1.Substring(17, 2)); SystemTimeConfig.SetLocalTime(MySystemTime); MessageBox.Show("授时成功!"); } } #pragma warning disable CS0168 // 声明了变量“e1”,但从未使用过 catch (Exception e1) #pragma warning restore CS0168 // 声明了变量“e1”,但从未使用过 { } }