static void Update(PlayModeStateChange state) { if (state == PlayModeStateChange.ExitingPlayMode) { TaskRunner.Dispose(); } }
public override void Dispose() { if (_taskRunner != null) { _taskRunner.Dispose(); } base.Dispose(); }
public static void StopAndCleanupAllDefaultSchedulers() { ExtraLean.BoxtopiaSchedulers.UIScheduler.Dispose(); ExtraLean.BoxtopiaSchedulers.InputScheduler.Dispose(); ExtraLean.BoxtopiaSchedulers.CharacterUpdateScheduler.Dispose(); ExtraLean.BoxtopiaSchedulers.CharacterLateUpdateScheduler.Dispose(); Lean.BoxtopiaSchedulers.UIScheduler.Dispose(); Lean.BoxtopiaSchedulers.UserScheduler.Dispose(); Lean.BoxtopiaSchedulers.ResourceScheduler.Dispose(); TaskRunner.Dispose(); }
//protected override bool ProcessDialogKey(Keys keyData) //{ // if (keyData == Keys.Escape || keyData == Keys.Enter) // { // Wizard.DialogResult = DialogResult.OK; // return true; // } // return base.ProcessDialogKey(keyData); //} void hostForm_FormClosing(object sender, FormClosingEventArgs e) { if (Wizard == null) { // not the active page return; } bool mustClose = true; if (_runner != null && BkgTask != null) { if (BkgTask != null) { if (BkgTask.IsFinished) { mustClose = !Wizard.RepeatWizard; } else { mustClose = _runner.Cancel(); } } if (mustClose) { _runner.Dispose(); _runner = null; } else if (FinishPageExit != null) { FinishPageExit(this, e); } } e.Cancel = !mustClose; }
public void Start_TimerMustBeDisposedAfterTaskRunWhenOnlyOnceIsFalse() { ITask task = Substitute.For <ITask>(); IDateTimeProvider dateTimeProvider = Substitute.For <IDateTimeProvider>(); DateTime utcNow = new DateTime(2005, 2, 18); TimerStub timer = new TimerStub(utcNow, 1000); timer.Elapsed += (sender, args) => { Assert.IsTrue(timer.Started); }; TaskRunner taskRunner = new TaskRunner(task, 1, dateTimeProvider, timer, false, false, false); taskRunner.Start(); Assert.IsTrue(timer.Started); Stopwatch sw = Stopwatch.StartNew(); const int timeout = 10 * 1000; while (timer.StartCallCount < 2 && sw.ElapsedMilliseconds < timeout) { } sw.Stop(); taskRunner.Stop(); Assert.IsTrue(timer.Stoped); Assert.IsFalse(timer.IsRunning); taskRunner.Dispose(); }
public void TestCleanUp() { _taskRunner.Dispose(); }