示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                accessCode = this.txtAccessCode.Text.Trim();

                string number = this.textPhoneNumber.Text.Trim();

                if (string.IsNullOrEmpty(number))
                {
                    this.textPhoneNumber.Focus();
                    MsgBox.Info("Please input phone number.");

                    return;
                }

                DialContent    dialContent = new DialContent();
                DeviceType     phoneType   = DeviceType.Phone;
                DeviceCallType callType    = DeviceCallType.ConventionCall;

                if (this.ShowCallType)
                {
                    var intCallType = this.cboCallType.SelectedIndex;

                    if (intCallType == 0)
                    {
                        phoneType = DeviceType.Phone;
                    }
                    else if (intCallType == 1 || intCallType == 2)
                    {
                        if (intCallType == 1)
                        {
                            callType = DeviceCallType.GroupCall;
                        }
                        else
                        {
                            callType = DeviceCallType.SecretCall;
                        }

                        var wirelessType = this.cboWirelessType.SelectedIndex;

                        if (wirelessType == 0)
                        {
                            phoneType = DeviceType.SW;
                        }
                        else if (wirelessType == 1)
                        {
                            phoneType = DeviceType.WLDigitalDevice;
                        }
                        else if (wirelessType == 2)
                        {
                            phoneType = DeviceType.WLSimulateDevice;
                        }
                        else if (wirelessType == 3)
                        {
                            phoneType = DeviceType.LTE;
                        }
                        else
                        {
                            MsgBox.Info("Please select wireless type.");
                            this.cboWirelessType.Focus();

                            return;
                        }
                    }
                    else
                    {
                        MsgBox.Info("Please select call type.");
                        this.cboCallType.Focus();

                        return;
                    }
                }

                var mediaAblty = MediaAbility.Default;

                if (cmbMediaAbility.Enabled)
                {
                    if (cmbMediaAbility.SelectedIndex == 0)
                    {
                        mediaAblty = MediaAbility.Audio;
                    }
                    else if (cmbMediaAbility.SelectedIndex == 1)
                    {
                        mediaAblty = MediaAbility.Video;
                    }
                }

                dialContent.PhoneNumber  = number;
                dialContent.PhoneType    = phoneType;
                dialContent.CallType     = callType;
                dialContent.MediaAbility = mediaAblty;
                dialContent.AccessCode   = accessCode;
                if (IsDisconnectCall)
                {
                    dialContent.CallId = number;
                }

                this.DialContent = dialContent;

                this.DialogResult = DialogResult.OK;
            }
            catch
            {
                MsgBox.Error("occur exception");
            }
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string number = this.textPhoneNumber.Text.Trim();

                if (string.IsNullOrEmpty(number))
                {
                    this.textPhoneNumber.Focus();
                    MsgBox.Info("Please input phone number.");

                    return;
                }
                foreach (DialContent dial in dialContents)
                {
                    if (dial.PhoneNumber == number)
                    {
                        return;
                    }
                }
                DialContent    dialContent = new DialContent();
                DeviceType     phoneType   = DeviceType.Phone;
                DeviceCallType callType    = DeviceCallType.ConventionCall;


                var intCallType = this.cboCallType.SelectedIndex;

                if (intCallType == 0)
                {
                    phoneType = DeviceType.Phone;
                }
                else if (intCallType == 1 || intCallType == 2)
                {
                    if (intCallType == 1)
                    {
                        callType = DeviceCallType.GroupCall;
                    }
                    else
                    {
                        callType = DeviceCallType.SecretCall;
                    }

                    var wirelessType = this.cboWirelessType.SelectedIndex;

                    if (wirelessType == 0)
                    {
                        phoneType = DeviceType.SW;
                    }
                    else if (wirelessType == 1)
                    {
                        phoneType = DeviceType.WLDigitalDevice;
                    }
                    else if (wirelessType == 2)
                    {
                        phoneType = DeviceType.WLSimulateDevice;
                    }
                    else if (wirelessType == 3)
                    {
                        phoneType = DeviceType.LTE;
                    }
                    else
                    {
                        MsgBox.Info("Please select wireless type.");
                        this.cboWirelessType.Focus();

                        return;
                    }
                }
                else
                {
                    MsgBox.Info("Please select call type.");
                    this.cboCallType.Focus();

                    return;
                }
                var mediaAblty = MediaAbility.Default;

                if (cmbMediaAbility.Enabled)
                {
                    if (cmbMediaAbility.SelectedIndex == 0)
                    {
                        mediaAblty = MediaAbility.Video;
                    }
                    else if (cmbMediaAbility.SelectedIndex == 1)
                    {
                        mediaAblty = MediaAbility.Video;
                    }
                }

                dialContent.PhoneNumber  = number;
                dialContent.PhoneType    = phoneType;
                dialContent.CallType     = callType;
                dialContent.MediaAbility = mediaAblty;
                dialContents.Add(dialContent);
                listBoxCall.Items.Add(dialContent.PhoneNumber);
            }
            catch
            {
                MsgBox.Error("occur exception");
            }
        }