本文整理汇总了C#中BrightPlatformEntities.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# BrightPlatformEntities.Dispose方法的具体用法?C# BrightPlatformEntities.Dispose怎么用?C# BrightPlatformEntities.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrightPlatformEntities
的用法示例。
在下文中一共展示了BrightPlatformEntities.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeSoftPhone
/// <summary>
///It initializes a softphone object with a SIP BPX, and it is for requisiting a SIP account that is nedded for a SIP PBX service. It registers this SIP
///account to the SIP PBX through an ’IphoneLine’ object which represents the telephoneline.
///If the telephone registration is successful we have a call ready softphone. In this example the softphone can be reached by dialing the number 891.
/// </summary>
private void InitializeSoftPhone()
{
try
{
if (Ozeki.VoIP.SDK.Protection.LicenseManager.Instance.LicenseType != Ozeki.VoIP.SDK.Protection.LicenseType.Activated)
Ozeki.VoIP.SDK.Protection.LicenseManager.Instance.SetLicense(m_OzekiLicenseId, m_OzekiLicenseKey);
using (BrightPlatformEntities objDbModel = new BrightPlatformEntities(UserSession.EntityConnection)) {
int? _SipAcctId = objDbModel.users.FirstOrDefault(i => i.id == UserSession.CurrentUser.UserId).sip_id;
if (!_SipAcctId.HasValue) {
//MessageBox.Show(
// string.Format("Your account is not yet configured for calling.{0}Please contact your administrator.", Environment.NewLine),
// "Bright Sales",
// MessageBoxButtons.OK,
// MessageBoxIcon.Information
//);
BrightVision.Common.UI.NotificationDialog.Error(
"Bright Sales",
string.Format("Your account is not yet configured for calling.{0}Please contact your administrator.", Environment.NewLine)
);
return;
}
sip_accounts sip = objDbModel.sip_accounts.FirstOrDefault(i => i.id == _SipAcctId);
if (sip != null)
objDbModel.Detach(sip);
if (m_UserAudioSetting == null)
m_UserAudioSetting = AudioSettingUtility.GetUserAudioSetting();
m_UserMicrophone = AudioSettingUtility.GetDefaultDeviceMicrophone();
m_UserSpeaker = AudioSettingUtility.GetDefaultDeviceSpeaker();
m_UserMicrophone.Volume = (float)m_UserAudioSetting.mic_volume / 10;
m_UserSpeaker.Volume = (float)m_UserAudioSetting.speaker_volume / 10;
try {
softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750, 5780);
}
catch {
}
this.DisableUnwantedCodec();
softPhone.IncomingCall -= new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall);
softPhone.IncomingCall += new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall);
SIPAccount acc = new SIPAccount(
true,
sip.display_name.Trim(),
sip.username.Trim(),
sip.username.Trim(),
sip.password,
sip.sip_url.Trim(),
5060,
""
);
// var acc = new SIPAccount(true, sip.display_name, sip.username, sip.username, sip.password, sip.sip_url, 5060,"");
// NatConfiguration newNatConfiguration = new NatConfiguration(NatTraversalMethod.Auto, new NatRemoteServer("stun.ozekiphone.com", "", ""));
phoneLine = softPhone.CreatePhoneLine(acc, Ozeki.Network.TransportType.Udp, SRTPMode.None);
phoneLine.PhoneLineStateChanged -= new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation);
phoneLine.PhoneLineStateChanged += new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation);
softPhone.RegisterPhoneLine(phoneLine);
objDbModel.Dispose();
}
}
catch (Exception ex) {
}
}