public async Task Initialize <T> (T parent)
        {
            Type parentType = typeof(T);

            if (parentType == typeof(TimingService))
            {
                _parent = (TimingService)(object)parent;
            }

            _timerShort = new Timer(
                e => WriteTime("short"),
                null,
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1));
            _timerMedium = new Timer(
                e => WriteTime("medium"),
                null,
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(3));
            _timerLong = new Timer(
                e => WriteTime("long"),
                null,
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(5));
        }
示例#2
0
        public FormLineCanon()
        {
            InitializeComponent();

            _lineService        = new LineService();
            _customerService    = new CustomerService();
            _processService     = new ProcessService();
            _modelService       = new ModelService();
            _showResultService  = new ShowResultService();
            _shiftService       = new ShiftService();
            _timingService      = new TimingService();
            _lineProcessService = new LineProcessService();
        }
        public ScheduleUrl PostSave(ScheduleUrl url)
        {
            var ts = new TimingService();

            url.NextRun   = ts.GetNextRun(url);;
            url.StartFrom = DateTime.UtcNow;

            url.LastFiveOutcomes = "x,x,x,x,x";

            if (url.Id > 0)
            {
                DatabaseContext.Database.Update(url);
            }
            else
            {
                DatabaseContext.Database.Save(url);
            }

            return(url);
        }