private void getValue() { setXML xml = new setXML(); xml.setXMLPathLocal("update.xml"); this.txt_appdate.Value = Convert.ToDateTime(xml.getSetXmlValue("appDate")); this.txt_appversion.Text = xml.getSetXmlValue("appVersion"); this.txt_apppath.Text = xml.getSetXmlValue("appPath"); this.txt_appname.Text = xml.getSetXmlValue("appName"); this.txt_updateURL.Text = xml.getSetXmlValue("updatePath"); }
private void btn_save_Click(object sender, EventArgs e) { setXML xml = new setXML(); xml.setXMLPathLocal("update.xml"); xml.editxml("appVersion", this.txt_appversion.Text); xml.editxml("appDate", this.txt_appdate.Value.ToString("yyyy-MM-dd")); xml.editxml("appPath", this.txt_apppath.Text); xml.editxml("appName", this.txt_appname.Text); xml.editxml("updatePath", this.txt_updateURL.Text); MessageBox.Show("保存成功!"); }
private void btn_checkUpdate_Click(object sender, EventArgs e) { setUpdate update = new setUpdate(); setXML xml = new setXML(); xml.setXMLPathLocal("update.xml"); update.setUpdatePar(xml.getSetXmlValue("updatePath"), xml.getSetXmlValue("updateIndexFile")); bool ans = update.checkNewUpdate(xml.getSetXmlValue("lastupdateDate"), xml.getSetXmlValue("lastupdateVersion")); string [] updateStr = update.getNewUpdate(); if (ans == true) { MessageBox.Show("发现更新:" + updateStr[0] + "-v" + updateStr[1]); } else { MessageBox.Show("没有发现更新"); } }
private void btn_updateStart_Click(object sender, EventArgs e) { setUpdate update = new setUpdate(); setXML xml = new setXML(); xml.setXMLPathLocal("update.xml"); update.setUpdatePar(xml.getSetXmlValue("updatePath"), xml.getSetXmlValue("updateIndexFile")); bool ans = update.checkNewUpdate(xml.getSetXmlValue("lastupdateDate"), xml.getSetXmlValue("lastupdateVersion")); string[] updateStr = update.getNewUpdate(); if (ans == true) { // MessageBox.Show("发现更新:" + updateStr[0] + "-v" + updateStr[1]); if (MessageBox.Show("发现更新:" + updateStr[0] + "-v" + updateStr[1] + ",更新,请点击确认按钮,不更新请点击取消按钮", "更新", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { update.startUpdate(); MessageBox.Show("更新完成!"); } } else { MessageBox.Show("没有发现更新"); } }