public void TestMasterizzaMasterizzatore() { using (LumenEntities dbContext = new LumenEntities()) { foreach (Fotografia fot in dbContext.Fotografie.ToList <Fotografia>()) { _impl.addFotografia(fot); } } _impl.impostaDestinazione(MasterizzaTarget.Masterizzatore, @"E:\"); BurnerSrvImpl burnerSrvImpl = new BurnerSrvImpl(); if (burnerSrvImpl.testMedia()) { _impl.masterizza(); while (!_elaborazioneTerminata) { Thread.Sleep(10000); } Assert.IsTrue(_elaborazioneTerminata); } else { Assert.IsTrue(true); } }
public void TestMasterizzaCartella() { using (LumenEntities dbContext = new LumenEntities()) { foreach (Fotografia fot in dbContext.Fotografie.ToList <Fotografia>()) { System.Diagnostics.Trace.WriteLine("[Foto Aggiunta all'Abum per la Copia su Chiavetta]: " + fot.nomeFile); _impl.addFotografia(fot); } } string strPathDesktop = Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); _impl.impostaDestinazione(MasterizzaTarget.Cartella, strPathDesktop + @"\Chiavetta"); BurnerSrvImpl burnerSrvImpl = new BurnerSrvImpl(); if (burnerSrvImpl.testMedia()) { _impl.masterizza(); while (!_elaborazioneTerminata) { Thread.Sleep(10000); } Assert.IsTrue(_elaborazioneTerminata); } else { Assert.IsTrue(true); } }
public void masterizza(Guid idCarrello) { senderTag = idCarrello; switch (_tipoDestinazione) { case MasterizzaTarget.Cartella: // Scarico in un thread separato per non bloccare l'applicazione seNonPossoCopiareSpaccati(); _threadCopiaSuChiavetta = new Thread(copiaCartellaDestinazioneAsincrono); _threadCopiaSuChiavetta.Start(); break; case MasterizzaTarget.Masterizzatore: _burner = new BurnerSrvImpl(); _burner.InviaStatoMasterizzazione += new BurnerSrvImpl.StatoMasterizzazioneEventHandler(inviaMessaggioStatoMasterizzazione); _burner.start(); foreach (Fotografia fot in _fotografie) { _burner.addFileToBurner(PathUtil.nomeCompletoVendita(fot)); } _burner.setDiscRecorder(_driverLetter); if (_burner.testMedia()) { //Imposto l'etichetta del CD _burner.etichetta = DateTime.Now.ToString("dd MMM yyyy"); if (_burner.CapacitaResidua() < 0) { MasterizzaMsg errorTestMediaMsg = new MasterizzaMsg(this); errorTestMediaMsg.senderTag = senderTag; errorTestMediaMsg.fase = Fase.ErroreSpazioDisco; errorTestMediaMsg.esito = Esito.Errore; errorTestMediaMsg.progress = 0; errorTestMediaMsg.result = "Capacita del disco superata!!!"; pubblicaMessaggio(errorTestMediaMsg); } else { _burner.burning(); } } else { MasterizzaMsg errorTestMediaMsg = new MasterizzaMsg(this); errorTestMediaMsg.senderTag = senderTag; errorTestMediaMsg.fase = Fase.ErroreMedia; errorTestMediaMsg.esito = Esito.Errore; errorTestMediaMsg.progress = 0; errorTestMediaMsg.result = "Error Media"; pubblicaMessaggio(errorTestMediaMsg); throw new Exception("Errore supporto\n" + "Molto probabilmente non è stato inserito il CD nell'unita o la capacita del supporto non è sufficiente!!" + "\n\nVerifica il supporto e prova a rimasterizzare usando il pulsante" + "\n\nRimasterizza nuovamente causa eventuali errori" + "\n\nChe si trova alla tua Sinistra!!!!"); } break; default: throw new ArgumentException("TipoDestinazione non indicato o non supportato: " + _tipoDestinazione); } }