示例#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
            }
        }
示例#2
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
            }
        }
示例#3
0
 public static ScanAction Singleton(DirectoryInfo appPath)
 {
     if (obj == null)
     {
         obj = new ScanAction(appPath);
     }
     return(obj);
 }
示例#4
0
 public static ScanAction Singleton(DirectoryInfo appPath)
 {
     if (obj == null)
     {
         obj = new ScanAction(appPath);
     }
     return obj;
 }