public static void ApplicationRun() { Console.WriteLine(MethodBase.GetCurrentMethod().ReflectedType.Name + "." + MethodBase.GetCurrentMethod().Name); Console.WriteLine("시뮬레이션 종료 : Ctrl + Q"); Console.WriteLine("예외 처리 테스트 : Ctrl + X"); Console.WriteLine("컴포넌트 활성/비활성: E"); Scene scene = new Scene(); SimulationObject simObj = null; LifecycleUserComponent lcCom = null; for (int i = 0; i < 2; i++) { simObj = scene.AddObject(); simObj.Name = "Obj" + i.ToString(); lcCom = simObj.AddComponent <LifecycleUserComponent>(); } AsyncScheduler sc = new AsyncScheduler(); sc.AddRepetitionTask(new Action(() => { if (true == ConsoleKeyboard.IsKeyDown(ConsoleKey.X) && true == ConsoleKeyboard.IsKeyDown(ConsoleModifiers.Control)) { Console.WriteLine("예외(Exception) 처리를 테스트합니다."); Console.WriteLine("{0:H}", 0); } if (true == ConsoleKeyboard.IsKeyDown(ConsoleKey.E)) { Console.WriteLine("컴포넌트를 활성/비활성화합니다."); Application.Current.Scheduler.Run(() => { lcCom.Enabled = !lcCom.Enabled; }); } })); app = new Application(); app.UnhandledException += App_UnhandledExceptionHandler; app.Scheduler = sc; scene.AddSubSystem(new UserSubsystem()); app.LoadScene(scene); app.Start(); bool isRun = true; while (true == isRun) { if (true == ConsoleKeyboard.IsKeyDown(ConsoleKey.Q) && true == ConsoleKeyboard.IsKeyDown(ConsoleModifiers.Control)) { Console.WriteLine("시뮬레이션 엔진을 종료합니다."); isRun = false; } Thread.Sleep(16); } app.Stop(); }
public static void SchedulerAsyncTest() { Application a = new Application(); Scene s = new Scene(); a.LoadScene(s); AsyncScheduler sc = new AsyncScheduler(); a.Scheduler = sc; a.Start(); Console.WriteLine(sc.HasThreadAccess); a.Stop(); }
public AsyncGlyphScheduler(Func <TDelegate, T> delegateToTaskFunc, Func <T, TParam, CancellationToken, Task> awaitableSelector) : base(new AsyncScheduler <T, TParam>(awaitableSelector), delegateToTaskFunc) { _scheduler = (AsyncScheduler <T, TParam>)Scheduler; }
public AsynchronizerFuture(AsyncScheduler scheduler, IFuture innerFuture) { this.scheduler = scheduler; this.innerFuture = innerFuture; }