using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WindowsFormsApp1.entity; using WindowsFormsApp1.utils; namespace WindowsFormsApp1 { public partial class CardPwd : Form { public CardPwd(DateTime expire) { InitializeComponent(); Init(expire); } private void Init(DateTime expire) { this.label29.Visible = false; if (expire == null||TimeUtil.convertToTimeStamp(expire) <=0) { this.label5.Text = "你当前使用的是免费版-永久免费,仅能查看少量数据"; } else { // this.label5.Text = "您的共享版到期时间为:"+ TimeUtil.GetGeneralTime(expire,"yyyy.MM.dd HH:mm"); } } private void label3_Click(object sender, EventArgs e) { Config config = SQLiteDataBaseUtil.getInstance().GetConfig("admin_wx_ercode"); WXGroup pt = new WXGroup("管理员微信", config != null ? config.Value : ""); WindowsFormsApp1.utils.ui.FormUtil.ShowDialog(pt); } //价格 private void price_Click(object sender, EventArgs e) { Config config = SQLiteDataBaseUtil.getInstance().GetConfig("price_introduction"); String target = config == null ? "" : config.Value; try { System.Diagnostics.Process.Start(target); } catch (System.ComponentModel.Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) MessageBox.Show(noBrowser.Message); } } private void textBox1_TextChanged(object sender, EventArgs e) { } private void onSuccess(String result) { this.BeginInvoke(new OnSuccess((String result1) => { JObject obj = JObject.Parse(result); if (Convert.ToInt32(obj["code"]) == 0) { UserInfo user = JsonConvert.DeserializeObject(obj["data"].ToString()); Init(user.SdljShareExpireTime); MessageBox.Show("续费成功"); } else { this.label29.Text = obj["msg"].ToString(); this.label29.Visible = true; } }), result); } //验证卡密 private void button2_Click(object sender, EventArgs e) { if (StringUtil.isEmpty(this.textBox1.Text) || StringUtil.isEmpty(this.textBox2.Text)) { MessageBox.Show("请输入卡号和密码"); return; } String card = this.textBox1.Text; String pwd = this.textBox2.Text; ApiUtil.RenewShare(card, pwd, new OnSuccess(onSuccess)); } } }