private void PopulateDataFields(SIPAccount sipAccount)
{
m_outDialPlan.Visibility = Visibility.Collapsed;
m_inDialPlan.Visibility = Visibility.Collapsed;
m_domainNames.Visibility = Visibility.Collapsed;
m_sipAccountUsername.Visibility = Visibility.Collapsed;
if (sipAccount.IsAdminDisabled)
{
WriteStatusMessage(MessageLevelsEnum.Warn, "SIP Account has been disabled by administrator. " + sipAccount.AdminDisabledReason);
m_sipAccountPassword.IsEnabled = false;
m_keepAlivesCheckBox.IsEnabled = false;
m_statusAdminDisabledRadio.IsEnabled = true;
m_statusAdminDisabledRadio.IsChecked = true;
m_statusAdminDisabledRadio.IsEnabled = false;
m_statusStandardRadio.IsEnabled = false;
m_statusIncomingOnlyRadio.IsEnabled = false;
m_statusDisabledRadio.IsEnabled = false;
m_outDialPlan.IsEnabled = false;
m_inDialPlan.IsEnabled = false;
m_sipAccountUpdateButton.IsEnabled = false;
m_sipAccountOutDialPlanStatus.Text = (m_sipAccount.OutDialPlanName != null) ? m_sipAccount.OutDialPlanName : "-";
m_sipAccountInDialPlanStatus.Text = (m_sipAccount.InDialPlanName != null) ? m_sipAccount.InDialPlanName : "-";
m_sipAccountNetworkId.IsEnabled = false;
m_sipAccountIPAddressACL.IsEnabled = false;
m_isSwitchboardEnabledCheckBox.IsEnabled = false;
}
else
{
if (sipAccount.Owner == m_owner)
{
//ThreadPool.QueueUserWorkItem(new WaitCallback(SetDialPlanNames), null);
SetDialPlanNames(null);
}
else
{
// Don't have a list of dial plan names for non-owned SIP accounts so just display the dial plan names.
m_sipAccountOutDialPlanStatus.Text = (m_sipAccount.OutDialPlanName != null) ? m_sipAccount.OutDialPlanName : "-";
m_sipAccountInDialPlanStatus.Text = (m_sipAccount.InDialPlanName != null) ? m_sipAccount.InDialPlanName : "-";
}
if (sipAccount.IsDisabled)
{
m_statusDisabledRadio.IsChecked = true;
}
else if (sipAccount.IsIncomingOnly)
{
m_statusIncomingOnlyRadio.IsChecked = true;
}
}
m_sipAccountId.Text = sipAccount.ID;
m_sipAccountOwner.Text = sipAccount.Owner;
m_sipAccountUsernameText.Text = sipAccount.SIPUsername;
m_sipAccountPassword.Text = sipAccount.SIPPassword;
m_sipAccountDomain.Text = sipAccount.SIPDomain;
m_keepAlivesCheckBox.IsChecked = sipAccount.SendNATKeepAlives;
m_sipAccountNetworkId.Text = (sipAccount.NetworkID != null) ? sipAccount.NetworkID : String.Empty;
m_sipAccountIPAddressACL.Text = (sipAccount.IPAddressACL != null) ? sipAccount.IPAddressACL : String.Empty;
m_isSwitchboardEnabledCheckBox.IsChecked = sipAccount.IsSwitchboardEnabled;
}