//语音信箱转移 private void MailForward_Click(object sender, RoutedEventArgs e) { if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { Dialog.Show(StringHelper.FindLanguageResource("NoUCAccount"), StringHelper.FindLanguageResource("SettingUC")); return; } try { MakeCallBusiness call = new MakeCallBusiness(); STCallExData data = new STCallExData(); int iRet = 0; string buttonName = (sender as System.Windows.Controls.Button).Name; if (buttonName == "btnVoiceForwardUnCond") { //无条件转语音邮箱 if ((bool)this.radVoiceForwardUnCondEn.IsChecked) { //data.Num = this.txtVoiceForwardUnCond.Text.Trim(); data.Num = "1"; if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error")); string str = System.Windows.Forms.Application.StartupPath; lync.toolBar.BtnMail.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\sms_2.png"); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data); if (iRet == 0) { string str = System.Windows.Forms.Application.StartupPath; lync.toolBar.BtnMail.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\sms_3.png"); //2015/8/11 一旦设置了无条件前转,则其他前转全部设置为关闭 data.Num = string.Empty; call.SetCallExService((int)ForwardServiceType.VOICEMAIL_NOREPLY, data); call.SetCallExService((int)ForwardServiceType.VOICEMAIL_OFFLINE, data); call.SetCallExService((int)ForwardServiceType.VOICEMAIL_ONBUSY, data); } } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data); if (iRet == 0) { string str = System.Windows.Forms.Application.StartupPath; lync.toolBar.BtnMail.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\sms_2.png"); } } } else if (buttonName == "btnVoiceForwardNoReply") { //无应答转语音邮箱 this.lync.toolBar.GetMailFrwInfo(); if (lync.toolBar.isSetVoiceMailUnCond1 == true) //如果设置了无条件前转,则不能设置其他前转 { Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error")); return; } else { if ((bool)this.radVoiceForwardNoReplyEn.IsChecked) { //data.Num = this.txtVoiceForwardNoReply.Text.Trim(); data.Num = "1"; if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_NOREPLY, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_NOREPLY, data); } } } else if (buttonName == "btnVoiceForwardBusy") { //遇忙转语音邮箱 this.lync.toolBar.GetMailFrwInfo(); if (lync.toolBar.isSetVoiceMailUnCond1 == true) //如果设置了无条件前转,则不能设置其他前转 { Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error")); return; } else { if ((bool)this.radVoiceForwardBusyEn.IsChecked) { //data.Num = this.txtVoiceForwardBusy.Text.Trim(); data.Num = "1"; if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_ONBUSY, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_ONBUSY, data); } } } else if (buttonName == "btnVoiceForwardOffline") { //离线转语音邮箱 this.lync.toolBar.GetMailFrwInfo(); if (lync.toolBar.isSetVoiceMailUnCond1 == true) //如果设置了无条件前转,则不能设置其他前转 { Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error")); return; } else { if ((bool)this.radVoiceForwardOfflineEn.IsChecked) { //data.Num = this.txtVoiceForwardOffline.Text.Trim(); data.Num = "1"; if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_OFFLINE, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_OFFLINE, data); } } } else if (buttonName == "btnVoiceForwardDND") //DND不做了 2015/8/11 { //离线呼叫前转 if ((bool)this.radVoiceForwardDNDEn.IsChecked) { //data.Num = this.txtVoiceForwardDND.Text.Trim(); data.Num = "1"; if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data); } } if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("SetCallExService error"); //modify by jinyeqing Dialog.Show(StringHelper.FindLanguageResource("FWDMailFail"), StringHelper.FindLanguageResource("error")); } else { Dialog.Show(StringHelper.FindLanguageResource("FWDMailSuccess"), StringHelper.FindLanguageResource("Success")); } } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }
private void button_Click(object sender, RoutedEventArgs e) { Image img = ((sender as Button).Content as StackPanel).Children[0] as Image; if (img.Tag.ToString() == "call") { if (txtNumber.Text.ToString() == "") { return; } if (Lync.winCall != null) { this.Close(); Dialog.Show(StringHelper.FindLanguageResource("TwoCallsSameTime"), StringHelper.FindLanguageResource("error")); return; } //拨号 MakeCallBusiness call = new MakeCallBusiness(); StringBuilder ucName = new StringBuilder(100); call.GetUCAccount(txtNumber.Text.ToString(), ucName); string str = null; if (ucName.ToString() == "") { str = txtNumber.Text.ToString(); call.insertMember((int)MemberType.UC_IPPHONE, new StringBuilder(str)); } else { str = ucName + StringHelper.GetLyncDomainString(SingletonObj.LoginInfo.LyncName); call.insertMember((int)MemberType.UC_ACCOUNT, ucName); } if (call.startContextCall() == 0) //modify by 00327190 2015/6/18 只要返回值不为0,就不能执行以下操作 { this.Close(); WinCall winCall = new WinCall(Lync, SingletonObj.LoginInfo.LyncName + ";" + str.ToString()); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); Lync.winCall = winCall; } else { this.Close(); DialogShow.Show(StringHelper.FindLanguageResource("startContextCallFailed"), StringHelper.FindLanguageResource("error"), 2); return; } } else if (img.Tag.ToString() == "back") { if (txtNumber.Text.Length > 0) { txtNumber.Text = txtNumber.Text.Substring(0, txtNumber.Text.Length - 1); } } else { txtNumber.Text = txtNumber.Text + img.Tag.ToString(); txtNumber.Focus(); txtNumber.Select(txtNumber.Text.Length, 0); } }
private void CallForward_Click(object sender, RoutedEventArgs e) { if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { Dialog.Show(StringHelper.FindLanguageResource("NoUCAccount"), StringHelper.FindLanguageResource("SettingUC")); return; } try { MakeCallBusiness call = new MakeCallBusiness(); STCallExData data = new STCallExData(); int iRet = 0; string buttonName = (sender as System.Windows.Controls.Button).Name; if (buttonName == "btnCallForwardUnCond") { //无条件呼叫前传 if ((bool)this.radCallForwardUnCondEn.IsChecked) { data.Num = this.txtCallForwardUnCond.Text.Trim(); if (IsValidPhoneNumber(data.Num) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } else if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error")); string str = System.Windows.Forms.Application.StartupPath; lync.toolBar.BtnFWD.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\MobilePhone_2.png"); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data); if (iRet == 0) { string str = System.Windows.Forms.Application.StartupPath; lync.toolBar.BtnFWD.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\MobilePhone_3.png"); //2015/8/11 一旦设置了无条件前转,则其他前转全部设置为关闭 data.Num = string.Empty; call.SetCallExService((int)ForwardServiceType.FORWARD_NOREPLY, data); call.SetCallExService((int)ForwardServiceType.FORWARD_OFFLINE, data); call.SetCallExService((int)ForwardServiceType.FORWARD_ONBUSY, data); } } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data); if (iRet == 0) { string str = System.Windows.Forms.Application.StartupPath; lync.toolBar.BtnFWD.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\MobilePhone_2.png"); } } } else if (buttonName == "btnCallForwardNoReply") { //不回复呼叫前转 this.lync.toolBar.GetFWDInfo(); if (lync.toolBar.isSetFWDUnCond1 == true) //如果设置了无条件前转,则不能设置其他前转 { Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error")); return; } else { if ((bool)this.radCallForwardNoReplyEn.IsChecked) { data.Num = this.txtCallForwardNoReply.Text.Trim(); if (IsValidPhoneNumber(data.Num) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } else if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_NOREPLY, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_NOREPLY, data); } } } else if (buttonName == "btnCallForwardBusy") { //遇忙呼叫前转 this.lync.toolBar.GetFWDInfo(); if (lync.toolBar.isSetFWDUnCond1 == true) //如果设置了无条件前转,则不能设置其他前转 { Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error")); return; } else { if ((bool)this.radCallForwardBusyEn.IsChecked) { data.Num = this.txtCallForwardBusy.Text.Trim(); if (IsValidPhoneNumber(data.Num) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } else if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_ONBUSY, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_ONBUSY, data); } } } else if (buttonName == "btnCallForwardOffline") { //离线呼叫前转 this.lync.toolBar.GetFWDInfo(); if (lync.toolBar.isSetFWDUnCond1 == true) //如果设置了无条件前转,则不能设置其他前转 { Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error")); return; } else { if ((bool)this.radCallForwardOfflineEn.IsChecked) { data.Num = this.txtCallForwardOffline.Text.Trim(); if (IsValidPhoneNumber(data.Num) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } else if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_OFFLINE, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_OFFLINE, data); } } } else if (buttonName == "btnCallForwardDND") //DND取消了 2015/8/11 { //离线呼叫前转 if ((bool)this.radCallForwardDNDEn.IsChecked) { data.Num = this.txtCallForwardDND.Text.Trim(); if (IsValidPhoneNumber(data.Num) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } else if (string.IsNullOrEmpty(data.Num)) { Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error")); return; } else { iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data); } } else { data.Num = string.Empty; iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data); } } if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("SetCallExService error"); Dialog.Show(StringHelper.FindLanguageResource("FWDFailed"), StringHelper.FindLanguageResource("error")); } else { Dialog.Show(StringHelper.FindLanguageResource("FWDSuccess"), StringHelper.FindLanguageResource("Success")); } } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }