static SC_ACTION GetScAction(ServiceRecoveryAction action,
                                     uint restartServiceAfter)
        {
            var            scAction   = new SC_ACTION();
            SC_ACTION_TYPE actionType = default(SC_ACTION_TYPE);

            switch (action)
            {
            case ServiceRecoveryAction.TakeNoAction:
                actionType = SC_ACTION_TYPE.None;
                break;

            case ServiceRecoveryAction.RestartService:
                actionType = SC_ACTION_TYPE.RestartService;
                break;

            case ServiceRecoveryAction.RestartComputer:
                actionType = SC_ACTION_TYPE.RebootComputer;
                break;

            case ServiceRecoveryAction.RunProgram:
                actionType = SC_ACTION_TYPE.RunCommand;
                break;
            }
            scAction.Type  = actionType;
            scAction.Delay = restartServiceAfter;
            return(scAction);
        }
Example #2
0
 public SC_ACTION(SC_ACTION_TYPE type, TimeSpan delay)
 {
     this.Type = type;
     this.Delay = (uint)delay.TotalMilliseconds;
 }
Example #3
0
        public SC_ACTION(SC_ACTION_TYPE type, TimeSpan delay)
        {
            Type = type;

            Delay = (uint)delay.TotalMilliseconds;
        }
Example #4
0
 public SC_ACTION(SC_ACTION_TYPE type, TimeSpan delay)
 {
     this.Type  = type;
     this.Delay = (int)delay.TotalMilliseconds;
 }
 public SC_ACTION(SC_ACTION_TYPE action, int delayMillisec)
 {
     this.Type = action;
     this.Delay = (UInt32)delayMillisec;
 }
 public SC_ACTION(SC_ACTION_TYPE type, uint delay) : this()
 {
     this.Type  = type;
     this.Delay = delay;
 }