/// <summary> /// 控制版本升级 /// </summary> private void ControlUpdate() { HTable1 = operateclass.SelectXML(strOldXmlName); HTable2 = operateclass.SelectXML(strNewXmlName); IDictionaryEnumerator IDEnumerator1 = HTable1.GetEnumerator(); IDictionaryEnumerator IDEnumerator2 = HTable2.GetEnumerator(); string str = ""; while (IDEnumerator1.MoveNext()) { if (str == "") { str = IDEnumerator1.Key.ToString(); } else { str += "\n" + IDEnumerator1.Key.ToString(); } } //获取本地机器的最新版本 if (str.IndexOf("\n") != -1) { strOldVersion = str.Substring(str.LastIndexOf("\n") + 1, str.Length - str.LastIndexOf("\n") - 1); } else { strOldVersion = str; } //使用本地机器上的最新版本与服务器上的新版本进行比较 while (IDEnumerator2.MoveNext()) { if (string.Compare(strOldVersion, IDEnumerator2.Key.ToString()) < 0) { list.Add(IDEnumerator2.Key.ToString()); } } if (list.Count > 0) { frmUpdate frmupdate = new frmUpdate(); frmupdate.Show(); } else { MessageBox.Show("当前版本已经是最新版本,不需要升级!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//弹出升级窗口 private void btnUpdate_Click(object sender, EventArgs e) { frmUpdate frmupdate = new frmUpdate(); frmupdate.Show(); }