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; } } }
public WinSlide(WinCall call, string type) { InitializeComponent(); this.type = type; this.call = call; this.Loaded += new RoutedEventHandler(WinSlide_Loaded); }
public WinSlide(WinCall call,string type) { InitializeComponent(); this.type = type; this.call = call; this.Loaded += new RoutedEventHandler(WinSlide_Loaded); }
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; } } }
private void AnswerCommandProcess() { try { //if (!isVideo) //{ // callBusiness.AnswerCall(); //} winCallReceive.isCloseButton = false; isAnswerMessage = false; winCallReceive.Close(); //winCallReceive.lync.isHave = false; if (winCallReceive.lync.timer == null || !winCallReceive.lync.timer.Enabled) { WinCall call; if (isVideo) { call = new WinCall(winCallReceive.lync, "VideoCall;" + winCallReceive.callName + ";" + SingletonObj.LoginInfo.LyncName); call.callType = CallHistoryType.HISTORY_CALL_ANSWERED; } else { call = new WinCall(winCallReceive.lync, winCallReceive.callName + ";" + SingletonObj.LoginInfo.LyncName); call.callType = CallHistoryType.HISTORY_CALL_ANSWERED; } winCallReceive.lync.winCall = call; call.Show(); winCallReceive.lync.UCAVSessionConnected(); } else { winCallReceive.lync.winCall.model.IsVideo = true; winCallReceive.lync.winCall.SetWinSize(); if (winCallReceive.lync.winCall.video == null) { winCallReceive.lync.winCall.SetUCVideo(); } winCallReceive.lync.winCall.model.AcceptVideoCall(); } if (!isVideo) { callBusiness.AnswerCall(); } } 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 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="cds"></param> void LyncMessageProcess(COPYDATASTRUCT cds) { try { LogManager.SystemLog.Debug(cds.cbData); if (cds.lpData == "LogOutUC")//注销UC { StartSignOutUC(); } else if (cds.lpData == "LoginUC")//登录 { if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null) { StartLoginUC(); } } else if (cds.lpData != "") { if (SingletonObj.LoginInfo == null) { Dialog.Show(StringHelper.FindLanguageResource("NoLogin"), StringHelper.FindLanguageResource("error")); return; } if (winCall == null) { string[] strList = cds.lpData.Split(';'); if (strList.Count((x) => { return x.IndexOf("phone-context") > -1 ? true : false; }) > 0) { List<string> strListTemp = new List<string>(); for (int i = 0; i < strList.Length; i++) { if (strList[i].IndexOf("phone-context") < 0) { strListTemp.Add(strList[i]); } } strList = new string[strListTemp.Count]; cds.lpData = ""; for (int i = 0; i < strListTemp.Count; i++) { cds.lpData += strListTemp[i] + ";"; strList[i] = strListTemp[i]; } cds.lpData = cds.lpData.Substring(0, cds.lpData.Length - 1); } MakeCallBusiness call = new MakeCallBusiness(); StringBuilder str = new StringBuilder(); string type = strList[0]; if (type == "VideoCall")//视频呼叫 { if (this.isHave == true) //有接听界面,则不允许做视频操作 { DialogShow.Show(StringHelper.FindLanguageResource("TwoCallsSameTime"), StringHelper.FindLanguageResource("error"), 2); return; } else { if (strList.Length > 3) { Dialog.Show(StringHelper.FindLanguageResource("NoMultiplePersonVideo"), StringHelper.FindLanguageResource("error")); return; } if (toolBar.JointType == PhoneJointType.IPPhone_Device) { Dialog.Show(StringHelper.FindLanguageResource("NoSupportVideo"), StringHelper.FindLanguageResource("error")); return; } //call.insertMember((int)MemberType.UC_ACCOUNT, new StringBuilder(strList[2])); //winCall = new WinCall(this, cds.lpData); //winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; //winCall.Show(); //modify by 00327190 之前是只有上面隐掉的,会有问题,纯话机和UC账户要分开 2015/9/18 if (strList[2].IndexOf("@") != -1) { call.insertMember((int)MemberType.UC_ACCOUNT, new StringBuilder(strList[2])); winCall = new WinCall(this, cds.lpData); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); } else //如果是纯数字,则再分能不能查到对应的UC用户 2015/9/21 { StringBuilder ucName = new StringBuilder(100); call.GetUCAccountByPhoneNo(strList[2], ucName); if (ucName.ToString() == "") //纯话机 2015/9/21 { call.insertMember((int)MemberType.UC_IPPHONE, new StringBuilder(strList[2])); winCall = new WinCall(this, cds.lpData); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); } else { call.insertMember((int)MemberType.UC_ACCOUNT, new StringBuilder(strList[2])); winCall = new WinCall(this, cds.lpData); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); } } } } else { //modify byjinyeqing 2015/6/3 多于20人不可以显示出来 if (strList.Length > 21) //第一行是call 所以应该是21 { DialogShow.Show(StringHelper.FindLanguageResource("somanypeople"), StringHelper.FindLanguageResource("error"), 2); return; } if (strList.Length == 3) //两人会话的操作(逻辑上为了与多人会议区别开来 modify by jinyeqing 2015/6/19) { str = new StringBuilder(strList[2].Substring(strList[2].IndexOf(':') + 1).TrimEnd('>')); string a = ";" + str.ToString().Trim(); if (boolnum(str.ToString().Trim()) == false) //不为纯数字就报警 ,若为纯数字,可能为话机用户,这里就不做和UC匹配的校验 //if (call.insertMember((int)MemberType.UC_ACCOUNT, str) != 0) //moidify by jinyeqing 2015/6/8 以前没有if判断 { if (call.insertMember((int)MemberType.UC_ACCOUNT, str) != 0) //if (call.GetUCAccountByPhoneNo(str.ToString(), ucName) == "" || call.GetUCAccountByPhoneNo(str.ToString(), ucName) == null) { string message = str + " " + StringHelper.FindLanguageResource("NoSuchUCAccount"); DialogShow.Show(message, StringHelper.FindLanguageResource("error"), 2); cds.lpData = cds.lpData.Replace(a, ""); this.isUcCount = false; call.startContextCall(); return; } } else //纯数字能找到UC账户的,就把数字替换成UCname { StringBuilder ucName = new StringBuilder(100); call.GetUCAccountByPhoneNo(str.ToString(), ucName); string strTemp = null; if (ucName.ToString() == "") { strTemp = str.ToString(); call.insertMember((int)MemberType.UC_IPPHONE, new StringBuilder(strTemp)); } else { strTemp = ucName + StringHelper.GetLyncDomainString(SingletonObj.LoginInfo.LyncName); call.insertMember((int)MemberType.UC_ACCOUNT, ucName); cds.lpData = cds.lpData.Replace(str.ToString().Trim(), strTemp); } } if (call.startContextCall() == 0) { winCall = new WinCall(this, cds.lpData.Substring(cds.lpData.IndexOf(';') + 1)); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); } else { DialogShow.Show(StringHelper.FindLanguageResource("startContextCallFailed"), StringHelper.FindLanguageResource("error"), 2); return; } } else //三人至20人的会议 { if (this.isHave == true) //有接听界面,则不允许做会议操作 { DialogShow.Show(StringHelper.FindLanguageResource("TwoCallsSameTime"), StringHelper.FindLanguageResource("error"), 2); return; } else { for (int index = 2; index < strList.Length; index++) { str = new StringBuilder(strList[index].Substring(strList[index].IndexOf(':') + 1).TrimEnd('>')); string a = ";" + str.ToString().Trim(); StringBuilder ucName = new StringBuilder(100); // call.insertMember((int)MemberType.UC_ACCOUNT, str); //modify by 00327190 之前是只有上面隐掉的,会有问题,纯话机和UC账户要分开 2015/9/18 if (str.ToString().IndexOf("@") != -1) { call.insertMember((int)MemberType.UC_ACCOUNT, str); } else //如果是纯数字,则再分能不能查到对应的UC用户 2015/9/21 { call.GetUCAccountByPhoneNo(str.ToString(), ucName); if (ucName.ToString() == "") //纯话机 { call.insertMember((int)MemberType.UC_IPPHONE, str); } else { call.insertMember((int)MemberType.UC_ACCOUNT, ucName); } } } call.startContextCall(); winCall = new WinCall(this, cds.lpData.Substring(cds.lpData.IndexOf(';') + 1)); winCall.callType = CallHistoryType.HISTORY_CALL_DIALED; winCall.Show(); } } } } else { DialogShow.Show(StringHelper.FindLanguageResource("Youareincallalready"), StringHelper.FindLanguageResource("error"), 2); //不能同时发起两路通话 return; } } } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }
public WinCallViewModel(WinCall window, string str) { try { //if (SingletonObj.LoginInfo.LyncName != str.Split(';')[0] && str.Split(';').Length != 1) //{ // this.flag = false; //} //else //{ // this.flag = true; //} //StrTemp = winlync.strTempBool.ToString(); callBackConfMemberEventCB = new ConfMemberEventCB(callBackConfMemberEventCBProcess); callBackVideoCallEventCB = new CallEventCB(callBackVideoCallEventCBProcess); callReservedEventCB = new CallReservedEventCB(callReservedEventCBProcess); callTransEventCB = new CallTransEventCB(callTransEventCBProcess); //modify by jinyeqing 2015/5/22 jiaji 说要把这三个事件回调函数放之前 (上下顺序倒了一下 下面的注释了) call.SetConfMemEventCallBack(callBackConfMemberEventCB); call.SetVideoCallEventCallBack(callBackVideoCallEventCB); call.SetCallReservedEventCallBack(callReservedEventCB); call.SetCallTransEventCallBack(callTransEventCB); //modify by jinyeqing 2015/5/22 jiaji 说要把这三个事件回调函数放之前 (上下顺序倒了一下 下面的注释了) winCall = window; VideoCommand = new DelegateCommand(VideoCommandProcess); CallSuspendCommand = new DelegateCommand(CallSuspendCommandProcess); HoldDownCommand = new DelegateCommand(HoldDownCommandProcess); SetMicPhoneCommand = new DelegateCommand(SetMicPhoneCommandProcess); AddContactCommand = new DelegateCommand(AddContactCommandProcess); HoldDownOneCommand = new DelegateCommand(HoldDownOneCommandProcess); ReInviteOneCommand = new DelegateCommand(ReInviteOneCommandProcess); MuteCommand = new DelegateCommand(MuteCommandProcess); RemoveCommand = new DelegateCommand(RemoveCommandProcess); OpenDialCommand = new DelegateCommand(OpenDialCommandProcess); SetVolCommand = new DelegateCommand(SetVolCommandProcess); BlindTransCallCommand = new DelegateCommand(BlindTransCallCommandProcess); this.winlync = winCall.lync; //modify by 00327190 2015/7/16 try { lock (WinCall.lockObject) { try { LogManager.SystemLog.Info("WinCallViewModel Monitor.Enter"); contactList = new List<UCContact>(); string[] listStr = str.Split(';'); foreach (string con in listStr) { if (str.IndexOf("VideoCall") > -1 && contactList.Count == 2) { break; } if (con == "VideoCall") { IsVideo = true; continue; } UCContact uc = new UCContact(); uc.UserName = con; if (contactList.Exists(x => x.UserName == uc.UserName)) { continue; } if (uc.UserName.IndexOf("@") != -1) { uc.UCMemberType = MemberType.UC_ACCOUNT; } else //如果是纯数字,则再分能不能查到对应的UC用户 2015/9/21 { StringBuilder ucName = new StringBuilder(100); call.GetUCAccountByPhoneNo(uc.UserName, ucName); if (ucName.ToString() == "") //纯话机 2015/9/21 { uc.UCMemberType = MemberType.UC_IPPHONE; } else { uc.UCMemberType = MemberType.UC_ACCOUNT; uc.UserName = ucName + StringHelper.GetLyncDomainString(SingletonObj.LoginInfo.LyncName); } //uc.UCMemberType = MemberType.UC_IPPHONE; } if (contactList.Count == 0) { if (IsVideo) { //2015/8/24 UTF8 转码UNICODE //byte[] buffer1 = Encoding.Default.GetBytes(str); //byte[] buffer2 = Encoding.Convert(Encoding.UTF8, Encoding.Default, buffer1, 0, buffer1.Length); //string strBuffer = Encoding.Default.GetString(buffer2, 0, buffer2.Length); winCall.Title = (uc.UserName == SingletonObj.LoginInfo.LyncName ? str.Split(';')[2].ToString() : uc.UserName); } else { //2015/8/24 UTF8 转码UNICODE //byte[] buffer1 = Encoding.Default.GetBytes(str); //byte[] buffer2 = Encoding.Convert(Encoding.UTF8, Encoding.Default, buffer1, 0, buffer1.Length); //string strBuffer = Encoding.Default.GetString(buffer2, 0, buffer2.Length); winCall.Title = (uc.UserName == SingletonObj.LoginInfo.LyncName ? str.Split(';')[1].ToString() : uc.UserName); } uc.IsLeader = true; uc.Mute = MemStatusInCall.CONF_MEM_INCONF; } else { uc.Mute = MemStatusInCall.CONF_MEM_INVITING; } uc.Online = GetContactAvailability((int)uc.UCMemberType, StringHelper.GetSubString(uc.UserName)); contactList.Add(uc); } bool isConf = false; if (contactList.Count > 2) { isConf = true; StrTemp = isConf; } winCall.Render(contactList, isConf); } finally { LogManager.SystemLog.Info("WinCallViewModel Monitor.Exit"); } //call.SetConfMemEventCallBack(callBackConfMemberEventCB); //call.SetVideoCallEventCallBack(callBackVideoCallEventCB); //call.SetCallReservedEventCallBack(callReservedEventCB); } } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }