コード例 #1
0
ファイル: RecurentAction.cs プロジェクト: massreuy/3P
        /// <summary>
        /// Start a new recurrent action
        /// </summary>
        public static RecurentAction StartNew(Action actionToDo, long interval, int nbRepeat = 0, bool doActionOnCreate = true)
        {
            var created = new RecurentAction(actionToDo, interval, nbRepeat, doActionOnCreate);

            _savedReccurentActionStarted.Add(created);
            return(created);
        }
コード例 #2
0
ファイル: UpdateHandler.cs プロジェクト: koelblinger/3P
 /// <summary>
 /// ASYNC - Call this method to start checking for updates every 2 hours, also check once immediately if
 /// Config.Instance.TechnicalCheckUpdateEveryXMin condition is met
 /// </summary>
 public void StartCheckingForUpdate()
 {
     // check for updates every now and then
     CheckRegularlyAction = RecurentAction.StartNew(() => {
         // Check for new updates
         if (!Config.Instance.GlobalDontCheckUpdates)
         {
             CheckForUpdate(false);
         }
     }, 1000 * 60 * Config.UpdateCheckEveryXMin, 0, Utils.IsLastCallFromMoreThanXMinAgo(UpdatedSoftName + "update", Config.UpdateCheckEveryXMin));
 }
コード例 #3
0
ファイル: UpdateHandler.cs プロジェクト: massreuy/3P
        /// <summary>
        /// ASYNC - Call this method to start checking for updates every 2 hours, also check once immediately if
        /// Config.Instance.TechnicalCheckUpdateEveryXMin condition is met
        /// </summary>
        public static void StartCheckingForUpdate()
        {
            // check for updates every now and then (2h)
            DateTime lastCheck;

            if (!DateTime.TryParseExact(Config.Instance.TechnicalLastCheckUpdate, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out lastCheck))
            {
                lastCheck = DateTime.MinValue;
            }
            _checkEveryHourAction = RecurentAction.StartNew(() => {
                // Check for new updates
                if (!Config.Instance.GlobalDontCheckUpdates)
                {
                    CheckForUpdate(true);
                }
            }, 1000 * 60 * 120, 0, DateTime.Now.Subtract(lastCheck).TotalMinutes > Config.Instance.TechnicalCheckUpdateEveryXMin);
        }