Example #1
0
 public ComponentModel(
     string id,
     IEnumerable<ServiceModel> services,
     string limitTypeId,
     IDictionary<string, string> metadata,
     string targetComponentId,
     OwnershipModel ownership,
     SharingModel sharing,
     LifetimeModel lifetime,
     ActivatorModel activator)
 {
     if (id == null) throw new ArgumentNullException("id");
     if (services == null) throw new ArgumentNullException("services");
     if (limitTypeId == null) throw new ArgumentNullException("limitTypeId");
     if (metadata == null) throw new ArgumentNullException("metadata");
     if (targetComponentId == null) throw new ArgumentNullException("targetComponentId");
     _id = id;
     _limitTypeId = limitTypeId;
     _metadata = new Dictionary<string,string>(metadata);
     _services = services.ToArray();
     _targetComponentId = targetComponentId;
     _ownership = ownership;
     _sharing = sharing;
     _lifetime = lifetime;
     _activator = activator;
 }
Example #2
0
        private void OnEnable()
        {
            _activatorModel = new ActivatorModel();

            _activatorView.ActivatorModel = _activatorModel;
            _activatorView.BoxModel       = _boxController.GetModel();
            _activatorView.GeneratorModel = _generatorController.GetModel();
            _activatorView.MovementModel  = _movementController.GetModel();


            #region Activator View Callback

            _activatorView.OnAddHeigtOfPosition = () =>
            {
                _generatorController.AddHeightPositon();
            };

            _activatorView.OnAddDeactiveBoxIndex = () =>
            {
                if (!_activatorModel.isReadytoDeactived)
                {
                    _activatorModel.isReadytoDeactived = true;
                }

                if (_activatorModel.IndexBoxDeactivated == _boxController.GetModel().ListOfBox.Count - 1)
                {
                    _activatorModel.IndexBoxDeactivated = 0;
                }
                else
                {
                    _activatorModel.IndexBoxDeactivated++;
                }
            };

            _activatorView.OnBoxActived = () =>
            {
                _activatorModel.isReadyForNewBox = false;
            };

            #endregion
            #region Movement Controller Callback

            _movementController.OnAddNewBox = () =>
            {
                if (_activatorModel.CurrentActiveBox == _boxController.GetModel().ListOfBox.Count - 1)
                {
                    _activatorModel.CurrentActiveBox = 0;
                }
                else
                {
                    _activatorModel.CurrentActiveBox++;
                }
                _activatorModel.isReadyForNewBox = true;
            };

            #endregion
        }
Example #3
0
 public Component(string id, TypeData limitType, IEnumerable<Service> services, OwnershipModel ownership, SharingModel sharing, IDictionary<string, string> metadata, ActivatorModel activator, LifetimeModel lifetime, string targetComponentId = null)
 {
     if (limitType == null) throw new ArgumentNullException("limitType");
     if (services == null) throw new ArgumentNullException("services");
     if (metadata == null) throw new ArgumentNullException("metadata");
     _id = id;
     _limitType = limitType;
     _services = services.ToArray();
     _ownership = ownership;
     _sharing = sharing;
     _metadata = metadata;
     _activator = activator;
     _lifetime = lifetime;
     _targetComponentId = targetComponentId;
 }
Example #4
0
 public ComponentModel(
     string id,
     IEnumerable <ServiceModel> services,
     string limitTypeId,
     IDictionary <string, string> metadata,
     string targetComponentId,
     OwnershipModel ownership,
     SharingModel sharing,
     LifetimeModel lifetime,
     ActivatorModel activator)
 {
     if (id == null)
     {
         throw new ArgumentNullException("id");
     }
     if (services == null)
     {
         throw new ArgumentNullException("services");
     }
     if (limitTypeId == null)
     {
         throw new ArgumentNullException("limitTypeId");
     }
     if (metadata == null)
     {
         throw new ArgumentNullException("metadata");
     }
     if (targetComponentId == null)
     {
         throw new ArgumentNullException("targetComponentId");
     }
     _id                = id;
     _limitTypeId       = limitTypeId;
     _metadata          = new Dictionary <string, string>(metadata);
     _services          = services.ToArray();
     _targetComponentId = targetComponentId;
     _ownership         = ownership;
     _sharing           = sharing;
     _lifetime          = lifetime;
     _activator         = activator;
 }
Example #5
0
 public Component(string id, TypeData limitType, IEnumerable <Service> services, OwnershipModel ownership, SharingModel sharing, IDictionary <string, string> metadata, ActivatorModel activator, LifetimeModel lifetime, string targetComponentId = null)
 {
     if (limitType == null)
     {
         throw new ArgumentNullException("limitType");
     }
     if (services == null)
     {
         throw new ArgumentNullException("services");
     }
     if (metadata == null)
     {
         throw new ArgumentNullException("metadata");
     }
     _id                = id;
     _limitType         = limitType;
     _services          = services.ToArray();
     _ownership         = ownership;
     _sharing           = sharing;
     _metadata          = metadata;
     _activator         = activator;
     _lifetime          = lifetime;
     _targetComponentId = targetComponentId;
 }