public StepExecutionService(IStepProviderService stepProviderService)
        {
            _stepProviderService = stepProviderService;

            var steps = _stepProviderService.GetAllStep();

            // TODO: It's done this way probably because _delayService is a static field...
            steps.First().OnDelay += stepDelayMilliseconds => OnDelay?.Invoke(stepDelayMilliseconds);
        }
Esempio n. 2
0
        public Step(
            IStepDelayService stepDelayService,
            IBotCheckDetectService botCheckDetectService)
        {
            _stepDelayService      = stepDelayService;
            _botCheckDetectService = botCheckDetectService;

            _stepDelayService.OnDelay += stepDelayMilliseconds => OnDelay?.Invoke(stepDelayMilliseconds);
        }
        public void Delay()
        {
            lock (_lock)
            {
                var millisecondsDelay = _minimumMilliseconds == _maximumMilliseconds ?
                                        _minimumMilliseconds :
                                        _random.Next(_minimumMilliseconds, _maximumMilliseconds);

                Thread.Sleep(millisecondsDelay);

                OnDelay?.Invoke(millisecondsDelay);
            }
        }
Esempio n. 4
0
        public string Dispatch(string s)
        {
            string rsp;

            if (s == SHUTDOWN)
            {
                OnShutdown?.Invoke();
                rsp = "Done.";
            }
            else if (s.StartsWith(STATUSCODE))
            {
                var sc = int.Parse(s.Substring(STATUSCODE.Length));
                OnForceStatusCode?.Invoke(sc);
                rsp = string.Format("Done. {0}{1}", STATUSCODE, sc);
            }
            else if (s.StartsWith(REASONPHRASE))
            {
                var rp = s.Substring(REASONPHRASE.Length);
                OnForceReasonPhrase?.Invoke(rp);
                rsp = string.Format("Done. {0}{1}", REASONPHRASE, rp);
            }
            else if (s.StartsWith(DELAY))
            {
                var ms = int.Parse(s.Substring(DELAY.Length));
                OnDelay?.Invoke(ms);
                rsp = string.Format("Done. {0}{1}", DELAY, ms);
            }
            else if (s.StartsWith(DELAYURI))
            {
                var uri = s.Substring(DELAYURI.Length);
                OnDelayUri?.Invoke(uri);
                rsp = string.Format("Done. {0}{1}", DELAYURI, uri);
            }
            else
            {
                rsp = "No such command.";
            }
            return(rsp);
        }
Esempio n. 5
0
        private void Setup()
        {
            Tag = _controls.AddForm(this);
            string tag = Tag as string;

            TimeLbl.Tag            = _controls.Add(tag, new LabelController(TimeLbl));
            DateLbl.Tag            = _controls.Add(tag, new LabelController(DateLbl));
            LastUpdatedLbl.Tag     = _controls.Add(tag, new LabelController(LastUpdatedLbl));
            StartDateLbl.Tag       = _controls.Add(tag, new LabelController(StartDateLbl));
            EndDateLbl.Tag         = _controls.Add(tag, new LabelController(EndDateLbl));
            EventCalendar.Tag      = _controls.Add(tag, new CalendarController(EventCalendar));
            EventListView.Tag      = _controls.Add(tag, new ListViewController(EventListView));
            SearchTextTb.Tag       = _controls.Add(tag, new TextBoxController(SearchTextTb));
            MessageDisplayTb.Tag   = _controls.Add(tag, new TextBoxController(MessageDisplayTb));
            EventSearchStartDp.Tag = _controls.Add(tag, new DatePickerController(EventSearchStartDp));
            EventSearchEndDp.Tag   = _controls.Add(tag, new DatePickerController(EventSearchEndDp));

            EIV.SetControls(tag, _controls, _events, EventCal.GetId());
            EIV.SetTitle("Events for Day");
            EIV.UseCrudButtons(true);

            SEIV.SetControls(tag, _controls, _events, EventCal.GetId());
            SEIV.SetTitle("Events");
            SEIV.UseCrudButtons(false);

            MMV.SetControls(tag, _controls, _messages);
            MMV.SetTitle("Messages");

            User_Time.SetText(TimeAndDateUtility.GetCurrentTimeString());
            User_Date.SetText(TimeAndDateUtility.GetCurrentDateString());

            Icon = Resources.icon;
            DateTimeIcon.Icon = Resources.icon;

            _delay = new OnDelay();
        }
Esempio n. 6
0
 public void Delay(Airplane airplane, int minutes)
 {
     OnDelay?.Invoke(minutes, airplane);
 }
Esempio n. 7
0
        public void Delay()
        {
            Thread.Sleep(_millisecondDelay);

            OnDelay?.Invoke(_millisecondDelay);
        }