private void buttonTimeSpan_Click(object sender, EventArgs e) { string type = comboBoxTime.SelectedItem.ToString(); try { string info = textBoxTimeBefor.Text.Trim(); switch (type) { case "时间转成时间戳": DateTime dt1 = Convert.ToDateTime(info); long ts = TimeUtils.ConvertDateTimeInt(dt1); textBoxTimeAfter.Text = string.Format("{0}", ts); break; case "时间戳转成时间": DateTime dt2 = TimeUtils.GetTime(info); textBoxTimeAfter.Text = string.Format("{0}", dt2.ToString("yyyy-MM-dd HH:mm:ss")); break; } } catch (Exception msg) { MessageBox.Show(string.Format("{0}\r\n{1}", type, msg.Message), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 解散房间请求 (战斗中) /// </summary> public void SendDissRoomApplyMsg() { MsgGlobal mGl = new MsgGlobal(); mGl.dis_room_info = new MsgDisRoomInfo(); MsgDisRoomInfo msg = mGl.dis_room_info; msg.voteTime = TimeUtils.ConvertDateTimeInt(System.DateTime.Now).ToString(); TCPNetWork.GetInstance().SendMsgToServer(ServerMsgKey.CLIENT_DISS_ROOM, mGl); }