static CurrentStatus GetCurrentStatus(string returnMsg) { CurrentStatus cs; string a = returnMsg.Replace("\"1\":", "\"a\":").Replace("\"2\":", "\"b\":").Replace("\"3\":", "\"c\":").Replace("\"4\":", "\"d\":").Replace("\\u", "\\\\u").Replace("\"n\":[]", "\"n\":{}").Replace("\"p\":[]", "\"p\":{}"); object aa = JavaScriptConvert.DeserializeObject(a, typeof(CurrentStatus)); cs = aa as CurrentStatus; return cs; }
public void InitStatusData(CurrentStatus status) { if (status != null) { this.lblServerTime.Text = Utils.UnixTimestampToDateTime(status.serverTime.time).ToString("yy-MM-dd HH:mm:ss"); this.lblWeather.Text = Utils.UnicodeCharToChineseChar(status.weather.weatherDesc) + "[" + status.weather.weatherId + "]"; this.lblUID.Text = status.user.uId; this.lblUserName.Text = status.user.userName; this.lblMoney.Text = status.user.money.ToString(); this.lblExp.Text = status.user.exp.ToString(); this.pbx.ImageLocation = status.user.headPic; this.dtgvMain.DataSource = status.farmlandStatus; this.cmbbxFarmList.DataSource = status.farmlandStatus; this.cmbbxFarmList.DisplayMember = "a"; } }
private void RefeshCurrentStatusCompleted() { this.currentOperation = EnumOperation.None; ShowMessage("刷新数据完成!"); cs = GetCurrentStatus(this.wbMain.DocumentText); UpdateStatusForm(); ShowMessage("开始检查收获..."); for (int i = 0; i < this.cs.farmlandStatus.Length; i++) { if (cs.farmlandStatus[i].b == 6) { this.harvestList.Add(i); } } if (this.harvestList.Count > 0) { ShowMessage(this.harvestList.Count + "块等待收获!"); BeginHarvest(this.harvestList[0]); } else { ShowMessage("没有需要收获!"); } }
public StatusForm(CurrentStatus status) : this() { this.InitStatusData(status); }