private void m_btnEdit_Click(object sender, EventArgs e) { if (m_lvCharSpecs.SelectedItems.Count > 0) { var lvi = m_lvCharSpecs.SelectedItems[0]; var spec = lvi.Tag as PUACharacter; if (spec != null) { using (var dlg = new CustomCharDlg()) { dlg.PUAChar = spec; dlg.Modify = true; dlg.SetDialogProperties(this); dlg.ParentDialog = this; if (dlg.ShowDialog(this) == DialogResult.OK) { m_lvCharSpecs.Items.Remove(lvi); lvi = new PuaListItem(dlg.PUAChar); m_lvCharSpecs.Items.Add(lvi); m_fDirty = true; } } } } }
/// <summary> /// Add existing PUA characters to the table at load time. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); ReadDataFromUnicodeFiles(); ReadCustomCharData(); foreach (var spec in m_dictCustomChars.Values) { var lvi = new PuaListItem(spec); m_lvCharSpecs.Items.Add(lvi); } m_lvCharSpecs.ListViewItemSorter = new PuaListItemComparer(); m_fDirty = false; }
private void m_btnAdd_Click(object sender, EventArgs e) { using (var dlg = new CustomCharDlg()) { dlg.PUAChar = PUACharacter.UnicodeDefault; dlg.Modify = false; dlg.SetDialogProperties(this); dlg.ParentDialog = this; if (dlg.ShowDialog(this) == DialogResult.OK) { var lviNew = new PuaListItem(dlg.PUAChar); if (m_dictCustomChars.ContainsKey(lviNew.Code)) { m_dictCustomChars[lviNew.Code] = dlg.PUAChar; PuaListItem lviOld = null; foreach (var item in m_lvCharSpecs.Items) { var pli = item as PuaListItem; if (pli != null && pli.Code == lviNew.Code) { lviOld = item as PuaListItem; break; } } if (lviOld != null) { m_lvCharSpecs.Items.Remove(lviOld); } } else { m_dictCustomChars.Add(lviNew.Code, dlg.PUAChar); } m_lvCharSpecs.Items.Add(lviNew); m_fDirty = true; } } }
private void m_btnAdd_Click(object sender, EventArgs e) { using (var dlg = new CustomCharDlg()) { dlg.PUAChar = PUACharacter.UnicodeDefault; dlg.Modify = false; dlg.SetDialogProperties(this); dlg.ParentDialog = this; if (dlg.ShowDialog(this) == DialogResult.OK) { var lviNew = new PuaListItem(dlg.PUAChar); if (m_dictCustomChars.ContainsKey(lviNew.Code)) { m_dictCustomChars[lviNew.Code] = dlg.PUAChar; PuaListItem lviOld = null; foreach (var item in m_lvCharSpecs.Items) { var pli = item as PuaListItem; if (pli != null && pli.Code == lviNew.Code) { lviOld = item as PuaListItem; break; } } if (lviOld != null) m_lvCharSpecs.Items.Remove(lviOld); } else { m_dictCustomChars.Add(lviNew.Code, dlg.PUAChar); } m_lvCharSpecs.Items.Add(lviNew); m_fDirty = true; } } }