예제 #1
0
 /// <summary>
 /// 定时任务
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void G_timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (publicfunction.g_HttpGetStatus == true)
     {
         if (publicfunction.g_IsRecLog == "Yes")
         {
             RecordLog.GetInstance().WriteLog(Level.Info, string.Format("当前势行接口信息命令:{0}", publicfunction.g_CallMode));
         }
         if (publicfunction.g_CallMode == (int)OCXPlayAttrubute.capturepic)
         {
             //创建Chrome网页框架
             PublicFunc publicFunc = new PublicFunc();
             publicFunc.CaptureChromeFrm(publicfunction.g_HttpGetParams);
         }
         else if (publicfunction.g_CallMode == (int)OCXPlayAttrubute.startlnkapp)
         {
             //打开指定的lnk快捷方式
             PublicFunc publicFunc = new PublicFunc();
             publicFunc.StartLnkPath(publicfunction.g_HttpGetParams);
         }
         publicfunction.g_CallMode      = -1;
         publicfunction.g_HttpGetStatus = false;
         publicfunction.g_HttpGetParams = string.Empty;
     }
 }
예제 #2
0
        public mainform()
        {
            if (publicfunction.g_IsRecLog == "Yes")
            {
                //Console.WriteLine(string.Format("播放号:{0},不开启控制摄像头功能", playFrmInfo.playno));
                RecordLog.GetInstance().WriteLog(Level.Info, string.Format("---Chromuin服务程序启动---"));
            }
            //判断是否启用特效
            if (ConfigurationManager.AppSettings["isEffect"] != null)
            {
                if ("Yes" == (ConfigurationManager.AppSettings["isEffect"].ToString()))
                {
                    publicfunction.IsEffect = true;
                }
                else
                {
                    publicfunction.IsEffect = false;
                }
            }
            #region 只能运行一个客户端程序

            System.Threading.Mutex mutex = new System.Threading.Mutex(true, Assembly.GetExecutingAssembly().GetName().Name, out bool flag);
            if (!flag)
            {
                MessageBox.Show("ChromeForm控件服务程序已经运行", "请确定", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Environment.Exit(1);//退出程序
            }

            #endregion 只能运行一个客户端程序
            InitializeComponent();

            #region 保证运行其他进程同时置顶该进程窗体

            int dwTimeout = -1;
            SystemParametersInfo((int)WindowsCommand.SPI_GETFOREGROUNDLOCKTIMEOUT, 0, (IntPtr)dwTimeout, 0);
            if (dwTimeout >= 100)
            {
                SystemParametersInfo((int)WindowsCommand.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, IntPtr.Zero, (int)WindowsCommand.SPIF_SENDCHANGE | (int)WindowsCommand.SPIF_UPDATEINIFILE);
            }

            #endregion 保证运行其他进程同时置顶该进程窗体
            RunHttpFunc();
            //初始化Chrome设置
            PublicFunc.InitChromeSetting();

            this.startTimerEvent();
        }