示例#1
0
 /// <summary>
 /// Disposes all loading processes.
 /// </summary>
 private void DisposeLoader()
 {
     // Cancel all game loaders.
     gameLoaders.ForEach(p => p.RevokeTask(true));
     gameLoaders.Clear();
     // Dispose game loader
     if (gameLoader != null)
     {
         gameLoader.RevokeTask(true);
         gameLoader = null;
     }
 }
示例#2
0
        public void TestRevoke()
        {
            var tasks = new List <ITask>()
            {
                new ManualTask(),
                new MultiTask(new List <ITask>()
                {
                    new ManualTask(),
                    new ManualTask()
                })
            };

            var task = new MultiTask(tasks);

            task.StartTask();
            Assert.IsTrue(task.IsFinished);

            task.RevokeTask(true);
            Assert.IsTrue(task.IsRevoked.Value);
            Assert.IsTrue((tasks[0] as ManualTask).IsRevoked.Value);
            Assert.IsTrue((tasks[1] as MultiTask).IsRevoked.Value);
            Assert.IsTrue(((tasks[1] as MultiTask).Tasks[0] as ManualTask).IsRevoked.Value);
            Assert.IsTrue(((tasks[1] as MultiTask).Tasks[1] as ManualTask).IsRevoked.Value);
        }