Ejemplo n.º 1
0
        private async void BtnConsegna_Click(object sender, EventArgs e)
        {
            progressBar1.Visible        = true;
            lblCurrentOperation.Visible = true;
            lblCurrentOperation.Text    = "Consegna in corso";

            if (MessageBox.Show(
                    $"ATTENZIONE: SALVARE E CHIUDERE TUTTI I PROGRAMMI CHE STANNO USANDO LA DIRECTORY {testManager.ResolvedTestPath} ALTREMENTI LE MODIFICHE NON VERRANNO SALVATE. PREMERE OK PER CONTINUARE. VUOI CONTINUARE?",
                    "Waiting Closure", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return;
            }

            try {
                testTimer.Stop();
                await testManager.Handover();
            } catch (Exception ex) {
                MessageBox.Show(
                    "La consegna è fallita, riprova oppure richiedi la consegna manuale. Il test è stato messo in pausa",
                    "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                System.Diagnostics.Debug.WriteLine(ex.Message);
                return;
            }

            progressBar1.Visible        = false;
            lblCurrentOperation.Visible = false;

            testManager.TestState.State = UserTestState.UserState.Finished;
            await testManager.SendStateUpdate();

            ReloadUi();
            testManager.Disconnect();
            MessageBox.Show("Consegnato, ora si può chiudere RTesting", "Done", MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
        }