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); }
public void RimuoviUtente(string utente) { if (_blacklist.EliminaUtenteCattivo(utente)) { //Creazione del parametro da passare quando scateno l'evento ActionCompletedEvent args = new ActionCompletedEvent { ToEntry = EntryFactory.CreateEntry(this, "rimosso", utente) }; //scateno gli handler registrati all'evento PersistEvent toPersist = new PersistEvent { Action = "rimuovi", ToPersist = utente }; //scateno gli handler registrati all'evento ToLog?.Invoke(this, args); Persist?.Invoke(this, toPersist); } else { //Creazione del parametro da passare quando scateno l'evento ActionCompletedEvent args = new ActionCompletedEvent { ToEntry = EntryFactory.CreateEntry(this, "nonrimosso", utente) }; //scateno gli handler registrati all'evento ToLog?.Invoke(this, args); } }
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); }
public void AggiungiUtente(string utente) { if (_blacklist.AggiungiUtenteCattivo(utente)) { //Col fatto che questa viene chiamata dal thread della sincronizzazione va //Risolto con l'escamotage _blacklistView.AddRow(utente); //_blacklistView.DataGridViewBlacklist.Rows.Add(utente); //Creazione del parametro da passare quando scateno l'evento ActionCompletedEvent args = new ActionCompletedEvent { ToEntry = EntryFactory.CreateEntry(this, "aggiunto", utente) }; PersistEvent toPersist = new PersistEvent { Action = "aggiungi", ToPersist = utente }; //scateno gli handler registrati all'evento ToLog?.Invoke(this, args); Persist?.Invoke(this, toPersist); } else { //Creazione del parametro da passare quando scateno l'evento ActionCompletedEvent args = new ActionCompletedEvent { ToEntry = EntryFactory.CreateEntry(this, "nonaggiunto", utente) }; //scateno gli handler registrati all'evento ToLog?.Invoke(this, args); } }