public void CambiaStato()
 {
     _state                   = _state.CambiaStato();
     _state.Associated       += DocumentAssociated;
     _state.RequisitoAdded   += AddRequisito;
     _state.RequisitoRemoved += RemoveRequisito;
 }
 protected DocumentoGenerico()
 {
     _requisiti               = new List <RequisitoPersonale>();
     _associazioni            = new List <Associazione>();
     _state                   = Stato.InitState();
     _state.Associated       += DocumentAssociated;
     _state.RequisitoAdded   += AddRequisito;
     _state.RequisitoRemoved += RemoveRequisito;
 }
Ejemplo n.º 3
0
        public static Stato InitState()
        {
            Console.WriteLine(typeof(EventHandler));
            Stato result = null;

            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (type.BaseType == typeof(Stato))
                {
                    StateAttribute[] attributes = (StateAttribute[])type.GetCustomAttributes(typeof(StateAttribute), true);
                    if (attributes.Length != 0 && attributes[0].Label)
                    {
                        result = (Stato)Activator.CreateInstance(type);
                        break;
                    }
                }
            }
            return(result);
            //return new Attivo();
        }