private void joinBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(playerId.Text.Trim())) { MessageBox.Show("请输入一个ID", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //判断IP地址 var ipRegex = new Regex( @"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"); if (!ipRegex.IsMatch(serverIp.Text.Trim())) { MessageBox.Show("IP地址格式不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frame.StartClient(playerId.Text.Trim(), serverIp.Text.Trim(), enableUDP.Checked); GlobleSetting.PlayerID = playerId.Text.Trim(); GlobleSetting.LastAddress = serverIp.Text.Trim(); GlobleSetting.SaveAddress(); Close(); }
public object GetCourseList(string coursetype, bool ispage = false, int rows = 0, int offset = 0, string press = "", string grade = "", string subject = "", string orderby = "") { string errmsg = null; int total = 100; //生成测试数据代码 if (ConfigurationManager.AppSettings["createdata"].ToString().Equals("yes")) { List <self_course> courses = new List <self_course>(); for (int i = 0; i < rows; i++) { courses.Add(new self_course() { subject = 2, grade = 3, seqid = 1, source = "img/1/240-240/hx0001.jpg", abstracts = @"文题解释、译注解析、艺术鉴 赏、知识小结、文化常识、扩 展阅读和课后解答.....test", title = "课程测试数据", teachername = "李老师", time = "12H50Min", s_prise = 20, createdtime = i % 2 == 0 ? DateTime.Now : new DateTime(2017, 6, 1) } ); } return(new { courses = courses, msg = errmsg, coursetotal = total, pageindex = offset }); } List <QueryModel> parms = new List <QueryModel>(); parms.Add(new QueryModel() { name = "coursetype", exp = "and", value = GlobleSetting.GetDicValue(coursetype, "coursetype") }); parms.Add(new QueryModel() { name = "subject", exp = "and", value = GlobleSetting.GetDicValue(subject, "subject") }); parms.Add(new QueryModel() { name = "grade", exp = "and", value = GlobleSetting.GetDicValue(grade, "grade") }); parms.Add(new QueryModel() { name = "press", exp = "and", value = GlobleSetting.GetDicValue(press, "press") }); parms.Add(new QueryModel() { name = "version", exp = "and", value = GlobleSetting.GetDicValue(press, "version") }); List <self_course> coures = courseDAl.GetCourseByPaging(parms, ispage, offset, rows, false, out total, out errmsg); //重组课程封面 coures.ForEach(r => r.source = string.Format("{0}{1}", Globle.GlobleSetting.GetAppSettingKey("RootFilePath"), r.thumbnail)); return(new { courses = coures, msg = errmsg, coursetotal = total }); }
/// <summary> /// 保存设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void applyBtn_Click(object sender, EventArgs e) { //检测输入 var tcpPortValue = int.Parse(tcpPort.Text.Trim()); var udpPortValue = int.Parse(udpPort.Text.Trim()); var clientPortValue = int.Parse(clientUdp.Text.Trim()); if (tcpPortValue < 1000 || tcpPortValue > 65535) { MessageBox.Show("值范围为1000-65535", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (udpPortValue < 1000 || udpPortValue > 65535) { MessageBox.Show("值范围为1000-65535", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (clientPortValue < 1000 || clientPortValue > 65535) { MessageBox.Show("值范围为1000-65535", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } GlobleSetting.Adapter = adapterList.SelectedValue.ToString(); GlobleSetting.PlayerID = playerId.Text.Trim(); GlobleSetting.PingTimeout = (int)pingTimeout.Value; GlobleSetting.TcpPort = tcpPortValue; GlobleSetting.UdpPort = udpPortValue; GlobleSetting.ClientPort = clientPortValue; GlobleSetting.RequestTimeout = requestTimeout.Value; GlobleSetting.IsAsync = AsyncMode.Checked; GlobleSetting.SyncMode = syncCheck.Checked; GlobleSetting.SaveSetting(); MessageBox.Show("保存设置成功,请重新建立游戏或加入游戏", "设置成功", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); }
public object GetCourseList(string videotype, bool ispage = false, int rows = 0, int offset = 0) { string errmsg = null; int total = 0; //测试代码 if (ConfigurationManager.AppSettings["createdata"].ToString().Equals("yes")) { List <self_video> videos = new List <self_video>(); for (int i = 0; i < rows; i++) { videos.Add(new self_video() { subject = 2, seqid = 1, //source = "img/1/240-240/hx0001.jpg", source = RandomPic(), abstracts = "不错的视频", title = "测试的视频", s_price = 20 }); } return(new { courses = videos, msg = errmsg, coursetotal = total }); } List <QueryModel> parms = new List <QueryModel>(); parms.Add(new QueryModel() { name = "title", value = videotype, exp = "like" }); List <self_video> coures = videoDAL.GetVideoByPaging(parms, ispage, offset, rows, out total, out errmsg); coures.ForEach(r => r.source = string.Format("{0}{1}", GlobleSetting.GetAppSettingKey("RootFilePath"), r.thumbnail)); return(new { courses = coures, msg = errmsg, coursetotal = total }); }
private void InitGlobleSetting() { var setting = new GlobleSetting(); }