Beispiel #1
0
        private bool addPrivateContact(string id, string callsignAndName)
        {
            int minIndex = ContactForm.data.GetMinIndex();

            if (minIndex < 0)
            {
                return(false);
            }
            ContactForm.data.SetIndex(minIndex, 1);                              // Not sure what this does
            ContactForm.ContactOne value = new ContactForm.ContactOne(minIndex); // get next available index
            value.Name                 = callsignAndName;
            value.CallId               = string.Format("{0:d8}", int.Parse(id));
            value.CallTypeS            = ContactForm.SZ_CALL_TYPE[1];    // Private call
            value.RingStyleS           = ContactForm.DefaultContact.RingStyleS;
            value.CallRxToneS          = ContactForm.SZ_CALL_RX_TONE[0]; // Call tone off
            ContactForm.data[minIndex] = value;

            int[] array = new int[3] {
                8, 10, 7
            };                                            // Note array index 1 appears to be Private call in terms of the tree view
            if (parentForm != null)
            {
                mainForm.InsertTreeViewNode(parentForm.Node, minIndex, typeof(ContactForm), array[1], ContactForm.data);
            }
            else
            {
                mainForm.InsertTreeViewNode(treeNode, minIndex, typeof(ContactForm), array[1], ContactForm.data);
            }

            return(true);
        }
Beispiel #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int      selectedIndex = this.cmbAddType.SelectedIndex;
            int      minIndex      = ContactForm.data.GetMinIndex();
            MainForm mainForm      = base.MdiParent as MainForm;
            string   minCallID     = ContactForm.data.GetMinCallID(selectedIndex, minIndex);
            string   minName       = ContactForm.data.GetMinName(this.Node);
            string   callRxToneS   = ContactForm.DefaultContact.CallRxToneS;
            string   ringStyleS    = ContactForm.DefaultContact.RingStyleS;
            string   text          = this.cmbAddType.Text;

            ContactForm.data.SetIndex(minIndex, 1);
            ContactForm.ContactOne value = new ContactForm.ContactOne(minIndex);
            value.Name                 = minName;
            value.CallId               = minCallID;
            value.CallTypeS            = text;
            value.RingStyleS           = ringStyleS;
            value.CallRxToneS          = callRxToneS;
            ContactForm.data[minIndex] = value;
            this.dgvContacts.Rows.Insert(minIndex, (minIndex + 1).ToString(), minName, minCallID, text, ringStyleS, callRxToneS);
            this.dgvContacts.Rows[minIndex].Tag = minIndex;
            this.method_1();
            int[] array = new int[3]
            {
                8,
                10,
                7
            };
            mainForm.InsertTreeViewNode(this.Node, minIndex, typeof(ContactForm), array[selectedIndex], ContactForm.data);
            mainForm.RefreshRelatedForm(base.GetType());
        }
        public void RefreshSingleRow(int index)
        {
            ContactForm.ContactOne contactOne = ContactForm.data[index];
            int index2 = 0;

            foreach (DataGridViewRow item in (IEnumerable)this.dgvContacts.Rows)
            {
                if (Convert.ToInt32(item.Tag) != index)
                {
                    continue;
                }
                index2 = item.Index;
                break;
            }
            this.dgvContacts.Rows[index2].Cells[1].Value = contactOne.Name;
            this.dgvContacts.Rows[index2].Cells[2].Value = contactOne.CallId;
            this.dgvContacts.Rows[index2].Cells[3].Value = contactOne.CallTypeS;
            this.dgvContacts.Rows[index2].Cells[4].Value = contactOne.RingStyleS;
            this.dgvContacts.Rows[index2].Cells[5].Value = contactOne.CallRxToneS;
        }