public Defer() { Actions = new List<Action>(); Tick += new EventHandler(Defer_OnTick); for (int i = 0; i < 5; i++) { var ds = new DeferredScript(); Workers.Add(ds); ScriptLoader.LoadScript(ds); } }
public Defer() { Actions = new List <Action>(); Tick += new EventHandler(Defer_OnTick); for (int i = 0; i < 5; i++) { var ds = new DeferredScript(); _workers.Add(ds); ScriptLoader.LoadScript(ds); } }
public static void DeferScript(Action action) { //Actions.Add(action); bool assigned = false; foreach (var worker in _workers) { if (worker.Busy) { continue; } //worker.Source = new System.Diagnostics.StackTrace().GetFrame(0); var trace = new System.Diagnostics.StackTrace(); foreach (var frame in trace.GetFrames()) { var method = frame.GetMethod(); if (method.Name.Equals("DeferScript")) { continue; } worker.Source = string.Format("{0}::{1}", method.ReflectedType != null ? method.ReflectedType.Name : string.Empty, method.Name); break; } worker.Assign(action); assigned = true; break; } if (!assigned) { var ds = new DeferredScript(); _workers.Add(ds); ScriptLoader.LoadScript(ds); ds.Assign(action); } }
public static void DeferScript(Action action) { //Actions.Add(action); bool assigned = false; foreach (var worker in Workers) { if (worker.Busy) { continue; } //worker.Source = new System.Diagnostics.StackTrace().GetFrame(0); var trace = new System.Diagnostics.StackTrace(); foreach (var frame in trace.GetFrames()) { var method = frame.GetMethod(); if (method.Name.Equals("DeferScript")) continue; worker.Source = string.Format("{0}::{1}", method.ReflectedType != null ? method.ReflectedType.Name : string.Empty, method.Name); break; } worker.Assign(action); assigned = true; break; } if (!assigned) { var ds = new DeferredScript(); Workers.Add(ds); ScriptLoader.LoadScript(ds); ds.Assign(action); } }