コード例 #1
0
ファイル: Defer.cs プロジェクト: Debug-/gtadotnet
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: Defer.cs プロジェクト: Debug-/gtadotnet
        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);
            }
        }