/// <summary> /// 当前应用程序关闭时,注销该用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Current_Exit(object sender, ExitEventArgs e) { try { if (this.loginWindow != null) { this.loginWindow.Close(); } //设置DNS NetWorkAdapter.SetNetworkAdapter(Constant.RouteIp); //退出lync辅助 LyncHelper.LyncSignOut(new Action(() => { if (LyncHelper.MainConversation != null) { ModelManage.ConferenceLyncConversation.RemoveConversation(Constant.ConferenceName, new Action <bool>((successed) => { })); //设置DNS //NetWorkAdapter.EnableDHCP2(); //Conference.View.Tree.ConferenceTreeView.TittleEditControlTimer.Stop(); //Conference.View.IMM.ConferenceAudio_View.TittleEditControlTimer.Stop(); //LyncClient.GetAutomation().EndMeetNow(null); LyncHelper.MainConversation.Close(); } })); //系统关闭辅助 Current_Exit_Help(); } catch (Exception ex) { LogManage.WriteLog(typeof(App), ex); } finally { //关闭指定后台进程 ProcessManage.KillProcess("Lync"); //lync临时显示 WindowHide.SetTrayIconAllDsiplay("Lync"); //消除死亡托盘图标 SysTray.Refresh(); } }
/// <summary> /// 登录初始化配置(lync相关) /// </summary> private void LoginEnviromentInit_Lync() { try { //关闭指定后台进程 ProcessManage.KillProcess("Lync"); //lync临时显示 WindowHide.SetTrayIconAllDsiplay("Lync"); //消除死亡托盘图标 SysTray.Refresh(); //判断当前进程是否为单例 ProcessManage.CheckCurrentProcessIsSingleInstance(new Action(() => { MessageBox.Show("该程序已经在运行中", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); //关闭程序 Application.Current.Shutdown(0); })); //更改lync注册表 RegeditManage.UpdateLyncRegedit(); //获取lync进程 Process[] processs = Process.GetProcessesByName("Lync"); if (processs.Count() > 0) { //清除lyncApp缓存文件 LyncManage.ClearLyncAppData(); } //打开lync实例 RegeditManage.OpenAplicationByRegedit2("Lync.exe"); //程序退出时释放lync实例 Application.Current.Exit += Current_Exit; #region old solution //验证是否能够访问AD (adpppds) //if (!DetectionManage.TestNetConnectity(Constant.TreeServiceIP)) //{ // MessageBox.Show("服务器连接失败,请及时联系管理员", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); // //关闭程序 // Application.Current.Shutdown(0); //} ////关闭指定后台进程 //ProcessManage.KillProcess("Lync"); ////lync临时显示 //WindowHide.SetTrayIconAllDsiplay("Lync"); #endregion } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }