Example #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);
        }
Example #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);
        }
Example #3
0
 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);
     }
 }
Example #4
0
 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);
     }
 }
Example #5
0
        public void Update(object sender, EventArgs e)
        {
            ActionCompletedEvent param = (ActionCompletedEvent)e;

            ScriviEntry(param.ToEntry);
            _logPersistence.ScriviLog(_log);
        }
Example #6
0
        private void OnCastCard(ActionCompletedEvent <CastCardCommand> evt)
        {
            GameCard   card  = evt.Action.CastedCard;
            Spell      spell = evt.Action.CastedSpell;
            int        xpos  = XPosFromPlayer(card.Owner);
            int        ypos  = YPosFromPlayer(card.Owner);
            GameObject gobj  = this.Factory.GameObjectFromModel(card);

            Factory.TransformCardToSpell(gobj, spell);
            var spellview = gobj.GetComponent <GuiSpellViewHandler>();
            var vec3      = Factory.ConvertPos(new Point(xpos, ypos));

            vec3.z += +1.5f - ZPosFromPlayer(card.Owner);
            var scale = gobj.transform.localScale;

            scale.x = scale.x * 10;
            scale.y = scale.y * 10;
            scale.z = scale.z * 10;
            gobj.transform.localScale = scale;
            spellview.FlyToPos        = vec3;

            playersCardStack.Add(card.Owner, spell);


            //gobj.c
        }
Example #7
0
 private void OnUnitFinishPathMove(ActionCompletedEvent <MovePathAction> evt)
 {
     if (this.currentGObjAni == null)
     {
         this.graphics.UseUnitAnimation(StandardUnitAnimations.Idle);
     }
     else
     {
         this.currentGObjAni.Completed += (_, _1) => this.graphics.UseUnitAnimation(StandardUnitAnimations.Idle);
     }
 }
Example #8
0
        private void OnCastCard(ActionCompletedEvent<CastCardCommand> evt)
        {
            GameCard card = evt.Action.CastedCard;
            Spell spell = evt.Action.CastedSpell;
            int xpos = XPosFromPlayer(card.Owner);
            int ypos = YPosFromPlayer(card.Owner);
            GameObject gobj = this.Factory.GameObjectFromModel(card);
            Factory.TransformCardToSpell(gobj,spell);
            var spellview = gobj.GetComponent<GuiSpellViewHandler>();
            var vec3 = Factory.ConvertPos(new Point(xpos, ypos));
            vec3.z += +1.5f - ZPosFromPlayer(card.Owner);
            var scale = gobj.transform.localScale;
            scale.x = scale.x * 10;
            scale.y = scale.y * 10;
            scale.z = scale.z * 10;
            gobj.transform.localScale = scale;
            spellview.FlyToPos = vec3;

            playersCardStack.Add(card.Owner, spell);

            //gobj.c
        }
 private void OnCastCard(ActionCompletedEvent<CastCardCommand> evt)
 {
     GameCard card = evt.Action.CastedCard;
     removeCard(card);
 }
Example #10
0
 private void OnUnitFinishPathMove(ActionCompletedEvent<MovePathAction> evt)
 {
     if (this.currentGObjAni == null)
         this.graphics.UseUnitAnimation(StandardUnitAnimations.Idle);
     else
         this.currentGObjAni.Completed += (_, _1) => this.graphics.UseUnitAnimation(StandardUnitAnimations.Idle);
 }
Example #11
0
        private void OnCastCard(ActionCompletedEvent <CastCardCommand> evt)
        {
            GameCard card = evt.Action.CastedCard;

            removeCard(card);
        }