Пример #1
0
 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;
                 }
             }
         }
     }
 }
Пример #2
0
 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;
         }
     }
 }
Пример #3
0
		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;
						}
					}
				}
			}
		}
Пример #4
0
		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;
				}
			}
		}