Exemple #1
0
        bool IGestoreImpostazione.RemoveImpostazione(ImpostazioneTrasferimento impostazione)
        {
            bool toOut = _impostazioni.Remove(impostazione);

            if (toOut)
            {
                //Creazione dei parametri da passare agli handler dell'evento
                ActionCompletedEvent args = new ActionCompletedEvent
                {
                    ToEntry = EntryFactory.CreateEntry(this, "rimossa", impostazione.CartellaSorgente.Path,
                                                       impostazione.CartellaDestinazione)
                };
                PersistEvent toPersist = new PersistEvent
                {
                    Action    = "rimuovi",
                    ToPersist = impostazione
                };

                //Scateno l'evento
                ToLog?.Invoke(this, args);
                Persist?.Invoke(this, toPersist);
            }
            else
            {
                ActionCompletedEvent args = new ActionCompletedEvent
                {
                    ToEntry = EntryFactory.CreateEntry(this, "nonrimossa", impostazione.CartellaSorgente.Path,
                                                       impostazione.CartellaDestinazione)
                };
                ToLog?.Invoke(this, args);
            }
            return(toOut);
        }
Exemple #2
0
        public bool AddImpostazione(ImpostazioneTrasferimento impostazione)
        {
            bool toOut = _impostazioni.Add(impostazione);

            //Il log cambia a seconda dell'esito
            if (toOut)
            {
                //Creazione del parametro da passare quando scateno l'evento
                ActionCompletedEvent args = new ActionCompletedEvent
                {
                    ToEntry = EntryFactory.CreateEntry(this, "aggiunta", sorgente: impostazione.CartellaSorgente.Path,
                                                       destinazione: impostazione.CartellaDestinazione)
                };
                PersistEvent toPersist = new PersistEvent
                {
                    ToPersist = impostazione,
                    Action    = "aggiungi"
                };
                //scateno gli handler registrati all'evento
                ToLog?.Invoke(this, args);
                Persist?.Invoke(this, toPersist);
            }
            else
            {
                ActionCompletedEvent args = new ActionCompletedEvent
                {
                    ToEntry = EntryFactory.CreateEntry(this, "nonaggiunta", impostazione.CartellaSorgente.Path,
                                                       impostazione.CartellaDestinazione)
                };
                ToLog?.Invoke(this, args);
            }
            return(toOut);
        }
Exemple #3
0
        public override bool Equals(object obj)
        {
            ImpostazioneTrasferimento otherSetting = (ImpostazioneTrasferimento)obj;

            return(CartellaSorgente.Path.Equals(otherSetting.CartellaSorgente.Path) &&
                   CartellaDestinazione.Equals(otherSetting.CartellaDestinazione));
        }