public void AddContactWinSize(List <UCContact> contactList) { try { // Dispatcher.Invoke(new Action(() => //{ this.isAddContract = true; //modify by 00327190 使winlync界面635行异步设置btnVideo 状态 不执行 string a = StringHelper.GetSubString(contactList[0].UserName); Title = a + StringHelper.FindLanguageResource("TempGroup"); //2015/8/3 适配葡语 //Title = contactList[0].UserName + StringHelper.FindLanguageResource("TempGroup"); listContact.ContextMenu = contactList[0].UserName == SingletonObj.LoginInfo.LyncName ? listMenu : null; btnVideo.IsEnabled = false; btnCallSuspend.IsEnabled = false; btnBlindTransCall.IsEnabled = false; if (contactList.Count > maxMum) { Height = winOrightHeight + singleItemHeight * maxMum; rowContact.Height = new System.Windows.GridLength(Height - win7OHeight); listContact.ScrollIntoView(listContact.Items[0]); } else { Height = winOrightHeight + singleItemHeight * contactList.Count; rowContact.Height = new System.Windows.GridLength(Height - win7OHeight); } UpdateLayout(); this.isreturn = true; //modify by 00327190 由于之前改通话时将此按钮设为可用导致会议时也为可用状态,所以这边要重新设为不可用 // Dispatcher.Invoke(new Action(() //=> // { // winCall.btnVideo.IsEnabled = false; // winCall.btnBlindTransCall.IsEnabled = false; // })); //})); } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }
public void ShowDialog1(string message, string title, int second) { // 获得时间限制 this.second = second; // 初始化计数器 this.counter = 0; // 初始化按钮的文本 var a = StringHelper.FindLanguageResource("OK"); this.button1.Content = string.Format("{0}({1})", a, this.second - this.counter); // 激活并启动timer,设置timer的触发间隔为1000毫秒(1秒) this.timer1 = new Timer(); this.timer1.Enabled = true; this.timer1.Interval = 1000; this.timer1.Tick += new EventHandler(timer1_Tick); this.timer1.Start(); labContext.Content = message; this.Title = title == null ? "" : title; this.button1.Content = string.Format("{0}({1})", a, this.second - this.counter); this.ShowDialog(); }
public WinDail(WinLync Lync) { InitializeComponent(); this.Lync = Lync; this.Closed += new EventHandler(WinDail_Closed); WinLync.lyncCounter++; imgNum1.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum1.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum2.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum2.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum3.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum3.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum4.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum4.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum5.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum5.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum6.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum6.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum7.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum7.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum8.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum8.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum9.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum9.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNum0.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNum0.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNumS.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNumS.MouseLeave += new MouseEventHandler(img_MouseLeave); imgNumX.MouseEnter += new MouseEventHandler(img_MouseEnter); imgNumX.MouseLeave += new MouseEventHandler(img_MouseLeave); imgCall.MouseEnter += new MouseEventHandler(img_MouseEnter); imgCall.MouseLeave += new MouseEventHandler(img_MouseLeave); imgBack.MouseEnter += new MouseEventHandler(img_MouseEnter); imgBack.MouseLeave += new MouseEventHandler(img_MouseLeave); this.Title = StringHelper.FindLanguageResource("Keypad"); this.txtNumber.Focus(); }
private void timer1_Tick(object sender, EventArgs e) { // 如果没有到达指定的时间限制 if (this.counter <= this.second) { // 刷新按钮的文本 var a = StringHelper.FindLanguageResource("OK"); this.button1.Content = string.Format("{0}({1})", a, this.second - this.counter); // this.r(); // 计数器自增 this.counter++; } // 如果到达时间限制 else { // 关闭timer this.timer1.Enabled = false; this.timer1.Stop(); // 关闭对话框 this.Close(); } }
private void FinishCommandProcess() { //2015/7/27 为空和数字校验 if ("" == winCallReceive.txtOtherPhone.Text.Trim()) { DialogShow.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error"), 2); return; } if (IsValidPhoneNumber(winCallReceive.txtOtherPhone.Text) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } if (winCallReceive.UcPhoneNo == winCallReceive.txtOtherPhone.Text || winCallReceive.UcPhoneNo1 == winCallReceive.txtOtherPhone.Text) { DialogShow.Show(StringHelper.FindLanguageResource("Cannottansfer"), StringHelper.FindLanguageResource("error"), 2); return; } MakeCallBusiness bus = new MakeCallBusiness(); bus.ForwardCall((int)MemberType.UC_IPPHONE, winCallReceive.txtOtherPhone.Text.ToString()); winCallReceive.Close(); }
void BtnIP_Click(object sender, EventArgs e) { //通话时不能更改话机联动状态 //You can't change joint type in a call if (Lync.winCall != null) { DialogShow.Show(StringHelper.FindLanguageResource("Cannotdothisincall"), StringHelper.FindLanguageResource("error"), 2); return; } else if (Lync.isHave == true) //通话未接通时也不许更改话机联动状态 { DialogShow.Show(StringHelper.FindLanguageResource("Cannotdothisincall"), StringHelper.FindLanguageResource("error"), 2); return; } else { UCServiceRetvCode iRet = (UCServiceRetvCode)log.SetPhoneJointDevType((int)PhoneJointType.IPPhone_Device); if (iRet != UCServiceRetvCode.UC_SDK_Success) { Dialog.Show(StringHelper.FindLanguageResource("ConfigPhoneJointDevFail"), StringHelper.FindLanguageResource("error")); } } }
private void txtPage_TextChanged(object sender, TextChangedEventArgs e) { var textBox = sender as TextBox; int total = Convert.ToInt32(labTotal.Content.ToString().Substring(labTotal.Content.ToString().IndexOf('/') + 1)); string str = textBox.Text.Trim(); if (str == "") { textBox.Text = "1"; } if (this.IsValidPhoneNumber(str) == false) { DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); textBox.Text = "1"; return; } //2015/7/29 TextChange[] change = new TextChange[e.Changes.Count]; e.Changes.CopyTo(change, 0); int offset = change[0].Offset; if (change[0].AddedLength > 0) { double num = 0; if (!Double.TryParse(textBox.Text, out num)) { textBox.Text = textBox.Text.Remove(offset, change[0].AddedLength); textBox.Select(offset, 0); } } if (Convert.ToInt32(textBox.Text.Trim().Replace(" ", "")) > total) { textBox.Text = total.ToString(); } //2015/7/29 }
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); } }
/// <summary> /// 设置呼叫前传 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void BtnFWD_Click(object sender, EventArgs e) { try { //通话时不能更改话机联动状态 //You can't change joint type in a call if (Lync.winCall != null) { DialogShow.Show(StringHelper.FindLanguageResource("CannotchangeFWDincall"), StringHelper.FindLanguageResource("error"), 2); return; } else { GetFWDInfo(); UserConfigBusiness conf = new UserConfigBusiness(); STContact con = new STContact(); int iRet = conf.GetContactInfo(new StringBuilder(SingletonObj.LoginInfo.UserID), ref con); if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("GetContactInfo error"); return; } STCallExData data = new STCallExData(); if (!isSetFWDUnCond) { if (string.IsNullOrEmpty(con.mobile_)) { LogManager.SystemLog.Warn("user mobile is null"); Dialog.Show(StringHelper.FindLanguageResource("NoMoblePhone"), StringHelper.FindLanguageResource("error")); return; } data.Num = con.mobile_; LogManager.SystemLog.Info(string.Format("user mobile is {0}", data.Num)); iRet = call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data); if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("SetCallExService error"); return; } //查询设置结果 GetFWDInfo(); if (isSetFWDUnCond) { Dialog.Show(StringHelper.FindLanguageResource("FWDSuccess"), StringHelper.FindLanguageResource("Success")); } else { Dialog.Show(StringHelper.FindLanguageResource("FWDFailed"), StringHelper.FindLanguageResource("error")); } } else { iRet = call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data); if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("SetCallExService error"); return; } //查询设置结果 GetFWDInfo(); if (!isSetFWDUnCond) { Dialog.Show(StringHelper.FindLanguageResource("CancelFWDSuccess"), StringHelper.FindLanguageResource("Success")); } else { Dialog.Show(StringHelper.FindLanguageResource("CancelFWDFailed"), StringHelper.FindLanguageResource("error")); } } } } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }
/// <summary> /// 语音邮箱呼叫前传 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void BtnMail_Click(object sender, EventArgs e) { //语音邮箱 //通话时不能更改话机联动状态 //You can't change joint type in a call if (Lync.winCall != null) { DialogShow.Show(StringHelper.FindLanguageResource("Cannotchangemailincall"), StringHelper.FindLanguageResource("error"), 2); return; } else { GetMailFrwInfo(); //7/30 先查询语音邮箱配置 UserConfigBusiness conf = new UserConfigBusiness(); STContact con = new STContact(); int iRet = conf.GetContactInfo(new StringBuilder(SingletonObj.LoginInfo.UserID), ref con); if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("GetContactInfo error"); return; } //7/30 STCallExData data = new STCallExData(); //int iRet = 0; if (!isSetVoiceMailUnCond) { //if (string.IsNullOrEmpty(con.email_)) //{ // LogManager.SystemLog.Warn("email_ is null"); // Dialog.Show(StringHelper.FindLanguageResource("NoVoicemail"), StringHelper.FindLanguageResource("error")); // return; //} //data.Num = con.email_; //2015/8/13 data.Num = "1"; LogManager.SystemLog.Info(string.Format("email_ is {0}", data.Num)); iRet = call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data); if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("SetCallExService error"); isSetVoiceMailUnCond = false; Dialog.Show(StringHelper.FindLanguageResource("FWDMailFail"), StringHelper.FindLanguageResource("error")); return; } else { GetMailFrwInfo(); if (isSetVoiceMailUnCond == true) { Dialog.Show(StringHelper.FindLanguageResource("FWDMailSuccess"), StringHelper.FindLanguageResource("Success")); } else { Dialog.Show(StringHelper.FindLanguageResource("FWDMailFail"), StringHelper.FindLanguageResource("error")); } } } else { iRet = call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data); if (iRet != (int)UCServiceRetvCode.UC_SDK_Success) { LogManager.SystemLog.Error("SetCallExService error"); isSetVoiceMailUnCond = true; Dialog.Show(StringHelper.FindLanguageResource("CancelFWDMailFail"), StringHelper.FindLanguageResource("error")); return; } else { GetMailFrwInfo(); if (!isSetVoiceMailUnCond) { Dialog.Show(StringHelper.FindLanguageResource("CancelFWDMailSuccess"), StringHelper.FindLanguageResource("Success")); } else { Dialog.Show(StringHelper.FindLanguageResource("CancelFWDMailFail"), StringHelper.FindLanguageResource("error")); } } } } }
void PhoneJointEventCBMethod(ref PJStatusParam _pj) { LogManager.SystemLog.Debug(Enum.GetName(typeof(EM_PhoneJointStatusType), _pj.PJ_Status)); string user = _pj.ucCalleeAcc; EM_PhoneJointStatusType stateType = (EM_PhoneJointStatusType)_pj.PJ_Status; if (stateType == EM_PhoneJointStatusType.STATUS_START_SUCC && type != PhoneJointType.IPPhone_Device) { string str = System.Windows.Forms.Application.StartupPath; BtnPC.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PC_2.png"); BtnIP.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PHONE_3.png"); type = PhoneJointType.IPPhone_Device; if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { return; } System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Dialog.Show(StringHelper.FindLanguageResource("StatusStartSucess"), StringHelper.FindLanguageResource("Success")); })); } else if (stateType == EM_PhoneJointStatusType.STATUS_STOP_SUCC && type != PhoneJointType.PC_Device) { type = PhoneJointType.PC_Device; string str = System.Windows.Forms.Application.StartupPath; BtnPC.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PC_3.png"); BtnIP.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PHONE_2.png"); if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { return; } System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Dialog.Show(StringHelper.FindLanguageResource("StatusStopSucess"), StringHelper.FindLanguageResource("Success")); })); } else if (stateType == EM_PhoneJointStatusType.STATUS_START_FAILED && type != PhoneJointType.IPPhone_Device) //2015/8/6 && 后面是新加的 { //modify by 00327190 2015/7/13 设置话机联动失败时也应该将图片置为相应的状态 string str = System.Windows.Forms.Application.StartupPath; BtnPC.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PC_3.png"); BtnIP.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PHONE_2.png"); if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { return; } System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Dialog.Show(StringHelper.FindLanguageResource("StatusStartFailed"), StringHelper.FindLanguageResource("error")); })); } else if (stateType == EM_PhoneJointStatusType.STATUS_STOP_FAILED && type != PhoneJointType.PC_Device) //2015/8/6 && 后面是新加的 { if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { return; } System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Dialog.Show(StringHelper.FindLanguageResource("StatusStopFailed"), StringHelper.FindLanguageResource("error")); })); } //modify by 00327190 2015/7/30 话机注销上报消息 else if (stateType == EM_PhoneJointStatusType.STATUS_OFFLINE) { type = PhoneJointType.PC_Device; string str = System.Windows.Forms.Application.StartupPath; BtnPC.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PC_3.png"); BtnIP.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PHONE_2.png"); if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { return; } System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Dialog.Show(StringHelper.FindLanguageResource("StatusOffline"), StringHelper.FindLanguageResource("StatusOffline")); })); } //modify by 00327190 2015/7/30 话机上线上报消息 else if (stateType == EM_PhoneJointStatusType.STATUS_ONLINE && type == PhoneJointType.IPPhone_Device) //9/17 { type = PhoneJointType.PC_Device; string str = System.Windows.Forms.Application.StartupPath; BtnPC.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PC_2.png"); BtnIP.Image = Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\PHONE_3.png"); if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { return; } System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Dialog.Show(StringHelper.FindLanguageResource("Statusonline"), StringHelper.FindLanguageResource("Statusonline")); })); } }
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()); } }
private void ApplyCommandProcess() { try { UCUserInfo user = new UCUserInfo(); user.Camera = winOptionSetting.comCamera.SelectedIndex.ToString(); user.Lang = winOptionSetting.comLang.SelectedIndex.ToString(); user.MicPhone = winOptionSetting.comMicrophone.SelectedIndex.ToString(); user.Password = winOptionSetting.txtPassword.Password.ToString(); user.Port = winOptionSetting.txtPort.Text.ToString(); user.Server = winOptionSetting.txtServer1.Text.ToString(); user.Speaker = winOptionSetting.comSpeaker.SelectedIndex.ToString(); user.UserID = winOptionSetting.txtAccount.Text.ToString(); user.AutoStart = winOptionSetting.chkStart.IsChecked == true ? "1" : "0"; user.Available = (bool)winOptionSetting.chkAvailable.IsChecked; user.Unavailable = (bool)winOptionSetting.chkUnavailable.IsChecked; user.Busy = (bool)winOptionSetting.chkBusy.IsChecked; user.Voicemail = (bool)winOptionSetting.chkVoicemail.IsChecked; user.AvailableCallNumber = winOptionSetting.txtAvailable.Text; user.UnavailableCallNumber = winOptionSetting.txtUnavailable.Text; user.BusyCallNumber = winOptionSetting.txtBusy.Text; user.VoicemailCallNumber = winOptionSetting.txtVoicemail.Text; user.SetFWDService = FrmToolBar.isSetFWDUnCond ? "1" : "0"; XmlHelper.SetUserConfig(user); UserConfigBusiness conf = new UserConfigBusiness(); conf.SetCurrentMicDev(winOptionSetting.comMicrophone.SelectedIndex); conf.SetCurrentVideoDev(winOptionSetting.comCamera.SelectedIndex); conf.SetCurrentSpeakerDev(winOptionSetting.comSpeaker.SelectedIndex); //modify by jinyeqing 2015/6/1 登陆时某些值为空要设置提示 (要求提示语言国际化) if (winOptionSetting.txtPort.Text.ToString() == "" || winOptionSetting.txtPort.Text.ToString() == null) { Dialog.Show(StringHelper.FindLanguageResource("Portcannotbenull"), StringHelper.FindLanguageResource("error")); return; } if (winOptionSetting.txtPassword.Password.ToString() == "" || winOptionSetting.txtPassword.Password.ToString() == null) { Dialog.Show(StringHelper.FindLanguageResource("Passwordcannotbenull"), StringHelper.FindLanguageResource("error")); return; } if (winOptionSetting.txtAccount.Text.ToString() == "" || winOptionSetting.txtAccount.Text.ToString() == null) { Dialog.Show(StringHelper.FindLanguageResource("UserIDcannotbenull"), StringHelper.FindLanguageResource("error")); return; } if (winOptionSetting.txtServer1.Text.ToString() == "" || winOptionSetting.txtServer1.Text.ToString() == null) { Dialog.Show(StringHelper.FindLanguageResource("Servercannotbenull"), StringHelper.FindLanguageResource("error")); return; } if (winOptionSetting.comLang.SelectedIndex.ToString() == "" || winOptionSetting.comLang.SelectedIndex.ToString() == null) { Dialog.Show(StringHelper.FindLanguageResource("Languagecannotbenull"), StringHelper.FindLanguageResource("error")); return; } // end modify if (winOptionSetting.chkStart.IsChecked == true) { RegistryKey runKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); runKey.SetValue("LyncWpfApp.exe", System.Windows.Forms.Application.StartupPath + "\\LyncWpfApp.exe"); //如果Lync插件自启动,那么就算Lync设置了自启动也不能让它运行 modify by 00327190 2015/8/6 RegistryKey runKey1 = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); if (null != runKey1 && null != runKey1.GetValue("LyncWpfApp.exe")) { RegistryKey runKey2 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); if (null != runKey2 && null != runKey2.GetValue("Lync")) { runKey2.DeleteValue("Lync"); } } } else { RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); runKey.DeleteValue("LyncWpfApp.exe"); } } catch { LogManager.SystemLog.Info("DeleteSubKey"); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (txtNumber.Text.ToString().Trim() == "" || txtNumber.Text.ToString() == "") { return; } else { boolnum(txtNumber.Text.ToString()); } if (boolnum(txtNumber.Text.ToString()) == true) { //modify by jinyeqing 00327190 2015/6/10 添加号码时先看是否是UC用户,如果是按照UC帐号添加,不是就按话机号码添加 MakeCallBusiness call = new MakeCallBusiness(); StringBuilder ucName = new StringBuilder(100); string strLyncURI = StringHelper.GetLyncDomainString(SingletonObj.LoginInfo.LyncName); if (call.GetUCAccountByPhoneNo(txtNumber.Text.ToString().Trim(), ucName) != "" && call.GetUCAccountByPhoneNo(txtNumber.Text.ToString().Trim(), ucName) != null) { foreach (DataRow d in dtSelectedContact.Rows) { if (d["Phone"].ToString() == txtNumber.Text.ToString()) { DialogShow.Show(StringHelper.FindLanguageResource("theNumisExist"), StringHelper.FindLanguageResource("error"), 2); return; } if (d["Url"].ToString() == ucName + strLyncURI) //2015/8/6 如果URL 一致,则不添加 { DialogShow.Show(StringHelper.FindLanguageResource("theNameisExist"), StringHelper.FindLanguageResource("error"), 2); return; } } DataRow dr = dtSelectedContact.NewRow(); string str = txtNumber.Text.ToString(); int page = 0; GetAllLyncContacts(str, page); dtSource = dtContact.Copy(); string name = ""; //modify by 00327190 2015/8/6 如果号码是UC用户,则连用户名一起查出来,这样为了避免加人重复 UserConfigBusiness conf = new UserConfigBusiness(); STContact con = new STContact(); string name1 = StringHelper.GetSubString(ucName.ToString()); int iRet1 = conf.GetContactInfo(new StringBuilder(name1), ref con); if (0 == iRet1) { name = con.name_; } //modify by 00327190 2015/8/6 如果号码是UC用户,则连用户名一起查出来,这样为了避免加人重复 for (int i = 0; i < dtSource.Rows.Count; i++) { if (dtSource.Rows[i]["URL"].ToString().Trim() == call.GetUCAccountByPhoneNo(txtNumber.Text.ToString(), ucName) + strLyncURI) { name = dtSource.Rows[i]["NAME"].ToString().Trim(); } } dr[0] = name; //2015/8/24 UTF8 转码UNICODE //byte[] buffer1 = Encoding.Default.GetBytes(call.GetUCAccountByPhoneNo(txtNumber.Text.ToString(), ucName)); //byte[] buffer2 = Encoding.Convert(Encoding.UTF8, Encoding.Default, buffer1, 0, buffer1.Length); //string item1 = Encoding.Default.GetString(buffer2, 0, buffer2.Length); //dr[1] = item1 + strLyncURI; dr[1] = call.GetUCAccountByPhoneNo(txtNumber.Text.ToString(), ucName) + strLyncURI; dr[2] = txtNumber.Text.ToString(); dtSelectedContact.Rows.Add(dr); listSelectedContact.DataContext = null; listSelectedContact.DataContext = dtSelectedContact; listSelectedContact.ScrollIntoView(listSelectedContact.Items[dtSelectedContact.Rows.Count - 1], listSelectedContact.Columns[0]); txtName.Text = ""; txtNumber.Text = ""; } //之前没有if ,只有中间的循环体部分 else { foreach (DataRow d in dtSelectedContact.Rows) { if (d["Phone"].ToString() == txtNumber.Text.ToString()) { return; } } DataRow dr = dtSelectedContact.NewRow(); dr[0] = txtName.Text.ToString(); dr[2] = txtNumber.Text.ToString(); dtSelectedContact.Rows.Add(dr); listSelectedContact.DataContext = null; listSelectedContact.DataContext = dtSelectedContact; listSelectedContact.ScrollIntoView(listSelectedContact.Items[dtSelectedContact.Rows.Count - 1], listSelectedContact.Columns[0]); txtName.Text = ""; txtNumber.Text = ""; } //是否是盲转窗体 if (isBlindTransCall) { btnOK_Click(null, null); } } else { lync.winCall.OpenDialogTiming(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2); return; } }
private void tabControl1_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (listContact.SelectedIndex < 0) { return; } foreach (DataRow d in dtSelectedContact.Rows) { //2015/8/4 00327190 if (dtContact.Rows.Count != 0) { if (d["Url"].ToString() == dtContact.Rows[listContact.SelectedIndex][1].ToString()) { DialogShow.Show(StringHelper.FindLanguageResource("theNameisExist"), StringHelper.FindLanguageResource("error"), 2); return; } } else //2015/8/12 00327190 { string str = txtInput.Text; GetPageLyncContacts(str, Convert.ToInt32(txtPage.Text) - 1); dtSource = dtContact.Copy(); this.listContact.DataContext = dtContact; return; } } DataRow dr = dtSelectedContact.NewRow(); if (dtContact.Rows.Count != 0) //2015/8/12 00327190 { dr[0] = dtContact.Rows[listContact.SelectedIndex][0]; dr[1] = dtContact.Rows[listContact.SelectedIndex][1]; dr[2] = dtContact.Rows[listContact.SelectedIndex][2]; //if (dr[1].ToString().IndexOf("sip")<0) //{ // dr[2] = dr[0]; // dr[0] = ""; // dr[1] = ""; //} dtSelectedContact.Rows.Add(dr); listSelectedContact.DataContext = null; listSelectedContact.DataContext = dtSelectedContact; //listSelectedContact.ScrollIntoView(listSelectedContact.Items[dtSelectedContact.Rows.Count - 1], listSelectedContact.Columns[0]); //是否是盲转窗体 if (isBlindTransCall) { btnOK_Click(null, null); } } else { string str = txtInput.Text; GetPageLyncContacts(str, Convert.ToInt32(txtPage.Text) - 1); dtSource = dtContact.Copy(); this.listContact.DataContext = dtContact; return; } }
//语音信箱转移 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 MenuItem_Click(object sender, RoutedEventArgs e) { if (Lync.winCall != null) { DialogShow.Show(StringHelper.FindLanguageResource("Youareincallalready"), StringHelper.FindLanguageResource("error"), 2); //不能同时发起两路通话 return; } List <CallItem> list = new List <CallItem>(); int index = -1; if (tabControlCall.SelectedIndex == 0) { list = listMissed.DataContext as List <CallItem>; index = listMissed.SelectedIndex; } else if (tabControlCall.SelectedIndex == 1) { list = listAnswered.DataContext as List <CallItem>; index = listAnswered.SelectedIndex; } else if (tabControlCall.SelectedIndex == 2) { list = listDialed.DataContext as List <CallItem>; index = listDialed.SelectedIndex; } else if (tabControlCall.SelectedIndex == 3) { list = listAll.DataContext as List <CallItem>; index = listAll.SelectedIndex; } if (index < 0) { return; } CallItem item = list[index]; MakeCallBusiness call = new MakeCallBusiness(); MemberType type; if (item.Phone.IndexOf("@") < 0) { type = MemberType.UC_IPPHONE; } else { type = MemberType.UC_ACCOUNT; } string str = ""; if (item.Phone.IndexOf(":") != -1) { str = item.Phone.Substring(item.Phone.IndexOf(":") + 1); } else { str = item.Phone; } //2015/8/24 UNICODE 转码 UTF8 //byte[] buffer1 = Encoding.UTF8.GetBytes(str.Trim().Replace(" ","")); //byte[] buffer2 = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, buffer1, 0, buffer1.Length); //string item1 = Encoding.UTF8.GetString(buffer2,0, buffer2.Length); //call.insertMember((int)type, new StringBuilder(item1)); call.insertMember((int)type, new StringBuilder(str)); if (call.startContextCall() == 0) { str = SingletonObj.LoginInfo.LyncName + ";" + str; Lync.winCall = new WinCall(Lync, str); Lync.winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; Lync.winCall.Show(); } else { Dialog.Show(StringHelper.FindLanguageResource("startContextCallFailed"), StringHelper.FindLanguageResource("error")); return; } }
public void startContextCall(List <string> selectedUserList) { if (null != selectedUserList && selectedUserList.Count > 0) { MakeCallBusiness call = new MakeCallBusiness(); StringBuilder str = new StringBuilder(); string strContact = ""; for (int index = 0; index < selectedUserList.Count; index++) { str = new StringBuilder(selectedUserList[index]); call.insertMember(0, str); strContact += (str + ";"); } if (call.startContextCall() == 0) //插件呼叫管理模块的发起上下文呼叫业务接口 { WinCall winCall = new WinCall(toolbar.Lync, SingletonObj.LoginInfo.LyncName + ";" + strContact.TrimEnd(';')); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); winCall.Title = "Calling: " + str.ToString(); toolbar.Lync.winCall = winCall; } else { DialogShow.Show(StringHelper.FindLanguageResource("startContextCallFailed"), StringHelper.FindLanguageResource("error"), 2); return; } } }