/// <summary> /// 转换 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { string result = this.richTextBox1.Text; if (string.IsNullOrEmpty(result)) { return; } List <string> ltData = result.TransLottery(); if (ltData == null) { return; } StringBuilder sb = new StringBuilder(); ltData.ForEach(l => { sb.Append(l + "\n"); }); this.richTextBox2.Text = sb.ToString(); bool bl = LotteryHelper.Update(this.dtp.Value, ltData); if (bl && NewLotteryHander != null) { NewLotteryHander(); } }
private void button2_Click(object sender, EventArgs e) { if (!WebHelper.Connected) { MessageBox.Show("请先连接网络"); return; } int index = WebHelper.Url.LastIndexOf("="); string strSub = WebHelper.Url.Substring(index + 1); string url = WebHelper.Url.Replace("num=" + strSub, "num=" + this.txtNum.Text); string result = WebHelper.Get(url); List <string> ltData = result.TransLottery(); if (ltData == null) { WebHelper.Connected = false; return; } bool bl = LotteryHelper.Update(this.date, ltData); if (bl && NewLotteryHander != null) { NewLotteryHander(); } }
/// <summary> /// 更新数据 /// </summary> /// <returns></returns> private bool updateData() { string result = WebHelper.Get(WebHelper.Url); List <string> ltData = result.TransLottery(); if (ltData == null) { WebHelper.Connected = false; return(false); } return(LotteryHelper.Update(this.dtp.Value, ltData)); }