示例#1
0
        public string RouteAction(string action, object args)
        {
            if (string.IsNullOrEmpty(action))
            {
                return(string.Format(CultureInfo.InvariantCulture, Properties.Resources.FMT_SCH_ERROR,
                                     Properties.Resources.MSG_INVALID_ACTION));
            }
            if (args == null)
            {
                return(string.Format(CultureInfo.InvariantCulture, Properties.Resources.FMT_SCH_ERROR,
                                     Properties.Resources.MSG_INVALID_ARGS));
            }

            switch (action)
            {
            case DELAY:
                int seconds = (int)args;
                using (var delay = new WaitTimer(false, false)) {
                    delay.WaitOne(seconds * 1000);
                }
                break;

            default:
                return("SCHEDULE Unknown Action!");
            }

            return(string.Format(CultureInfo.InvariantCulture, "SCHEDULE {0}", Properties.Resources.MSG_OK));
        }