Exemplo n.º 1
0
        public void AggiungiSequenza(PersisterMapper <Sequenza> sequenza)
        {
            string nomeFile = _base + sequenza.Element.Nome + "_" + Documento.getInstance().ModelloRiferimento.ToString() + ".seq";

            if (sequenza.ID >= 0 && sequenza.ID < _sequenze.Count)
            {
                _sequenze.RemoveAt(sequenza.ID);
                _sequenze.Insert(sequenza.ID, sequenza.Element);
            }
            else
            {
                if (!Overwrite(nomeFile))
                {
                    return;
                }
                _sequenze.Add(sequenza.Element);
            }

            using (BinaryWriter bw = new BinaryWriter(new FileStream(nomeFile, FileMode.Create)))
            {
                PersisterFactory.GetPersister(PersisterFactory.SEQUENZA).Save(sequenza.Element, bw);
            }

            LibreriaChange?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        public void AggiungiProgrGiornaliera(PersisterMapper <ProgrammazioneGiornaliera> progrGiornaliera)
        {
            string nomeFile = _base + progrGiornaliera.Element.Nome + "_" + Documento.getInstance().ModelloRiferimento.ToString() + ".prg";

            if (progrGiornaliera.ID >= 0 && progrGiornaliera.ID < _progrGiornaliere.Count)
            {
                _progrGiornaliere.RemoveAt(progrGiornaliera.ID);
                _progrGiornaliere.Insert(progrGiornaliera.ID, progrGiornaliera.Element);
            }
            else
            {
                if (!Overwrite(nomeFile))
                {
                    return;
                }
                _progrGiornaliere.Add(progrGiornaliera.Element);
            }

            using (BinaryWriter bw = new BinaryWriter(new FileStream(nomeFile, FileMode.Create)))
            {
                PersisterFactory.GetPersister(progrGiornaliera.Element.GetType()).Save(progrGiornaliera.Element, bw);
            }

            LibreriaChange?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 3
0
        public void EliminaProgrGiornaliera(int index)
        {
            string nomeFile = _base + _progrGiornaliere[index].Nome + "_" + Documento.getInstance().ModelloRiferimento.ToString() + ".prg";

            try
            {
                File.Delete(nomeFile);
            }
            catch
            {
            }
            _progrGiornaliere.RemoveAt(index);
            LibreriaChange?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 4
0
        public void EliminaSequenza(int index)
        {
            string nomeFile = _base + _sequenze[index].Nome + "_" + Documento.getInstance().ModelloRiferimento.ToString() + ".seq";

            try
            {
                File.Delete(nomeFile);
            }
            catch
            {
            }
            _sequenze.RemoveAt(index);
            LibreriaChange?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 5
0
        public void EliminaAnimazione(int index)
        {
            string nomeFile = _base + _animazioni[index].Nome + "_" + Documento.getInstance().ModelloRiferimento.ToString() + ".elem";

            try
            {
                File.Delete(nomeFile);
            }
            catch
            {
            }
            _animazioni.RemoveAt(index);
            LibreriaChange?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 6
0
        private void InsideAggiungiElemento(PersisterMapper <Elemento> elemento)
        {
            IList lista = null;

            if (null != elemento.Element as ImmagineFissa)
            {
                lista = _immaginiFisse;
            }
            else if (null != elemento.Element as Animazione)
            {
                lista = _animazioni;
            }
            if (elemento.ID >= 0 && elemento.ID < lista.Count)
            {
                lista?.RemoveAt(elemento.ID);
                lista?.Insert(elemento.ID, elemento.Element);
            }
            else
            {
                lista?.Add(elemento.Element);
            }
            LibreriaChange?.Invoke(this, EventArgs.Empty);
        }