Exemplo n.º 1
0
 /// <summary>
 /// 设置键盘透明度
 /// </summary>
 public void TouchKeyBoardOpacitySetting()
 {
     try
     {
         if (File.Exists(Constant.KeyboardSettingFile_32))
         {
             //设置触摸键盘透明
             ProcessManage.OpenFileByLocalAddress(Constant.KeyboardSettingFile_32);
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Exemplo n.º 2
0
        void OpenFileByLocalApp(string uri)
        {
            try
            {
                //获取文件名称(包含扩展名称)
                var fileName = System.IO.Path.GetFileName(uri);
                //本地地址
                var loaclF = this.LocalTempRoot + "\\" + fileName;
                //创建一个下载管理实例
                WebClientManage webClientManage = new WebClientManage();

                //PictureView pictureView = new PictureView();
                //pictureView.Title = Path.GetFileNameWithoutExtension(uri);
                ////加载UI事件(比如多媒体播放器,浏览器)
                //this.book_LoadUI(pictureView);
                //文件下载
                webClientManage.FileDown(uri, loaclF, this.LoginUserName, this.WebLoginPassword, this.UserDomain, new Action <int>((intProcess) =>
                {
                }), new Action <Exception, bool>((ex, IsSuccessed) =>
                {
                    try
                    {
                        if (IsSuccessed)
                        {
                            if (File.Exists(loaclF))
                            {
                                ProcessManage.OpenFileByLocalAddress(loaclF);
                            }
                        }
                    }
                    catch (Exception ex2)
                    {
                        LogManage.WriteLog(this.GetType(), ex2);
                    }
                }));
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 设置键盘透明度
 /// </summary>
 public void TouchKeyBoardOpacitySetting()
 {
     try
     {
         string keyFile = AppDomain.CurrentDomain.BaseDirectory + Constant.KeyboardSettingFile_32;
         if (File.Exists(keyFile))
         {
             //设置触摸键盘透明
             ProcessManage.OpenFileByLocalAddress(keyFile);
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Exemplo n.º 4
0
 private void gridCancelButton_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     try
     {
         MessageBoxResult result = MessageBox.Show("是否注销", "操作提示", MessageBoxButton.YesNo, MessageBoxImage.Warning);
         if (result == MessageBoxResult.Yes)
         {
             Application.Current.Shutdown(0);
             ProcessManage.OpenFileByLocalAddress(SpaceCodeEnterEntity.StartApplication);
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 引导键盘
 /// </summary>
 public void UsingTouchKeyBoard()
 {
     try
     {
         notePadProcess = ProcessManage.OpenAppByAppNameGetProcess("notepad.exe");
         //设置合适尺寸
         Win32API.MoveWindow(notePadProcess.Handle, 0, 0, 70, 70, false);
         TimerJob.StartRun(new Action(() =>
         {
             notePadProcess.Kill();
             notePadProcess = null;
         }), 700);
         //}
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// lync程序环境设置(事件、状态、原生态界面抑制、注册表、标示)
        /// </summary>
        public static void SetLyncAplicationEnviroment(Action containCompleateCallBack)
        {
            try
            {
                //获取lync进程
                Process[] processes = Process.GetProcessesByName("Lync");
                if (processes.Count() > 0)
                {
                    IntPtr handle = ProcessManage.GetMainWindowHandle(processes[0]);
                    if (handle.ToInt32() > 0)
                    {
                        //获取LYNC客户端
                        Constant.lyncClient = LyncClient.GetClient();
                        if (Constant.lyncClient != null)
                        {
                            #region 注册Lync事件

                            //lync状态更改事件
                            Constant.lyncClient.StateChanged += lyncClient_StateChanged;

                            #endregion

                            #region lync初始化

                            //首先将捕获到的lync实例进行一次初始化加载
                            if (Constant.lyncClient.State == ClientState.Uninitialized)
                            {
                                //lync客户端初始化
                                Constant.lyncClient.BeginInitialize(null, null);
                            }

                            //签入
                            if (Constant.lyncClient.State == ClientState.SigningIn || Constant.lyncClient.State == ClientState.SignedIn)
                            {
                                //先签出(lync控制)
                                Constant.lyncClient.BeginSignOut(null, null);
                            }
                            if (Constant.lyncClient.State == ClientState.SignedOut)
                            {
                                //可以签入
                                MainWindow.CanSigined = true;
                            }

                            #endregion

                            #region 程序相关设置

                            WindowHide.SetTrayIconVisible("Lync", false);

                            ////将lync的原生态的主窗体封装起来
                            APPContainManage.APP_Conatain(handle);

                            containCompleateCallBack();

                            #endregion
                        }
                    }
                    else
                    {
                        LyncHelper.SetLyncAplicationEnviroment(containCompleateCallBack);
                    }
                }
                else
                {
                    LyncHelper.SetLyncAplicationEnviroment(containCompleateCallBack);
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(LyncHelper), ex);
            }
            finally
            {

            }
        }
Exemplo n.º 7
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
            {
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 本地资源共享
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnLocalResource_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (LyncHelper.MainConversation != null)
                {
                    //打开选项对话框
                    OpenFileDialog dialog = new OpenFileDialog();
                    //指定显示的文件类型
                    //dialog.Filter = "所有文件";
                    //设置为多选
                    dialog.Multiselect = false;
                    if (dialog.ShowDialog() == true)
                    {
                        //获取扩展名
                        string fileExtension = System.IO.Path.GetExtension(dialog.FileName);
                        if (fileExtension.Equals(".pptx") || fileExtension.Equals(".ppt"))
                        {
                            //共享前释放资源
                            this.ShareBeforeDisposeResrouce();
                            //打开ppt共享辅助
                            PPtShareHelper(dialog.FileName);
                        }
                        else
                        {
                            //获取文件名称(不包含扩展名称)
                            var fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName);
                            ////文件移动
                            //System.IO.File.Copy(dialog.FileName, Constant.LocalTempRoot + "\\" + fileNameWithoutExtension + fileExtension, true);
                            //Thread.Sleep(1000);
                            //通过进程打开一个文件
                            ProcessManage.OpenFileByLocalAddressReturnHandel(dialog.FileName, new Action <int, IntPtr>((processID, intptr) =>
                            {
                                //获取共享模型
                                var shareModality = ((ApplicationSharingModality)(LyncHelper.MainConversation.Conversation.Modalities[ModalityTypes.ApplicationSharing]));

                                //遍历可以共享的资源
                                foreach (var item in shareModality.ShareableResources)
                                {
                                    //&& intptr != new IntPtr(0)
                                    //指定要共享的程序名称
                                    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(fileNameWithoutExtension))
                                    {
                                        //判断是否可以进行共享该程序
                                        if (shareModality.CanShare(item.Type))
                                        {
                                            this.ShareAndSync(intptr, shareModality, item);
                                            break;
                                        }
                                    }
                                }
                            }));
                        }
                    }
                }
                else
                {
                    MessageBox.Show("使用桌面共享之前先选择一个会话", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }