Exemplo n.º 1
0
        private void UpdateNomadicStatus(NomadicStatus nomadicStatus)
        {
            // We can update this compoent only if we are in the from thread
            if (cbNomadic.InvokeRequired)
            {
                NomadicStatusArgReturningVoidDelegate d = new NomadicStatusArgReturningVoidDelegate(UpdateNomadicStatus);
                this.Invoke(d, new object[] { nomadicStatus });
            }
            else
            {
                Boolean available = false;
                Boolean activated = false;
                Boolean makeCallInitiatorIsMain = false;
                Boolean computerMode            = false;
                Boolean computerModeAvailable   = false;
                String  phoneNumber             = "";

                if (nomadicStatus != null)
                {
                    available = nomadicStatus.Available;
                    activated = nomadicStatus.Activated;
                    makeCallInitiatorIsMain = nomadicStatus.MakeCallInitiatorIsMain;
                    computerMode            = nomadicStatus.ComputerMode;
                    phoneNumber             = nomadicStatus.PhoneNumber;

                    // Check if computer mode is available
                    computerModeAvailable       = rainbowTelephony.NomadicOnComputerAvailable();
                    rbNomadicToComputer.Enabled = computerModeAvailable;
                }

                // Does nomadic service is available ?
                cbNomadic.Checked = available;
                gbNomadic.Enabled = available;

                if (available)
                {
                    // Can we use computer mode ?
                    rbNomadicToComputer.Enabled = computerModeAvailable;

                    if (computerMode)
                    {
                        rbNomadicToComputer.Checked = true;
                    }
                    else if (makeCallInitiatorIsMain)
                    {
                        rbNomadicToOfficePhone.Checked = true;
                    }
                    else if (!String.IsNullOrEmpty(phoneNumber))
                    {
                        rbNomadicToPhoneNumber.Checked = true;
                    }

                    tbNomadicPhoneNumber.Text = phoneNumber;
                }
                else
                {
                    rbNomadicToComputer.Enabled = true;
                }
            }
        }