예제 #1
0
 /// <summary>
 /// 发送报文
 /// </summary>
 /// <param name="datagram">报文数据</param>
 public void Send(string datagram)
 {
     try
     {
         Send(this.Encoding.GetBytes(datagram));
     }
     catch (Exception ex)
     {
         NotifyHelper.Notify(NotifyLevel.ERROR, ex.Message);
         throw ex;
     }
 }
예제 #2
0
        private double diskFreeSpace      = 0;                 //磁盘剩余空间
        #region 构造函数

        public SaveImageComponent()
        {
            //检测当前运行路径下手否存在C++写的保存图像的dll文件
            if (System.IO.File.Exists(System.Environment.CurrentDirectory + @"\SaveImageKernel.dll"))
            {
                useCppKernelSave = true;
            }
            else
            {
                NotifyHelper.Notify(NotifyLevel.INFO,
                                    "Not Detected SacveImageKernel File!");
                useCppKernelSave = false;
            }

            //
            imageQueue     = new Queue <SaveImageInfo>();
            timer          = new System.Timers.Timer();
            timer.Enabled  = true;
            timer.Interval = 1000;
            timer.Elapsed += CheckDiskSizeFunc;
            //配置保存图像参数
            ConfigParam();
            if (!CheckRootPathExit(saveRootPath))
            {
                isSaveImage = false;
            }
            else
            {
                if (isCheckDiskSize)
                {
                    timer.Start();
                }
            }

            saveImageThread = new Thread(SaveImageFunc);
            saveImageThread.IsBackground = true;
            saveImageThread.Start();
        }