Example #1
0
 public void execute()
 {
     try
     {
         action.Invoke();
     }
     catch (BehaviorBlacklistException bbe)
     {
         SimObjectErrorManager.AddError(BehaviorFactory.createError(bbe));
     }
     catch (Exception e)
     {
         behavior._unanticipatedBlacklistError(e);
         SimObjectErrorManager.AddError(BehaviorFactory.createError(behavior, e));
     }
 }
        /// <summary>
        /// This function will be called when all subsystems have created their
        /// products. At this time it is safe to discover objects present in
        /// other subsystems.
        /// </summary>
        public void linkProducts()
        {
            //Constructed
            foreach (BehaviorFactoryEntry entry in currentBehaviors)
            {
                try
                {
                    entry.constructed();
                }
                catch (BehaviorBlacklistException bbe)
                {
                    SimObjectErrorManager.AddError(createError(bbe));
                }
                catch (Exception e)
                {
                    entry._unanticipatedBlacklistError(e);
                    SimObjectErrorManager.AddError(createError(entry, e));
                }
            }

            //Link
            foreach (BehaviorFactoryEntry entry in currentBehaviors)
            {
                try
                {
                    entry.linkupProducts();
                }
                catch (BehaviorBlacklistException bbe)
                {
                    SimObjectErrorManager.AddError(createError(bbe));
                }
                catch (Exception e)
                {
                    entry._unanticipatedBlacklistError(e);
                    SimObjectErrorManager.AddError(createError(entry, e));
                }
            }

            //Late Link
            foreach (var action in manager.LateLinkActions)
            {
                action.execute();
            }
            manager.clearLateLinkActions();
        }