private void btnModifyCharMapping_Click(object sender, System.EventArgs e) { ListView.SelectedIndexCollection selIndexes = listViewCharMappings.SelectedIndices; if (selIndexes.Count < 1 || selIndexes.Count > 1) return; // only handle single selection at this time int selIndex = selIndexes[0]; // only support 1 Sfm2Xml.ClsInFieldMarker selectedIFM; selectedIFM = listViewCharMappings.Items[selIndex].Tag as Sfm2Xml.ClsInFieldMarker; using (var dlg = new LexImportWizardCharMarkerDlg(m_mediator.HelpTopicProvider, m_app, m_stylesheet)) { dlg.Init(selectedIFM, GetUILanguages(), m_cache); dlg.SetExistingBeginMarkers(ExtractExistingBeginMarkers(true)); dlg.SetExistingEndMarkers(ExtractExistingEndMarkers(true)); dlg.SetExistingElementNames(ExtractExistingElementNames(true)); if (dlg.ShowDialog(this) == DialogResult.OK) { m_dirtySenseLastSave = true; // remove the old from the treeview display listViewCharMappings.Items[selIndex].Selected = false; listViewCharMappings.Items[selIndex].Focused = false; listViewCharMappings.Items.RemoveAt(selIndex); // now update the item and add it again and then select it AddInLineMarker(dlg.IFM(), true); listViewCharMappings.Focus(); } } }
private void btnAddCharMapping_Click(object sender, System.EventArgs e) { using (var dlg = new LexImportWizardCharMarkerDlg(m_mediator.HelpTopicProvider, m_app, m_stylesheet)) { dlg.Init(null, GetUILanguages(), m_cache); dlg.SetExistingBeginMarkers(ExtractExistingBeginMarkers(false)); dlg.SetExistingEndMarkers(ExtractExistingEndMarkers(false)); dlg.SetExistingElementNames(ExtractExistingElementNames(false)); if (dlg.ShowDialog(this) == DialogResult.OK) { m_dirtySenseLastSave = true; // now add the new item and then select it AddInLineMarker(dlg.IFM(), true); listViewCharMappings.Focus(); } } }