protected void Execute(Action action, string groupName = "", float delay = 0f, bool stopOnTimeScale = false)
    {
        //Debug.Log("Added item to thread with delay: " + delay);
        lock (Lock)
        {
            var neww = new ThreadAction
            {
                Action          = action,
                IsReady         = false,
                StopOnTimeScale = stopOnTimeScale,
                GroupName       = groupName
            };

            if (delay <= 0f)
            {
                neww.IsReady = true;
            }
            else
            {
                neww.Start(delay);
            }

            _actions.Add(neww);
        }
    }
 public override void OnThreadFinished(ThreadAction threadAction)
 {
     if(isFinishing)
     {
         return;
     }
     ThreadAction action = new ThreadAction(threadAction.DoCallback);
     action.SignalFinishedCallback = threadAction.SignalFinishedCallback;
     action.Start();
 }
 public override void OnThreadFinished(ThreadAction threadAction)
 {
     if (isFinishing || ThreadAction.AllCanceled)
     {
         return;
     }
     ThreadAction action = new ThreadAction(threadAction.DoCallback);
     action.SignalFinishedCallback = threadAction.SignalFinishedCallback;
     this.threadActions.Add(action);
     action.Start();
 }
        public override void OnThreadFinished(ThreadAction threadAction)
        {
            if (isFinishing)
            {
                return;
            }
            ThreadAction action = new ThreadAction(threadAction.DoCallback);

            action.SignalFinishedCallback = threadAction.SignalFinishedCallback;
            action.Start();
        }
示例#5
0
        /// <summary>
        /// deserialize a file to be used in the scenario
        /// </summary>
        /// <param name="filename"></param>
        public void Deserialize(string filename)
        {
            XmlSerializer xd = new XmlSerializer(typeof(Scenario));

            using (StreamReader rd = new StreamReader(filename))
            {
                Scenario scenario = xd.Deserialize(rd) as Scenario;

                Airports = sce­nario.Airports;
                foreach (Airport airport in Airports)
                {
                    airport.Reviver(this);
                }

                AirportNotifier();
                ThreadAction.Start();
            }
        }