private void btnModifyCharMapping_Click(object sender, EventArgs e) { if (m_lvCharMappings.SelectedItems.Count == 0) return; ListViewItem lvi = m_lvCharMappings.SelectedItems[0]; using (ImportCharMappingDlg dlg = new ImportCharMappingDlg()) { CharMapping cm = lvi.Tag as CharMapping; IApp app = (IApp)m_mediator.PropertyTable.GetValue("App"); dlg.Initialize(m_cache, m_mediator.HelpTopicProvider, app, m_stylesheet, cm); if (dlg.ShowDialog(this) == DialogResult.OK) { cm.BeginMarker = dlg.BeginMarker; cm.EndMarker = dlg.EndMarker; cm.EndWithWord = dlg.EndWithWord; cm.DestinationWritingSystemId = dlg.WritingSystemId; cm.DestinationStyle = dlg.StyleName; cm.IgnoreMarkerOnImport = dlg.IgnoreOnImport; ListViewItem lviNew = CreateListItemForCharMapping(cm); lvi.SubItems[0].Text = lviNew.SubItems[0].Text; lvi.SubItems[1].Text = lviNew.SubItems[1].Text; lvi.SubItems[2].Text = lviNew.SubItems[2].Text; lvi.SubItems[3].Text = lviNew.SubItems[3].Text; m_fDirtySettings = true; } } }
private void btnAddCharMapping_Click(object sender, EventArgs e) { using (ImportCharMappingDlg dlg = new ImportCharMappingDlg()) { IApp app = (IApp)m_mediator.PropertyTable.GetValue("App"); dlg.Initialize(m_cache, m_mediator.HelpTopicProvider, app, m_stylesheet, null); if (dlg.ShowDialog(this) == DialogResult.OK) { CharMapping cmNew = new CharMapping(); cmNew.BeginMarker = dlg.BeginMarker; cmNew.EndMarker = dlg.EndMarker; cmNew.EndWithWord = dlg.EndWithWord; cmNew.DestinationWritingSystemId = dlg.WritingSystemId; cmNew.DestinationStyle = dlg.StyleName; cmNew.IgnoreMarkerOnImport = dlg.IgnoreOnImport; m_rgcm.Add(cmNew); ListViewItem lvi = CreateListItemForCharMapping(cmNew); m_lvCharMappings.Items.Add(lvi); m_fDirtySettings = true; } } }