Beispiel #1
0
 public void UpdateUCContactState(object ucInfo)
 {
     lock (WinCall.lockObject)
     {
         try
         {
             LogManager.SystemLog.Info("UpdateUCContactState Monitor.Enter");
             List <UCContact> contactList = listContact.ItemsSource as List <UCContact>;
             if (contactList == null || contactList.Count == 0)
             {
                 return;
             }
             UCContactInfo info = ucInfo as UCContactInfo;
             foreach (UCContact uc in contactList)
             {
                 string ucName = "";
                 if (uc.UCMemberType == MemberType.UC_ACCOUNT)
                 {
                     ucName = StringHelper.GetSubString(uc.UserName);
                 }
                 else
                 {
                     ucName = uc.UserName;
                 }
                 if (ucName == info.User.ucAcc_)
                 {
                     uc.Online = (UCContactAvailability)info.State;  //显示多少人入会的  (a/b)
                     //if (uc.Online.ToString() == "Busy")
                     //{
                     //    Dispatcher.Invoke(new Action(()
                     //                =>
                     //               {
                     //                   int b = contactList.Count;
                     //                   a=a++;
                     //                   int C = a / b;
                     //                   winCall.Title = contactList[0].UserName + StringHelper.FindLanguageResource("TempGroup") + C;
                     //               }));
                     //}
                     break;
                 }
             }
         }
         finally
         {
             LogManager.SystemLog.Info("UpdateUCContactState Monitor.Exit");
         }
     }
     if (this.lync.winCall != null)   //2015/8/24  只有会议时才自动更新SetBtn
     {
         if (this.lync.winCall.strtemp.Split(';')[0] != "VideoCall")
         {
             if (this.lync.winCall.strtemp.Split(';').Length > 2)
             {
                 LogManager.SystemLog.Info(string.Format("this.lync.winCall.strtemp.Split(';').Length={0}", this.lync.winCall.strtemp.Split(';').Length));
                 this.lync.setBtn();  //2015/8/11
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 增加成员
        /// </summary>
        /// <param name="sipUri"></param>
        public int insertMember(int type, StringBuilder sipUri)  //modify by jinyeqing 2015/6/9 之前是返回值是空值 现在返回INT
        {
            LogManager.SystemLog.Debug(string.Format("Start UC_SDK_InsertMember"));
            int iRet = UCInterface.UC_SDK_AddCallMember(type, StringHelper.GetSubString(sipUri.ToString()));

            if (iRet != 0)
            {
                LogManager.SystemLog.Error(string.Format("UC_SDK_InsertMember = {0}", iRet));
            }
            LogManager.SystemLog.Debug(string.Format("End UC_SDK_InsertMember"));
            return(iRet);
        }
Beispiel #3
0
        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());
            }
        }
Beispiel #4
0
        public bool isClose = false; //语音升级 视频升级方挂断后传递的值让接受方也挂断

        public WinCallReceive(WinLync lync, string name, bool isVide)
        {
            InitializeComponent();
            btnFinish.Visibility     = Visibility.Hidden;
            imgOtherPhone.Visibility = Visibility.Hidden;
            txtOtherPhone.Visibility = Visibility.Hidden;
            callName         = name;
            model            = new WinCallReceiveViewModel(this, isVide);
            this.lync        = lync;
            this.DataContext = model;
            this.Title       = StringHelper.GetSubString(name);
            isvideo          = isVide;
            if (isVide)
            {
                this.Height = 120;
            }
            else
            {
                imgType.Visibility = Visibility.Collapsed;
            }
            if (lync.isConnected == true)   //语音升级视频后再转移,此时expander不可见,espace无此种转移
            {
                this.expander.Visibility = Visibility.Hidden;
                //modify by 00327190  2015/7/27   语音升级视频时,未接受请求时,本地的视频升级按钮,加人按钮,呼叫保持按钮不能使用
                lync.winCall.btnVideo.IsEnabled       = false;
                lync.winCall.btnAddContact.IsEnabled  = false;
                lync.winCall.btnCallSuspend.IsEnabled = false;
            }
            WinLync.lyncCounter++;
            this.Left     = SystemParameters.WorkArea.Width - this.Width;
            this.Top      = SystemParameters.WorkArea.Height - this.Height;
            this.Closing += new System.ComponentModel.CancelEventHandler(WinCallReceive_Closing);
            this.Closed  += new EventHandler((sender, e)
                                             =>
            {
                WinLync.lyncCounter--;
            });
            GetPhone();   //2015/7/28
            lync.isHave = true;
        }
        private void DeclineCommandProcess()
        {
            isAnswerMessage = false;
            if (!isVideo)
            {
                callBusiness.RejectCall();  //超时不做这个动作,只关界面   2015/7/28
            }
            else
            {
                MakeCallBusiness bus = new MakeCallBusiness();
                bus.RejectVideoCall();
            }
            winCallReceive.isCloseButton = false;

            //7/27
            winCallReceive.lync.setBtn();   //先设置图形
            //if (winCallReceive.lync.toolBar.JointType == PhoneJointType.PC_Device)
            //{
            //    if (winCallReceive.lync.winCall.btnVideo.IsEnabled == false)
            //    {
            //        winCallReceive.lync.winCall.btnVideo.IsEnabled = true;
            //        UpdateImage.UpdateData(winCallReceive.lync.winCall.imgVideo, "/Image/call/video_1.png");
            //    }

            //}

            if (winCallReceive.Visibility == Visibility.Visible)
            {
                winCallReceive.Close();
                winCallReceive.lync.isHave = false;
            }
            string name = StringHelper.GetSubString(winCallReceive.callName);
            string url  = StringHelper.GetLyncUrl(name);

            HistoryQueryBusiness query = new HistoryQueryBusiness();

            query.InsertCallHistory(CallHistoryType.HISTORY_CALL_MISSED, url, name, -1);
        }
Beispiel #6
0
        //获取本人和对方的话机号码
        //get the phoneNos of your own and caller's
        private void GetPhone()
        {
            //7/28
            UserConfigBusiness conf = new UserConfigBusiness();
            STContact          con  = new STContact();
            int iRet = conf.GetContactInfo(new StringBuilder(SingletonObj.LoginInfo.UserID), ref con);

            if (iRet == 0)
            {
                UcPhoneNo = con.ipphone1_;
            }
            string name1 = StringHelper.GetSubString(callName);
            int    iRet1 = conf.GetContactInfo(new StringBuilder(name1), ref con);

            if (iRet1 == 0)
            {
                UcPhoneNo1 = con.ipphone1_;
            }
            else  //modify by 00327190   2015/9/17  纯话机用户拨打Lync
            {
                UcPhoneNo1 = name1;
            }
        }
        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;
            }
        }