private void lstIndexes_MouseDoubleClick(object sender, MouseEventArgs e) { if (this.lstIndexes.SelectedItems.Count != 1) { return; } IIndexMap pIndexMap = ((IIndexMap)lstIndexes.SelectedItems[0].Tag); string oldName = pIndexMap.Name; frmIndexMap indexMapFrm = new frmIndexMap(txtDB.Text, pIndexMap, _plugin); if (indexMapFrm.ShowDialog() != DialogResult.OK) { return; } lstIndexes.Items.Remove(this.lstIndexes.SelectedItems[0]); _plugin.PrintingConfig.IndexMaps.Remove(pIndexMap); IIndexMap indexMap = indexMapFrm.IndexMap; IIndexMap oldIdx = _plugin.PrintingConfig.IndexMaps.FirstOrDefault(c => c.Name == indexMap.Name); if (oldIdx != null) { MessageService.Current.Warn("同名索引设置以及存在,无法保存!"); return; } _plugin.PrintingConfig.IndexMaps.Add(indexMap); ListViewItem item = new ListViewItem(new string[] { indexMap.Name, indexMap.IndexLayerName, indexMap.TemplateName, indexMap.SearchFields, indexMap.NameField }); item.Tag = indexMap; lstIndexes.Items.Add(item); }
private void simpleButton1_Click(object sender, EventArgs e) { frmIndexMap indexMapFrm = new frmIndexMap(txtDB.Text, new IndexMap(), _plugin); if (indexMapFrm.ShowDialog() != DialogResult.OK) { return; } IIndexMap indexMap = indexMapFrm.IndexMap; IIndexMap oldIdx = _plugin.PrintingConfig.IndexMaps.FirstOrDefault(c => c.Name == indexMap.Name); if (oldIdx != null) { MessageService.Current.Warn("同名索引设置以及存在,无法保存!"); return; } _plugin.PrintingConfig.IndexMaps.Add(indexMap); ListViewItem item = new ListViewItem(new string[] { indexMap.Name, indexMap.IndexLayerName, indexMap.TemplateName, indexMap.SearchFields, indexMap.NameField }); item.Tag = indexMap; lstIndexes.Items.Add(item); }