/// <summary> /// 登陆 /// </summary> private void Login() { try { if (string.IsNullOrEmpty(this.txtUser.Text)) { this.CodeOrUsingIsNull("请输入用户名"); return; } if (string.IsNullOrEmpty(this.pwd.Password)) { this.CodeOrUsingIsNull("请输入密码"); return; } LyncHelper.IsSignedOutDoSomeThing(new Action(() => { MainWindow.CanSigined = true; })); //嵌入条件判断(lync实例是否存在) if (MainWindow.CanSigined) { #region 登陆前先进行判断(是否连接网络,是否能够连接服务器) //验证是否能够访问AD if (!DetectionManage.TestNetConnectity(Constant.DNS1)) { this.ShowNetWorkIsNotThrow("AD服务器连接失败,请及时联系管理员"); return; } bool lyncServiceCanVisit = false; if (DetectionManage.TestNetConnectity(Constant.LyncIP1) || DetectionManage.TestNetConnectity(Constant.LyncIP2)) { lyncServiceCanVisit = true; } //验证是否能够访问LYNC服务器 if (!lyncServiceCanVisit) { this.ShowNetWorkIsNotThrow("Lync服务器连接失败,请及时联系管理员"); return; } //验证是否能够访问外围服务器 if (!DetectionManage.TestNetConnectity(Constant.TreeServiceIP)) { this.ShowNetWorkIsNotThrow("会议服务器连接失败,请及时联系管理员"); return; } //验证是否能够访问LYNC扩展web服务(研讨服务) if (!DetectionManage.IsWebServiceAvaiable(Constant.TreeServiceAddressFront + Constant.ConferenceTreeServiceWebName)) { this.ShowNetWorkIsNotThrow("会议服务器访问失败,请及时联系管理员"); return; } #endregion //邮件地址 var email = this.txtUser.Text.Trim() + "@" + Constant.UserDomain; ModelManage.ConferenceInfo.CheckUserIsOnline(email, new Action <bool>((isOnline) => { if (isOnline) { this.CodeOrUsingIsNull("当前用户已在线"); return; } else { //登陆编辑区域设置为不可用 this.LoginPanelIsEnable = false; //lync状态设置 LyncHelper.LyncStateSetting(this.StateIndex); //lync嵌入 LyncHelper.LyncSignning(email, this.pwd.Password, StartSignIn); } })); } else { } } catch (Exception ex) { //出现异常,关闭登陆提示 this.IsLogining = System.Windows.Visibility.Collapsed; //将登陆编辑区域恢复为可用状态 this.LoginButtonIsEnable(); LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 可登录处理 /// </summary> /// <param name="userName">用户名</param> /// <param name="pwd">密码</param> /// <param name="email">邮箱地址</param> public void SignedInDealWidth(string userName, string pwd, string email) { try { ThreadPool.QueueUserWorkItem((o) => { //创建客户端对象模型实例(并通过验证) bool result = Constant.clientContextManage.CreateClient(Constant.SpaceWebSiteUri, userName, pwd, Constant.UserDoaminPart1Name); if (result) { //lync状态设置 LyncHelper.LyncStateSetting(this.StateIndex); //lync嵌入 LyncHelper.LyncSignning(email, pwd, null); this.Dispatcher.BeginInvoke(new Action(() => { //嵌入数据准备 this.SignInDataPrepare(); TimerJob.StartRun(new Action(() => { if (this.CanThrow) { this.timerAcept.Stop(); //(登陆窗体、登陆提示、开始菜单隐藏) //登陆窗体隐藏 this.Visibility = vy.Hidden; //登陆提示隐藏 this.IsLogining = vy.Hidden; ThreadPool.QueueUserWorkItem((t) => { //会话同步服务配置 ModelManage.ClientInit(Constant.SPSiteAddressFront + Constant.SpsSearchWebName, ClientModelType.ConferenceSpSearch, Constant.LoginUserName, Constant.WebLoginPassword, Constant.UserDoaminPart1Name); }); //创建主界面 MainWindow mainWindow = new MainWindow(); //显示主界面 mainWindow.Show(); } }), 600, out timerAcept); })); } else { this.Dispatcher.BeginInvoke(new Action(() => { this.CodeOrUserIsNull("用户名密码错误"); //恢复可用 this.LoginPanelIsEnable = true; })); return; } }); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }