/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void fileWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            if (this.licenseFileOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            {
                LoggerEx logEx = new LoggerEx(log);
                try
                {
                    fileWatcher.EnableRaisingEvents = false;
                    try
                    {
                        if (e.ChangeType == WatcherChangeTypes.Changed)
                        {
                            uint resultErr = 0;

                            byte[] bteLic;
                            if (File.Exists(strPathLic))
                            {
                                Thread.Sleep(1000);
                                FileStream files = File.Open(strPathLic, FileMode.Open, FileAccess.Read, FileShare.Read);
                                if (files.Length != 0)
                                {
                                    byte[] btemp = new byte[files.Length];
                                    files.Read(btemp, 0, btemp.Length);
                                    bteLic = btemp;
                                }
                                else
                                {
                                    bteLic = new byte[0];
                                }
                                files.Close();
                            }
                            else
                            {
                                byte[] b = new byte[0];
                                bteLic = b;
                            }
                            CLicenseManagedAdapter licMan = new CLicenseManagedAdapter();
                            SmcErr smcErr = Convert2ErrNo(licMan.ActivateLicenseKey(bteLic, ref resultErr));
                        }
                        GetControlLicItem(null);
                    }
                    catch (System.Exception ex)
                    {
                        logEx.Error("fileWatcher_Changed Exception:{0}", ex.ToString());
                    }
                    finally
                    {
                        fileWatcher.EnableRaisingEvents = true;
                    }
                }
                finally
                {
                    this.licenseFileOperateLock.ExitWriteLock();
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void fileWatcher_Deleted(object sender, FileSystemEventArgs e)
        {
            if (this.licenseFileOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            {
                LoggerEx logEx = new LoggerEx(log);
                try
                {
                    fileWatcher.EnableRaisingEvents = false;
                    if (e.ChangeType == WatcherChangeTypes.Deleted)
                    {
                        uint   resultErr = 0;
                        byte[] bteLic;
                        if (File.Exists(strPathLic))
                        {
                            bteLic = File.ReadAllBytes(strPathLic);
                        }
                        else
                        {
                            byte[] b = new byte[0];
                            bteLic = b;
                            int licCountNew = 0;
                            if (licCount != licCountNew)
                            {
                                SessionManage.Instance().RemoveAllSession();
                                logEx.Trace("License have changed! the New Count is:{0}, the Old Count:{1} ", licCountNew.ToString(), licCount.ToString());
                                licCount = licCountNew;
                            }
                        }
                        CLicenseManagedAdapter licMan = new CLicenseManagedAdapter();
                        SmcErr smcErr = Convert2ErrNo(licMan.ActivateLicenseKey(bteLic, ref resultErr));
                    }
                    fileWatcher.EnableRaisingEvents = true;
                }

                catch (Exception ex)
                {
                    logEx.Error("fileWatcher_Deleted Exception:{0}", ex.ToString());
                }
                finally
                {
                    this.licenseFileOperateLock.ExitWriteLock();
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void fileWatcher_Created(object sender, FileSystemEventArgs e)
 {
     if (this.licenseFileOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
     {
         LoggerEx logEx = new LoggerEx(log);
         try
         {
             fileWatcher.EnableRaisingEvents = false;
             if (e.ChangeType == WatcherChangeTypes.Created)
             {
                 uint   resultErr = 0;
                 byte[] bteLic;
                 if (File.Exists(strPathLic))
                 {
                     Thread.Sleep(1000);
                     bteLic = File.ReadAllBytes(strPathLic);
                 }
                 else
                 {
                     byte[] b = new byte[0];
                     bteLic = b;
                 }
                 CLicenseManagedAdapter licMan = new CLicenseManagedAdapter();
                 SmcErr smcErr = Convert2ErrNo(licMan.ActivateLicenseKey(bteLic, ref resultErr));
             }
             fileWatcher.EnableRaisingEvents = true;
         }
         catch (Exception ex)
         {
             logEx.Error("fileWatcher_Created Exception:{0}", ex.ToString());
         }
         finally
         {
             this.licenseFileOperateLock.ExitWriteLock();
         }
     }
 }