void LyncClientStateChangedMethod(object ob) { ////通话时不能更改话机联动状态 2015/7/16 ////You can't change joint type in a call //if (winCall != null) //{ // Dispatcher.Invoke(new Action(() => // { // DialogShow.Show(StringHelper.FindLanguageResource("Cannotdothisincall"), StringHelper.FindLanguageResource("error"), 2); // return; // })); //} if (lockLyncUCLoginOut.TryEnterWriteLock(-1)) { try { ClientStateChangedEventArgs e = ob as ClientStateChangedEventArgs; if (e.NewState == ClientState.SignedOut || e.NewState == ClientState.SigningOut)//lync登出 { iWpfHeightButtomOff = iWpfHeightTopOff; if (null != toolBar) { if (e.NewState == ClientState.SigningOut) { Visibility isVisible = Visibility.Visible; Dispatcher.Invoke(new Action(() => { toolBar.Visible = false; isVisible = this.Visibility; //隐藏时不重新设置lync尺寸 if (isVisible == Visibility.Visible && this.WindowState != WindowState.Maximized) { MoveWindowVisible();//恢复lync高度 } }), System.Windows.Threading.DispatcherPriority.Send);//隐藏工具盘 } } LogInBusiness log = new LogInBusiness(); log.SignOut();//lync 注销时 注销UC } if (e.NewState == ClientState.SignedIn)//登录成功 开始订阅自身状态 { iWpfHeightButtomOff = 0; WinOptionSettingViewModel set = new WinOptionSettingViewModel(); set.SaveLyncAccountToConfig(StringHelper.GetLyncNameString(_Client.Self.Contact.Uri)); _Client.Self.Contact.ContactInformationChanged += new EventHandler<ContactInformationChangedEventArgs>(Contact_ContactInformationChanged); ContactSubscription foundContactSubscription = LyncClient.GetClient().ContactManager.CreateSubscription(); foundContactSubscription.AddContact(_Client.Self.Contact); List<ContactInformationType> subscribeTypeList = new List<ContactInformationType>(); subscribeTypeList.Add(ContactInformationType.Availability); foundContactSubscription.Subscribe(ContactSubscriptionRefreshRate.High, subscribeTypeList); LyncSignedInFun(); //2015/8/14 登录时根据Lync状态获取UC状态 GetLyncUserState(); GetUCState(userState); LogInBusiness log = new LogInBusiness(); log.PubSelfStatus((int)userState, new StringBuilder()); } LogManager.SystemLog.Debug(string.Format("SingletonObj.LoginInfo = {0}", SingletonObj.LoginInfo)); LogManager.SystemLog.Debug(string.Format("Leave LyncClientStateChanged.NewState = {0}", e.NewState)); } finally { lockLyncUCLoginOut.ExitWriteLock(); } } }
/// <summary> /// 注销UC /// </summary> public void StartSignOutUC()//注销UC { LogManager.SystemLog.Debug("Start StartSignOutUC"); LogInBusiness log = new LogInBusiness(); log.SignOut(); SingletonObj.LoginInfo = null; LogManager.SystemLog.Debug("Start StartSignOutUC.Invoke"); Dispatcher.Invoke(new Action(() => { toolBar.LabState.Text = StringHelper.FindLanguageResource("LogOutUC"); toolBar.SetButtonVisible(false); })); LogManager.SystemLog.Debug("End StartSignOutUC.Invoke"); }