/// <summary>
 /// 该函数用于设置盲转呼叫事件回调函数
 /// </summary>
 /// <param name="crEventCallBack"></param>
 public void SetCallTransEventCallBack(CallTransEventCB CallTransCallBack)
 {
     LogManager.SystemLog.Debug(string.Format("Start UC_SDK_SetCallReservedEventCallBack"));
     int iRet = UCInterface.UC_SDK_SetCallTransEventCallBack(CallTransCallBack);
     if (iRet != 0)
     {
         LogManager.SystemLog.Error(string.Format("UC_SDK_SetCallTransEventCallBack = {0}", iRet));
     }
     LogManager.SystemLog.Debug(string.Format("End UC_SDK_SetCallTransEventCallBack"));
 }
        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());
            }
        }