Esempio n. 1
0
        private void OnError(Exception ex, IT.TaskScheduler scheduler)
        {
            var d = Error;

            if (d != null)
            {
                d(this, new ErrorHandlerAgs(ex, scheduler));
            }
        }
Esempio n. 2
0
        private async TT.Task UpdateLoop(IT.TaskScheduler scheduler)
        {
            _isAlive = true;
            while (_isAlive)
            {
                try
                {
                    scheduler.Update();

                    var delayMilliseconds = scheduler.IsActive ? 5 : 50;
                    await TT.Task.Delay(delayMilliseconds).ConfigureAwait(false);

                    // ↑Delay なし、専用スレッドで回りっぱなしとかがいいかもしれないし。
                }
                catch (Exception ex)
                {
                    HasError = true;
                    OnError(ex);
                }
            }
        }
Esempio n. 3
0
        private async TT.Task UpdateLoop(IT.TaskScheduler scheduler)
        {
            while (!_cts.IsCancellationRequested)
            {
                try
                {
                    var delayMilliseconds = scheduler.IsActive ? 5 : 50;
                    try
                    {
                        await TT.Task.Delay(delayMilliseconds, _cts.Token).ConfigureAwait(false);
                    }
                    catch (TT.TaskCanceledException) { }
                    // ↑Delay なし、専用スレッドで回りっぱなしとかがいいかもしれないし。

                    scheduler.Update();
                }
                catch (Exception ex)
                {
                    HasError = true;
                    OnError(ex);
                }
            }
        }
Esempio n. 4
0
 public ErrorHandlerAgs(Exception error, IT.TaskScheduler scheduler)
 {
     Error     = error;
     Scheduler = scheduler;
 }
Esempio n. 5
0
 public void Remove(IT.TaskScheduler s)
 {
     _schedulers = _schedulers.Remove(s);
 }
Esempio n. 6
0
 public void Add(IT.TaskScheduler s)
 {
     _schedulers = _schedulers.Add(s);
 }
Esempio n. 7
0
 public TaskRunner(IT.TaskScheduler scheduler)
 {
     Scheduler = scheduler;
     _task     = UpdateLoop(scheduler);
 }
Esempio n. 8
0
 internal ErrorHandlerAgs(Exception error, IT.TaskScheduler scheduler)
 {
     Error = error;
     Scheduler = scheduler;
 }