Exemplo n.º 1
0
 private void AddTaskTimer(TFSServicesTypes.Rule pRule, string pOperation)
 {
     TaskTimers.Add(new TaskTimer {
         Rule = pRule, Timer = new Timer(StartTask, pRule.id, GetShiftRun(pRule), GetStepRun(pRule))
     });
     WriteLog(String.Format("Rule {0}: id {1}; rev {2}", pOperation, pRule.id, pRule.rev));
 }
Exemplo n.º 2
0
        int GetStepRun(TFSServicesTypes.Rule pRule)
        {
            int _ret_val = 0;

            switch (pRule.period)
            {
            case 0:
                _ret_val = pRule.step * 60000;     //minutes
                break;

            case 1:
                _ret_val = pRule.step * 60 * 60000;     //hours
                break;
            }

            return(_ret_val);
        }
Exemplo n.º 3
0
        int GetShiftRun(TFSServicesTypes.Rule pRule)
        {
            int _ret_val   = 0;
            int _cur_mins  = DateTime.Now.Minute;
            int _cur_hours = DateTime.Now.Hour;

            switch (pRule.period)
            {
            case 0:
                _ret_val = ((60 - _cur_mins) % pRule.step) * 60000;     // minutes
                break;

            case 1:
                _ret_val = (((24 - _cur_hours) % pRule.step) * 60 + 60 - _cur_mins) * 60000;     //hours
                break;
            }

            return(_ret_val);
        }