bool SelectItem(string id) { if (id == null) { return(false); } IdInfo info = IdInfo.Parse(id); foreach (ListViewItem item in this.listView_tags.Items) { if (info.Prefix == "pii") { string current_pii = ListViewUtil.GetItemText(item, COLUMN_PII); if (current_pii == info.Text) { ListViewUtil.SelectLine(item, true); return(true); } } if (info.Prefix == "uid") { string current_uid = ListViewUtil.GetItemText(item, COLUMN_UID); if (current_uid == info.Text) { ListViewUtil.SelectLine(item, true); return(true); } } } return(false); }
// 修改一个检索点事项 private void button_modifyAccessPoint_Click(object sender, EventArgs e) { if (this.listView_accessPoints.SelectedItems.Count == 0) { MessageBox.Show(this, "尚未选择要修改的检索点事项"); return; } ListViewItem item = this.listView_accessPoints.SelectedItems[0]; AccessPointDialog dlg = new AccessPointDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.DbFromInfos = this.DbFromInfos; dlg.FromName = item.Text; dlg.Weight = ListViewUtil.GetItemText(item, 1); dlg.SearchStyle = ListViewUtil.GetItemText(item, 2); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } item.Text = dlg.FromName; ListViewUtil.ChangeItemText(item, 1, dlg.Weight); ListViewUtil.ChangeItemText(item, 2, dlg.SearchStyle); this.AccessPointsChanged = true; }
void menu_openTemplateFileByNotepad_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_templates.SelectedItems.Count == 0) { strError = "尚未选定要用记事本打开的模板文件事项"; goto ERROR1; } foreach (ListViewItem item in this.listView_templates.SelectedItems) { // ListViewItem item = this.listView_templates.SelectedItems[i]; string strFilePath = ListViewUtil.GetItemText(item, 1); if (String.IsNullOrEmpty(strFilePath) == true) { continue; } System.Diagnostics.Process.Start("notepad.exe", strFilePath); } return; ERROR1: MessageBox.Show(this, strError); }
void menu_fillBrowseCols_Click(object sender, EventArgs e) { List <string> pathlist = new List <string>(); List <ListViewItem> itemlist = new List <ListViewItem>(); for (int i = 0; i < this.listView_browse.Items.Count; i++) { ListViewItem item = this.listView_browse.Items[i]; string strFirstCol = ListViewUtil.GetItemText(item, 2); if (string.IsNullOrEmpty(strFirstCol) == false) { continue; } pathlist.Add(item.Text); itemlist.Add(item); } if (pathlist.Count > 0) { string strError = ""; int nRet = GetBrowseCols(pathlist, itemlist, out strError); if (nRet == -1) { MessageBox.Show(this, strError); } } }
internal int GetRemoteBiblioDbNames( string strRemoveServer, out List <string> dbnames, out string strError) { strError = ""; dbnames = new List <string>(); // 根据中心服务器名,找到 URL 用户名 密码 ListViewItem item = ListViewUtil.FindItem(this.listView_center, strRemoveServer, 0); if (item == null) { strError = "中心服务器 '" + strRemoveServer + "' 尚未定义"; return(-1); } string strUrl = ListViewUtil.GetItemText(item, 1); string strUserName = ListViewUtil.GetItemText(item, 2); string strPassword = (string)item.Tag; return(GetRemoteBiblioDbNames( strUrl, strUserName, strPassword, out dbnames, out strError)); }
// 刷新实例状态显示 void RefreshInstanceState() { bool bError = false; string strError = ""; foreach (ListViewItem item in this.listView_instance.Items) { if (bError) { item.ImageIndex = IMAGEINDEX_STOPPED; continue; } string strInstanceName = ListViewUtil.GetItemText(item, COLUMN_NAME); int nRet = dp2capo_serviceControl( "getState", strInstanceName, out strError); if (nRet == -1) { // 只要出错一次,后面就不再调用 dp2library_serviceControl() bError = true; item.ImageIndex = IMAGEINDEX_STOPPED; } else if (nRet == 0 || strError == "stopped") { item.ImageIndex = IMAGEINDEX_STOPPED; } else { // nRet == 1 item.ImageIndex = IMAGEINDEX_RUNNING; } } }
// 构造<locationTypes>定义的XML片段 // 注意包含了<locationTypes>元素作为根。 int BuildLocationTypesDef(out string strLocationDef, out string strError) { strError = ""; strLocationDef = ""; XmlDocument dom = new XmlDocument(); dom.LoadXml("<locationTypes />"); for (int i = 0; i < this.listView_location_list.Items.Count; i++) { ListViewItem item = this.listView_location_list.Items[i]; string strText = item.Text; string strCanBorrow = ListViewUtil.GetItemText(item, 1); bool bCanBorrow = false; if (strCanBorrow == "是" || strCanBorrow == "yes") bCanBorrow = true; XmlNode nodeItem = dom.CreateElement("item"); dom.DocumentElement.AppendChild(nodeItem); nodeItem.InnerText = strText; DomUtil.SetAttr(nodeItem, "canborrow", bCanBorrow == true ? "yes" : "no"); } strLocationDef = dom.DocumentElement.OuterXml; return 0; }
private void listView_browse_SelectedIndexChanged(object sender, EventArgs e) { if (this.listView_browse.SelectedItems.Count == 1) { ListViewItem item = this.listView_browse.SelectedItems[0]; int nLineNo = this.listView_browse.SelectedIndices[0] + 1; if (item.ImageIndex == ITEMTYPE_OVERTHRESHOLD) { if (item.Text == this.RecordPath) { this.label_message.Text = "序号 " + nLineNo.ToString() + ": 发起查重的记录(自己)"; } else { this.label_message.Text = "序号 " + nLineNo.ToString() + ": 重复的记录"; } } else { this.label_message.Text = "序号 " + nLineNo.ToString(); } } else { this.label_message.Text = ""; } // 装入(未装入的)浏览列 if (this.listView_browse.SelectedItems.Count > 0) { List <string> pathlist = new List <string>(); List <ListViewItem> itemlist = new List <ListViewItem>(); foreach (ListViewItem item in this.listView_browse.SelectedItems) { string strFirstCol = ListViewUtil.GetItemText(item, 2); if (string.IsNullOrEmpty(strFirstCol) == false) { continue; } pathlist.Add(item.Text); itemlist.Add(item); } if (pathlist.Count > 0) { string strError = ""; int nRet = GetBrowseCols(pathlist, itemlist, out strError); if (nRet == -1) { MessageBox.Show(this, strError); } } } ListViewUtil.OnSelectedIndexChanged(this.listView_browse, 0, null); }
private void button_modifyInstance_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_instance.SelectedItems.Count == 0) { strError = "尚未选择要修改的实例"; goto ERROR1; } ListViewItem item = this.listView_instance.SelectedItems[0]; InstanceDialog dlg = new InstanceDialog(); FontUtil.AutoSetDefaultFont(dlg); dlg.ParentDialog = this; dlg.Index = this.listView_instance.Items.IndexOf(item); dlg.InstanceName = ListViewUtil.GetItemText(item, COLUMN_NAME); dlg.DataDir = ListViewUtil.GetItemText(item, COLUMN_DATADIR); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel) { return; } RefreshItemLine(item, dlg.DataDir); return; ERROR1: MessageBox.Show(this, strError); }
private void toolStripButton_location_modify_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_location_list.SelectedItems.Count == 0) { strError = "尚未选定要修改的馆藏地点事项"; goto ERROR1; } ListViewItem item = this.listView_location_list.SelectedItems[0]; LocationItemDialog dlg = new LocationItemDialog(); dlg.LocationString = ListViewUtil.GetItemText(item, 0); dlg.CanBorrow = (ListViewUtil.GetItemText(item, 1) == "是") ? true : false; dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; ListViewUtil.ChangeItemText(item, 0, dlg.LocationString); ListViewUtil.ChangeItemText(item, 1, dlg.CanBorrow == true ? "是" : "否"); ListViewUtil.SelectLine(item, true); return; ERROR1: MessageBox.Show(this, strError); }
// 修改名字和注释 void menu_Modify(object sender, System.EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show(this, "尚未选择拟修改的模板记录事项..."); return; } TemplateRecordDialog dlg = new TemplateRecordDialog(); // string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0); dlg.TemplateName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0); dlg.TemplateComment = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1); dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } ListViewUtil.ChangeItemText(this.listView1.SelectedItems[0], 0, dlg.TemplateName); ListViewUtil.ChangeItemText(this.listView1.SelectedItems[0], 1, dlg.TemplateComment); this.Changed = true; }
// bool _bCountMode = false; private void listView_channel_DoubleClick(object sender, EventArgs e) { string strError = ""; int nRet = 0; if (this._queryState.IsCountMode() == true) { if (this.listView_channel.SelectedItems.Count == 0) { strError = "尚未选定要详细察看的事项"; goto ERROR1; } // 获得双击的 IP string strIP = PureIpString(ListViewUtil.GetItemText(this.listView_channel.SelectedItems[0], COLUMN_IP)); // 检索详细风格 nRet = DoSearch( "", // this.toolStripTextBox_UserName.Text, strIP, "", false, out strError); if (nRet == -1) { goto ERROR1; } } return; ERROR1: MessageBox.Show(this, strError); }
// 浏览行 为命令时候,应当出现的弹出菜单 private void CommandPopupMenu(object sender, MouseEventArgs e) { ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = null; int nSelectedItemCount = this.listView_records.SelectedItems.Count; string strFirstColumn = ""; if (nSelectedItemCount > 0) { strFirstColumn = ListViewUtil.GetItemText(this.listView_records.SelectedItems[0], 0); } menuItem = new MenuItem("载入下一批浏览行(&N)"); menuItem.DefaultItem = true; menuItem.Click += new System.EventHandler(this.menu_loadNextBatch_Click); contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem("载入余下全部浏览行(&A)"); menuItem.Click += new System.EventHandler(this.menu_loadRestAllBatch_Click); contextMenu.MenuItems.Add(menuItem); #if NO // --- menuItem = new MenuItem("-"); contextMenu.MenuItems.Add(menuItem); #endif contextMenu.Show(this.listView_records, new Point(e.X, e.Y)); }
// parameters: // refrsh_item 如果为空,表示要刷新全部 ListViewItem。否则只刷新这一个 ListViewItem void RefreshInstanceName(ListViewItem refresh_item = null) { int i = 0; foreach (ListViewItem item in this.listView_instance.Items) { if (refresh_item != null && item != refresh_item) { continue; } string data_dir = ListViewUtil.GetItemText(item, COLUMN_DATADIR); string instance_name = Path.GetFileName(data_dir); // 从配置文件中得到 instanceName 配置 string strFileName = Path.Combine(data_dir, "capo.xml"); string temp = InstanceDialog.GetInstanceName(strFileName); if (temp != null) { instance_name = temp; } ListViewUtil.ChangeItemText(item, COLUMN_NAME, instance_name); i++; } }
private void listView_browse_SelectedIndexChanged(object sender, EventArgs e) { ListViewUtil.OnSelectedIndexChanged(this.listView_browse, 0, null); if (this.listView_browse.SelectedItems.Count == 1) { this.SelectedRecPath = ListViewUtil.GetItemText(this.listView_browse.SelectedItems[0], 0); ItemTag tag = (ItemTag)this.listView_browse.SelectedItems[0].Tag; if (tag != null) { this.SelectedTimestamp = tag.Timestamp; } else { this.SelectedTimestamp = null; } DisplaySelectedRecord(this.listView_browse.SelectedItems[0]); } else { this.SelectedRecPath = ""; this.SelectedTimestamp = null; // Global.ClearHtmlPage(this.webBrowser1, this.TempDir); DisplaySelectedRecord(null); } }
public void StoreList() { _recpaths.Clear(); foreach (ListViewItem item in this.listView_records.Items) { _recpaths.Add(ListViewUtil.GetItemText(item, 0)); } }
void menu_deleteTemplatePages_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_templates.SelectedItems.Count == 0) { strError = "尚未选定要删除的模板事项"; goto ERROR1; } // 警告 DialogResult result = MessageBox.Show(this, "确实要删除所选定的 " + this.listView_templates.SelectedItems.Count.ToString() + " 项模板文件?\r\n\r\n(警告: 删除操作一旦进行,就无法用打印选项对话框上的“取消”按钮来取消)", "PrintOptionDlg", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.No) { return; } // 兑现最后一次对textbox的修改 // 以免删除后index发生变化,张冠李戴 this.RefreshContentToTemplateFile(); for (int i = this.listView_templates.SelectedIndices.Count - 1; i >= 0; i--) { int index = this.listView_templates.SelectedIndices[i]; ListViewItem item = this.listView_templates.Items[index]; string strFilePath = ListViewUtil.GetItemText(item, 1); try { File.Delete(strFilePath); } catch (Exception ex) { strError = "删除文件 '" + strFilePath + "' 时发生错误: " + ex.Message; //goto ERROR1; MessageBox.Show(this, strError); } this.m_newCreateTemplateFiles.Remove(strFilePath); this.listView_templates.Items.RemoveAt(index); this.m_bTempaltesChanged = true; } SaveTemplatesChanges(); // 修改无法撤销 return; ERROR1: MessageBox.Show(this, strError); }
// /// <summary> /// 获得一个报表的频率 /// </summary> /// <param name="strReportName">报表名</param> /// <returns></returns> public List <string> GetReportFreq(string strReportName) { ListViewItem item = ListViewUtil.FindItem(this.listView_reports, strReportName, COLUMN_REPORT_NAME); if (item == null) { return(new List <string>()); } return(StringUtil.SplitList(ListViewUtil.GetItemText(item, COLUMN_REPORT_FREQ))); }
void menu_modify_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_actions.SelectedIndices.Count == 0) { strError = "尚未选定要修改的行"; goto ERROR1; } ListViewItem item = this.listView_actions.SelectedItems[0]; List <string> used_fieldnames = GetUsedFieldNames(); used_fieldnames.Remove(ListViewUtil.GetItemText(item, 0)); // 去掉当前事项已经使用的名字 OneActionDialog dlg = new OneActionDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ElementCaption = this.ElementCaption; dlg.UserDir = this.MainForm.UserDir; dlg.DataDir = this.MainForm.DataDir; dlg.CfgDom = this.CfgDom; dlg.UsedFieldNames = used_fieldnames; dlg.FieldName = ListViewUtil.GetItemText(item, 0); dlg.FieldValue = ListViewUtil.GetItemText(item, 1); dlg.FieldValueAdd = ListViewUtil.GetItemText(item, 2); dlg.FieldValueRemove = ListViewUtil.GetItemText(item, 3); // dlg.Additional = ListViewUtil.GetItemText(item, 4); dlg.RefDbName = this.RefDbName; // dlg.AddOrRemoveListDropDown += dlg_AddOrRemoveListDropDown; dlg.GetValueTable -= new GetValueTableEventHandler(dlg_GetValueTable); dlg.GetValueTable += new GetValueTableEventHandler(dlg_GetValueTable); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); if (dlg.DialogResult != System.Windows.Forms.DialogResult.OK) { return; } ListViewUtil.ChangeItemText(item, 0, dlg.FieldName); ListViewUtil.ChangeItemText(item, 1, dlg.FieldValue); ListViewUtil.ChangeItemText(item, 2, dlg.FieldValueAdd); ListViewUtil.ChangeItemText(item, 3, dlg.FieldValueRemove); ListViewUtil.ChangeItemText(item, 4, dlg.Additional); ListViewUtil.SelectLine(item, true); return; ERROR1: MessageBox.Show(this, strError); }
// 修改一个事项 private void toolStripButton_modifyItem_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_list.SelectedItems.Count == 0) { strError = "尚未选定要修改的事项"; goto ERROR1; } ListViewItem item = this.listView_list.SelectedItems[0]; OrderOutputItemDialog dlg = new OrderOutputItemDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ScriptManager = this.ScriptManager; dlg.AppInfo = this.AppInfo; dlg.ExcludeSellers = GetUsedSellers(item); dlg.GetValueTable -= new GetValueTableEventHandler(dlg_GetValueTable); dlg.GetValueTable += new GetValueTableEventHandler(dlg_GetValueTable); dlg.Seller = ListViewUtil.GetItemText(item, 0); dlg.OutputFormat = ListViewUtil.GetItemText(item, 1); dlg.StartPosition = FormStartPosition.CenterScreen; REDO_INPUT: dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } // TODO: 渠道名查重 ListViewItem dup = ListViewUtil.FindItem(this.listView_list, dlg.Seller, 0); if (dup != null && dup != item) { MessageBox.Show(this, "修改后的渠道名 '" + dlg.Seller + "' 在当前列表中已经存在。请重新输入..."); goto REDO_INPUT; } ListViewUtil.ChangeItemText(item, 0, dlg.Seller); ListViewUtil.ChangeItemText(item, 1, dlg.OutputFormat); // ListViewUtil.SelectLine(item, true); this.m_bChanged = true; return; ERROR1: MessageBox.Show(this, strError); }
// 修改名字和注释 void menu_modify(object sender, System.EventArgs e) { string strError = ""; if (listView1.SelectedItems.Count == 0) { strError = "尚未选择拟修改的模板记录事项..."; goto ERROR1; } ListViewItem item = listView1.SelectedItems[0]; TemplateRecordDlg dlg = new TemplateRecordDlg(); GuiUtil.SetControlFont(dlg, this.Font, false); string strOldName = ListViewUtil.GetItemText(item, 0); dlg.TemplateName = ListViewUtil.GetItemText(item, 0); dlg.Comment = ListViewUtil.GetItemText(item, 1); REDO_INPUT: dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } // 查重 2014/6/21 ListViewItem dup = ListViewUtil.FindItem(this.listView1, dlg.TemplateName, 0); if (dup != null && dup != item) { strError = "模板名 '" + dlg.TemplateName + "' 已经被使用了,不允许重复出现。请重新输入模板名"; MessageBox.Show(this, strError); goto REDO_INPUT; } int nRet = ChangeRecordProperty(strOldName, dlg.TemplateName, dlg.Comment, out strError); if (nRet == -1) { goto ERROR1; } FillList(false); return; ERROR1: MessageBox.Show(this, strError); }
List <string> GetSelectedPathList() { List <string> results = new List <string>(); foreach (ListViewItem item in this.listView1.SelectedItems) { results.Add(ListViewUtil.GetItemText(item, 0)); } return(results); }
private void listView_papers_SelectedIndexChanged(object sender, EventArgs e) { if (this.listView_papers.SelectedItems.Count == 1) { this.textBox_paperName.Text = ListViewUtil.GetItemText(this.listView_papers.SelectedItems[0], COLUMN_PAPERNAME); } else { this.textBox_paperName.Text = ""; } }
void SetItemColor() { foreach (ListViewItem item in this.listView1.Items) { string strState = ListViewUtil.GetItemText(item, 1); if (strState == "已安装") { item.ForeColor = SystemColors.GrayText; item.ImageIndex = -1; } } }
private void button_selectAll_Click(object sender, EventArgs e) { foreach (ListViewItem item in this.listView1.Items) { string strState = ListViewUtil.GetItemText(item, 1); if (strState == "已安装") { continue; } item.Checked = true; } }
// 装载全部行的数据 int LoadAllItemData(out string strError) { strError = ""; for (int i = 0; i < this.listView_items.Items.Count; i++) { ListViewItem item = this.listView_items.Items[i]; if (item.Tag != null) { continue; } int nRet = LoadItemData(item, out strError); if (nRet == -1) { return(-1); } nRet = FillLine( item, out strError); if (nRet == -1) { return(-1); } } // 检查是否有重复的证条码号 List <string> barcodes = new List <string>(); foreach (ListViewItem item in this.listView_items.Items) { string strBarcde = ListViewUtil.GetItemText(item, COLUMN_BARCODE); if (string.IsNullOrEmpty(strBarcde) == true) { continue; } barcodes.Add(strBarcde); } if (barcodes.Count > 0) { int nCount = barcodes.Count; StringUtil.RemoveDupNoSort(ref barcodes); if (nCount != barcodes.Count) { MessageBox.Show(this, "发现有重复的证条码号,这是一个严重错误,请联系管理员"); } } return(0); }
void menu_modifyColumn_Click(object sender, EventArgs e) { string strError = ""; // int nRet = 0; if (this.listView_columns.SelectedItems.Count == 0) { strError = "尚未选定要修改的事项"; goto ERROR1; } ListViewItem item = this.listView_columns.SelectedItems[0]; ReportColumnDialog dlg = new ReportColumnDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ColumnName = ListViewUtil.GetItemText(item, COLUMN_NAME); dlg.DataType = ListViewUtil.GetItemText(item, COLUMN_DATATYPE); dlg.ColumnAlign = ListViewUtil.GetItemText(item, COLUMN_ALIGN); dlg.CssClass = ListViewUtil.GetItemText(item, COLUMN_CSSCLASS); dlg.ColumnSum = StringUtil.GetBooleanValue( ListViewUtil.GetItemText(item, COLUMN_SUM), true); dlg.Eval = ListViewUtil.GetItemText(item, COLUMN_EVAL); if (this.AppInfo != null) { this.AppInfo.LinkFormState(dlg, "ReportColumnDialog_state"); } dlg.ShowDialog(this); if (this.AppInfo != null) { this.AppInfo.UnlinkFormState(dlg); } if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel) { return; } ListViewUtil.ChangeItemText(item, COLUMN_NAME, dlg.ColumnName); ListViewUtil.ChangeItemText(item, COLUMN_DATATYPE, dlg.DataType); ListViewUtil.ChangeItemText(item, COLUMN_ALIGN, dlg.ColumnAlign); ListViewUtil.ChangeItemText(item, COLUMN_CSSCLASS, dlg.CssClass); ListViewUtil.ChangeItemText(item, COLUMN_SUM, dlg.ColumnSum == true ? "yes" : "no"); ListViewUtil.ChangeItemText(item, COLUMN_EVAL, dlg.Eval); return; ERROR1: MessageBox.Show(this, strError); }
// 构造勾选事项字符串 string GetValue() { List <NumberedString> results = new List <NumberedString>(); string strResult = ""; for (int i = 0; i < this.listView1.Items.Count; i++) { ListViewItem item = this.listView1.Items[i]; if (item.Checked == false) { continue; } ItemInfo iteminfo = null; if (item.Tag != null) { iteminfo = (ItemInfo)item.Tag; } else { iteminfo = new ItemInfo(); iteminfo.Index = 99999; } NumberedString one = new NumberedString(); one.Index = iteminfo.Index; if (this.ReturnFirstPart == false) { one.Text = ListViewUtil.GetLineText(item); } else { one.Text = ListViewUtil.GetItemText(item, 0); } results.Add(one); } // 排序 results.Sort(new NumberdStringCompare()); for (int i = 0; i < results.Count; i++) { if (String.IsNullOrEmpty(strResult) == false) { strResult += ","; } strResult += results[i].Text; } return(strResult); }
// 方案名发生改变后,兑现到下方的缺省关系列表中 void ChangeDefaultProjectName(string strOldProjectName, string strNewProjectName) { if (strOldProjectName == strNewProjectName) { Debug.Assert(false, ""); return; } bool bChanged = false; int nCount = 0; for (int i = 0; i < listView_dup_defaults.Items.Count; i++) { ListViewItem item = this.listView_dup_defaults.Items[i]; // 兑现视觉修改 string strProjectName = ListViewUtil.GetItemText(item, 1); if (strProjectName == strOldProjectName) { ListViewUtil.ChangeItemText(item, 1, strNewProjectName); bChanged = true; nCount++; } } // 兑现DOM修改 XmlNodeList nodes = this.m_dup_dom.DocumentElement.SelectNodes( "//default[@project='" + strOldProjectName + "']"); Debug.Assert(nCount == nodes.Count, "两边数目应该相等"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; if (String.IsNullOrEmpty(strNewProjectName) == true) { // 删除 node.ParentNode.RemoveChild(node); } else { DomUtil.SetAttr(node, "project", strNewProjectName); } bChanged = true; } if (bChanged == true) { this.DupChanged = true; } }
private void listView1_ItemCheck(object sender, ItemCheckEventArgs e) { // 禁止勾选已安装的事项 ListViewItem item = this.listView1.Items[e.Index]; string strState = ListViewUtil.GetItemText(item, 1); if (strState == "已安装") { if (e.NewValue == CheckState.Checked) { e.NewValue = CheckState.Unchecked; } } }