Пример #1
0
        public static void OpenApp(AppType appType)
        {
            try
            {
                switch (appType)
                {
                case AppType.IE:
                    RegeditManage.OpenAplicationByRegedit2("IEXPLORE.EXE");
                    break;

                case AppType.Notepad:
                    ProcessManage.OpenAppByAppName("notepad.exe");
                    break;

                case AppType.calc:
                    ProcessManage.OpenAppByAppName("calc.exe");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(ApplicationManage), ex);
            }
        }
Пример #2
0
        /// <summary>
        /// 共享浏览器
        /// </summary>
        /// <param name="uri"></param>
        public void ShareWebBrowser(Uri uri)
        {
            try
            {
                RegeditManage.OpenAplicationByRegedit2("IEXPLORE.EXE", uri.OriginalString, new Action <int, IntPtr>((processID, intptr) =>
                {
                    //获取共享模型
                    var shareModality = ((ApplicationSharingModality)(LyncHelper.MainConversation.Conversation.Modalities[ModalityTypes.ApplicationSharing]));

                    //遍历可以共享的资源
                    foreach (var item in shareModality.ShareableResources)
                    {
                        //指定要共享的程序名称
                        if (item.Id.Equals(processID))
                        {
                            //判断是否可以进行共享该程序
                            if (shareModality.CanShare(item.Type))
                            {
                                this.ShareAndSync(intptr, shareModality, item);
                                break;
                            }
                        }
                        else if (item.Id == intptr.ToInt32())
                        {
                            //判断是否可以进行共享该程序
                            if (shareModality.CanShare(item.Type))
                            {
                                this.ShareAndSync(intptr, shareModality, item);
                                break;
                            }
                        }
                        //else if (item.Name.Contains(""))
                        //{

                        //    //判断是否可以进行共享该程序
                        //    if (shareModality.CanShare(item.Type))
                        //    {
                        //        共享程序置顶
                        //        Win32API.SetWindowPos(intptr, -1, 615, 110, 0, 0, 1 | 2);

                        //        //开始共享该程序
                        //        shareModality.BeginShareResources(item, null, null);
                        //        //同步页面
                        //        Conference.MainWindow.MainPageInstance.ChairView.SyncPageHelper(ConferenceCommon.EnumHelper.ViewSelectedItemEnum.Resource);
                        //        break;
                        //    }
                        //}
                    }
                }));
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Пример #3
0
        /// <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
            {
            }
        }