private void AcquisitionTask(int numTask) { try { HImage imgGrabTmp = frameGrabberForThisObject[numTask].GrabASyncNoDelegate(); if (imgGrab[numTask] != null && imgGrab[numTask].IsInitialized()) { imgGrab[numTask].Dispose(); } imgGrab[numTask] = imgGrabTmp; } catch (HOperatorException ex) { if (!(ex.GetErrorNumber() == 5322 || ex.GetErrorNumber() == 5306)) { //Non deve dare errori nel momento in cui ho appena dato ABORT all'acquisizione if (!cancelToken.Token.IsCancellationRequested) { ExceptionManager.AddException(ex); } } } }
private void timerAggiornaStatoPLC_Tick(object sender, EventArgs e) { timerAggiornaStatoPLC.Enabled = false; try { if (this.plcMacchina != null) { lblContatoreBuoniTappo.Text = this.contatori.CntPezziBuoniTappo.ToString(); lblContatoreScartiTappo.Text = this.contatori.CntPezziScartoTappo.ToString(); lblContatoreScartiTappoPresenza.Text = this.contatori.CntPezziScartoTappoPresenza.ToString(); lblContatoreScartiTappoSerraggio.Text = this.contatori.CntPezziScartoTappoSerraggio.ToString(); lblContatoreScartiTappoSerraggioStelvin.Text = this.contatori.CntPezziScartoTappoSerraggioStelvin.ToString(); lblContatoreScartiTappoPiantaggio.Text = this.contatori.CntPezziScartoTappoPiantaggio.ToString(); lblContatoreScartiTappoAnello.Text = this.contatori.CntPezziScartoTappoAnello.ToString(); lblContatoreScartiTappoGabbietta.Text = this.contatori.CntPezziScartoTappoGabbietta.ToString(); lblContatoreBuoniLivello.Text = this.contatori.CntPezziBuoniLivello.ToString(); lblContatoreScartiLivello.Text = this.contatori.CntPezziScartoLivello.ToString(); lblContatoreScartiLivelloMin.Text = this.contatori.CntPezziScartoLivelloMin.ToString(); lblContatoreScartiLivelloMax.Text = this.contatori.CntPezziScartoLivelloMax.ToString(); lblContatoreScartiLivelloEmpty.Text = this.contatori.CntPezziScartoLivelloEmpty.ToString(); lblTempoMarcia.Text = this.plcMacchina.TempoMarcia.ToString(@"hh\:mm\:ss"); lblTempoFermo.Text = this.plcMacchina.TempoFermo.ToString(@"hh\:mm\:ss"); } } catch (Exception ex) { ExceptionManager.AddException(ex); } finally { timerAggiornaStatoPLC.Enabled = true; } }
private void btnRegolazioniInstallazione_Click(object sender, EventArgs e) { System.Drawing.Size sizeTmp = this.Size; System.Drawing.Point locationTmp = this.Location; try { bool ok = this.pwdManager.CanOpen(Class.PasswordManager.LivelloPassword.Costruttore, this.linguaMngr, true); if (ok) { RegolazioniCPD.FormRegolazioniCPDFixed f = new RegolazioniCPD.FormRegolazioniCPDFixed(this.core, this.plcMacchina, this.linguaMngr); NascondiForm(); f.ShowDialog(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } finally { this.Size = sizeTmp; this.Location = locationTmp; } }
private void btnSetupLivello_Click(object sender, EventArgs e) { System.Drawing.Size sizeTmp = this.Size; System.Drawing.Point locationTmp = this.Location; try { this.plcMacchina.EnterRegolazioni(); System.Threading.Thread.Sleep(100); RegolazioniVisione.FormRegolazioneControlloLivello f = null; lock (this.repaintLock) { f = new RegolazioniVisione.FormRegolazioneControlloLivello(this.core[MainForm.IDX_CORE_LIVELLO], this.plcMacchina, id_formato, MainForm.IDX_CORE_LIVELLO, this.linguaMngr, this.repaintLock); } NascondiForm(); f.ShowDialog(); f.Dispose(); f = null; } catch (Exception ex) { ExceptionManager.AddException(ex); } finally { this.Size = sizeTmp; this.Location = locationTmp; timerExitRegolazioni.Start(); } }
private void buttonRicette_Click(object sender, EventArgs e) { System.Drawing.Size sizeTmp = this.Size; System.Drawing.Point locationTmp = this.Location; try { bool ok = this.pwdManager.CanOpen(Class.PasswordManager.LivelloPassword.Operatore, this.linguaMngr); if (ok) { Formati.FormGestioneFormati f = new Formati.FormGestioneFormati(this.pwdManager, this.linguaMngr); NascondiForm(); f.ShowDialog(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } finally { this.Size = sizeTmp; this.Location = locationTmp; } }
private void Object2Form(DataType.AlgoritmoControlloTappoParam paramTappo, DataType.AlgoritmoControlloLivelloParam paramLivello) { try { if (this.paramLivello != null) { if (Properties.Settings.Default.LivelloDaCamera) { chbAbilitaLivello.Checked = paramLivello.AbilitaControllo; } } if (this.paramTappo != null) { chbAbilitaPresenza.Checked = paramTappo.AbilitaPresenza; chbAbilitazioneControlloAnello.Checked = paramTappo.AbilitaControlloAnello; chbAbilitaSerraggio.Checked = paramTappo.AbilitaSerraggio; chbAbilitaSerraggioStelvin.Checked = paramTappo.AbilitaSerraggioStelvin; chbAbilitaPiantaggio.Checked = paramTappo.AbilitaPiantaggio; } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void RaiseNewImageToDisplayEvent(ArrayList[] iconicVar, ElaborateResult[] result) { //if (OnNewImageToDisplayArray != null) //{ // OnNewImageToDisplayDelegate del; // for (int i = 0; i < OnNewImageToDisplayArray.Length; i++) // { // lock (newImageEventLock) // { // del = OnNewImageToDisplayArray[i]; // } // if (del != null) // { // del(iconicVar[i], result[i]); // } // } //} Action action = () => { try { if (OnNewImageToDisplayArray != null) { OnNewImageToDisplayDelegate del; for (int i = 0; i < OnNewImageToDisplayArray.Length; i++) { lock (newImageEventLock) { del = OnNewImageToDisplayArray[i]; } if (del != null) { del(iconicVar[i], result[i]); } } } } catch (Exception ex) { ExceptionManager.AddException(ex); } }; if (this.taskRaiseNewImageToDisplayEvent == null) { this.taskRaiseNewImageToDisplayEvent = Task.Run(action); } else { this.taskRaiseNewImageToDisplayEvent = this.taskRaiseNewImageToDisplayEvent.ContinueWith(k => action()); } }
private void btnCambiaPassword_Click(object sender, EventArgs e) { try { bool ok = false; if (!string.IsNullOrWhiteSpace(txtNuovaPassword.Text) && txtNuovaPassword.Text == txtConfermaPassword.Text) { string psw = txtNuovaPassword.Text; DataType.ConfigurazioneCorrente confObj = DataType.ConfigurazioneCorrente.Deserialize(Path.Combine(Properties.Settings.Default.DatiVisionePath, "ConfigurazioneCorrente.xml")); if (rbLivelloOperatore.Checked == true) { if (confObj.PswTecnico != psw && confObj.PswCostruttore != psw) { confObj.PswOperatore = psw; ok = true; } } else if (rbLivelloTecnico.Checked == true) { if (confObj.PswOperatore != psw && confObj.PswCostruttore != psw) { confObj.PswTecnico = psw; ok = true; } } else if (rbLivelloCostruttore.Checked == true) { if (confObj.PswOperatore != psw && confObj.PswTecnico != psw) { confObj.PswCostruttore = psw; ok = true; } } if (ok) { DataType.ConfigurazioneCorrente.Serialize(confObj, Path.Combine(Properties.Settings.Default.DatiVisionePath, "ConfigurazioneCorrente.xml")); } } if (ok) { MessageBox.Show(linguaMngr.GetTranslation("MSG_CAMBIO_PSW_OK"), linguaMngr.GetTranslation("MSG_ATTENZIONE"), MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show(linguaMngr.GetTranslation("MSG_CAMBIO_PSW_NON_VALIDO"), linguaMngr.GetTranslation("MSG_ERRORE"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void StopPLC() { try { InviaComando(Comandi.STOP_PLC); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void ExitCaricamentoRicetta() { try { InviaComando(Comandi.ESCI_CARICAMENTO_RICETTA); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnHelp_Click(object sender, EventArgs e) { try { Process.Start(Properties.Settings.Default.PathTW); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnResetAllarmi_Click(object sender, EventArgs e) { try { plcMacchinaManager.ResetAllarmi(); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void ExitCambioFormato() { try { InviaComandoMotori(ComandiMotori.ESCI_CAMBIO_FORMATO); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnStatistiche_Click(object sender, EventArgs e) { try { new FormStatistiche(this.linguaMngr).ShowDialog(); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void ExitRegolazioni() { try { this.ScriviPlc(this.plcAddress, WM2, 0); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void ResetAllarmi() { try { InviaComando(Comandi.RESET_ALLARMI); } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void ExitCambioFormatoSlitte() { try { InviaComando(Comandi.ESCI_CAMBIO_FORMATO_SLITTE); this.inCambioFormatoSlitte = false; } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void DisabilitaEspulsore() { try { InviaComando(Comandi.DISABILITA_ESPULSORE); this.EspulsoreAbilitato = false; } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void EnterRegolazioni() { try { InviaComando(Comandi.ENTRA_REGOLAZIONE); this.inRegolazione = true; } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void ExitRegolazioni() { try { InviaComando(Comandi.ESCI_REGOLAZIONE); this.inRegolazione = false; } catch (Exception ex) { ExceptionManager.AddException(ex); } }
public void EnterCambioFormatoSlitte() { try { InviaComando(Comandi.ENTRA_CAMBIO_FORMATO_SLITTE); this.inCambioFormatoSlitte = true; } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnRegolazioneSlittaLivello_Click(object sender, EventArgs e) { System.Drawing.Size sizeTmp = this.Size; System.Drawing.Point locationTmp = this.Location; try { this.plcMacchina.EnterRegolazioni(); System.Threading.Thread.Sleep(100); this.plcMacchina.EnterRegolazioniSlittaLivello(); System.Threading.Thread.Sleep(100); this.plcMacchina.SetLetturaRidotta(false); if (Properties.Settings.Default.LivelloDaCamera) { RegolazioniMeccaniche.FormGestioneSlittaCamera f; lock (this.repaintLock) { f = new RegolazioniMeccaniche.FormGestioneSlittaCamera(this.core[MainForm.IDX_CORE_LIVELLO], this.plcMacchina, this.id_formato, this.linguaMngr, this.repaintLock); } NascondiForm(); f.ShowDialog(); } else { RegolazioniMeccaniche.FormGestioneSlittaSensore f = new RegolazioniMeccaniche.FormGestioneSlittaSensore(this.plcMacchina, this.id_formato, this.linguaMngr); NascondiForm(); f.ShowDialog(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } finally { this.Size = sizeTmp; this.Location = locationTmp; this.plcMacchina.SetLetturaRidotta(true); this.plcMacchina.ExitRegolazioniSlittaLivello(); System.Threading.Thread.Sleep(100); timerExitRegolazioni.Start(); } }
public void ExitRegolazioniSlittaLivello() { try { InviaComando(Comandi.ESCI_REGOLAZIONE_SLITTA_CAMERE); this.MotoreLivello.ExitRegolazioni(); this.inRegolazioneSlittaLivello = false; } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnresetScartiTappoSerraggioStelvin_Click(object sender, EventArgs e) { try { if (this.contatori != null) { this.contatori.ResetScartiTappoSerraggioStelvin(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnResetScartiLivelloEmpty_Click(object sender, EventArgs e) { try { if (this.contatori != null) { this.contatori.ResetScartiLivelloEmpty(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnResetBuoniLivello_Click(object sender, EventArgs e) { try { if (this.contatori != null) { this.contatori.ResetPezziBuoniLivello(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnResetScartiTappoGabbietta_Click(object sender, EventArgs e) { try { if (this.contatori != null) { this.contatori.ResetScartiTappoGabbietta(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void btnPassword_Click(object sender, EventArgs e) { try { bool ok = this.pwdManager.CanOpen(Class.PasswordManager.LivelloPassword.Operatore, this.linguaMngr); if (ok) { new FormModificaPassword(this.pwdManager, this.linguaMngr).ShowDialog(); } } catch (Exception ex) { ExceptionManager.AddException(ex); } }
private void ManageErrorImage(ArrayList iconicVarList, ElaborateResult result) { if (result.Success == false && Properties.Settings.Default.NumeroErrori > 0) { lock (lastErrorsLock) { if (LastErrors.Count == Properties.Settings.Default.NumeroErrori) { LastErrors[Properties.Settings.Default.NumeroErrori - 1].Dispose(); LastErrors.RemoveAt(Properties.Settings.Default.NumeroErrori - 1); } Utilities.CacheErrorObject ceo = new Utilities.CacheErrorObject(iconicVarList, result); if (Properties.Settings.Default.ErroriSuDisco) { //WriteErrorImageToDisk(ceo); if (ceo != null && ceo.IconicVar != null && ceo.IconicVar.Count > 0 && ((Utilities.ObjectToDisplay)ceo.IconicVar[0]).IconicVar is HImage) { HImage img = (((Utilities.ObjectToDisplay)ceo.IconicVar[0]).IconicVar as HImage).CopyImage(); Action actionSave = () => { try { WriteErrorImageToDisk(img); } catch (Exception ex) { ExceptionManager.AddException(ex); } }; if (this.taskWriteErrorImageToDisk == null) { this.taskWriteErrorImageToDisk = Task.Run(actionSave); } else { this.taskWriteErrorImageToDisk = this.taskWriteErrorImageToDisk.ContinueWith(k => actionSave()); } } } LastErrors.Insert(0, ceo); } } }
public void EnterRegolazioniSlittaCamere() { try { InviaComando(Comandi.ENTRA_REGOLAZIONE_SLITTA_CAMERE); // |MP 11-01-2019 SE SONO IN SMART NON SERVE LA REGOLAZIONE DELLA TESTA if (!Properties.Settings.Default.PRESENZA_SMART) { this.MotoreTesta.EnterRegolazioni(); } this.inRegolazioneSlittaCamere = true; } catch (Exception ex) { ExceptionManager.AddException(ex); } }