Exemple #1
0
        public Service()
        {
            InitializeComponent();
            DirectoryInfo imagePath = GetCurrentServiceInstallPath();
            actionTimer = new Timer();
            clearTimer = new Timer();
            try
            {
                action = ScanAction.Singleton(imagePath);
            #if DEBUG
                action.Logger.Debug("InitializeComponent " + imagePath.FullName);
            #endif

                actionTimer.AutoReset = true;
                actionTimer.Enabled = false;
                actionTimer.Interval = action.Config.ScanPeriod * 1000;
                actionTimer.Elapsed += ActionTimerElapsed;

                clearTimer.AutoReset = true;
                clearTimer.Enabled = false;
                clearTimer.Interval = 86400000;
                clearTimer.Elapsed += ClearTimerElapsed;

            #if DEBUG
                action.Logger.Debug("扫描间隔 " + actionTimer.Interval.ToString());
            #endif
            }
            catch (Exception ex)
            {
            #if DEBUG
                action.Logger.Debug("Init错误 " + ex.ToString());
            #endif
            }
        }
        public Service()
        {
            InitializeComponent();
            DirectoryInfo imagePath = GetCurrentServiceInstallPath();

            actionTimer = new Timer();
            clearTimer  = new Timer();
            try
            {
                action = ScanAction.Singleton(imagePath);
#if DEBUG
                action.Logger.Debug("InitializeComponent " + imagePath.FullName);
#endif

                actionTimer.AutoReset = true;
                actionTimer.Enabled   = false;
                actionTimer.Interval  = action.Config.ScanPeriod * 1000;
                actionTimer.Elapsed  += ActionTimerElapsed;

                clearTimer.AutoReset = true;
                clearTimer.Enabled   = false;
                clearTimer.Interval  = 86400000;
                clearTimer.Elapsed  += ClearTimerElapsed;

#if DEBUG
                action.Logger.Debug("扫描间隔 " + actionTimer.Interval.ToString());
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                action.Logger.Debug("Init错误 " + ex.ToString());
#endif
            }
        }
Exemple #3
0
 public static ScanAction Singleton(DirectoryInfo appPath)
 {
     if (obj == null)
     {
         obj = new ScanAction(appPath);
     }
     return(obj);
 }
 public static ScanAction Singleton(DirectoryInfo appPath)
 {
     if (obj == null)
     {
         obj = new ScanAction(appPath);
     }
     return obj;
 }