private void buttonItem1_Click(object sender, EventArgs e) { if (dgvUDM.SelectedRows.Count < 0) { return; } DataGridViewRow row = dgvUDM.SelectedRows[0]; UDMGridRow udmrow = (row.DataBoundItem as UDMGridRow); XElement req = new XElement("Request", new XElement("ModuleName", udmrow.Name)); try { ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey); conn.CallService("UDMService.UpdateModule", new Envelope(new XStringHolder(req))); MessageBox.Show("更新完成。"); OnPrimaryKeyChanged(EventArgs.Empty); } catch (Exception ex) { RTOut.WriteError(ex); MessageBox.Show(ex.Message); } }
private void CheckUDMNewVersion(UDMGridRow s) { ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey); XElement req = new XElement("Request", new XElement("ModuleName", s.Name)); Envelope rsp = conn.CallService("UDMService.CheckUpdate", new Envelope(new XStringHolder(req))); XElement rspxml = XElement.Parse(rsp.BodyContent.XmlString); bool hasUpdate = rspxml.ElementBool("HasUpdate", false); if (hasUpdate) { s.Version = s.RawData.ElementText("Version") + "*"; } }
private void btnCheckUpdate_Click(object sender, EventArgs e) { IEnumerable <UDMGridRow> udms = GetSelectedUDM(); MultiTaskingRunner runner = new MultiTaskingRunner(); foreach (UDMGridRow udm in udms) { runner.AddTask(udm.Name, x => { UDMGridRow s = x as UDMGridRow; CheckUDMNewVersion(s); }, udm, new System.Threading.CancellationTokenSource()); } runner.AllTaskCompleted += delegate { }; runner.ExecuteTasks(); }
private void CheckUDMNewVersion(UDMGridRow s) { ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey); XElement req = new XElement("Request", new XElement("ModuleName", s.Name)); Envelope rsp = conn.CallService("UDMService.CheckUpdate", new Envelope(new XStringHolder(req))); XElement rspxml = XElement.Parse(rsp.BodyContent.XmlString); bool hasUpdate = rspxml.ElementBool("HasUpdate", false); if (hasUpdate) s.Version = s.RawData.ElementText("Version") + "*"; }