/// <summary> /// Constructor /// </summary> /// <param name="options"></param> public SimpleQueue(Action <SimpleQueueOptions> options) { #if NETSTANDARD _options = ServiceProvider?.GetService <IOptionsMonitor <SimpleQueueOptions> >().CurrentValue ?? new SimpleQueueOptions(); #else _options = new SimpleQueueOptions(); #endif options?.Invoke(_options); if ((_options.QueueTriggerType & QueueTriggerType.Count) == QueueTriggerType.Count) { if (_options.CountLimit <= 0) { throw new Exception($"The value of {nameof(_options.CountLimit)} must be greater than 0."); } } if ((_options.QueueTriggerType & QueueTriggerType.Timer) == QueueTriggerType.Timer) { if (_options.TimerInterval <= 0) { throw new Exception($"The value of {nameof(_options.TimerInterval)} must be greater than 0."); } _timer = new TimerExt(_options.TimerInterval, disallowConcurrentExecution: false) { Execute = TimerExecute }; _timer.Start(); } }
public DialogueLabel() { InitializeComponent(); _characterTickTimer = new TimerExt(CharacterTimerTick, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(30)); }