Example #1
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            frmSimTlv frm = new frmSimTlv(null, frmSimTlv.EFrmType.ADD);

            if (frm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            SimTlv objTlv = frm.Tlv;

            // If there's already a TLV with the tag, remove it.
            foreach (ListViewItem li in lvTlvs.Items)
            {
                SimTlv objInfo = (SimTlv)li.Tag;
                if (objInfo.Tag == objTlv.Tag)
                {
                    lvTlvs.Items.Remove(li);
                }
            }

            // Add the newly created TLV value to the listview
            ListViewItem item = new ListViewItem(new String[] {
                m_objConstants.SmppTlvToString(objTlv.Tag).Replace("SMPP_TLV_", ""),
                objTlv.TlvType.ToString(), objTlv.TypedValue
            });

            item.Tag = frm.Tlv;
            lvTlvs.Items.Insert(0, item);
        }
Example #2
0
        private void btEdit_Click(object sender, EventArgs e)
        {
            if (lvTlvs.SelectedItems.Count <= 0)
            {
                return;
            }

            SimTlv    objEditted = (SimTlv)lvTlvs.SelectedItems[0].Tag;
            frmSimTlv frm        = new frmSimTlv(objEditted, m_eFrmType == EFrmType.VIEW ? frmSimTlv.EFrmType.VIEW : frmSimTlv.EFrmType.EDIT);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                ListViewItem item = lvTlvs.SelectedItems[0];
                item.SubItems[1].Text = frm.Tlv.TlvType.ToString();
                item.SubItems[2].Text = frm.Tlv.TypedValue;
            }
        }