private void timer1_Tick(object sender, EventArgs e) { if (_Sync == null) { this.simpleButtonChiusura.Enabled = false; this.simpleButtonForza.Enabled = false; this.marqueeProgressBarControl1.Properties.Stopped = false; _Sync = new SyncHelper(); _Sync.GoSync(); } else { if (_Sync != null && _Sync.SyncFinished && !_Sync.ResultProcessed) { _Sync.End(); if (_Sync.Result) { DialogResult = DialogResult.OK; } else { // retry or quit this.marqueeProgressBarControl1.Properties.Stopped = true; this.simpleButtonChiusura.Enabled = true; this.simpleButtonForza.Enabled = true; XtraMessageBox.Show("Errore durante la chiusura del programma.", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }