update button durante fase upload
This commit is contained in:
@@ -1282,6 +1282,14 @@ namespace IOB_MAN
|
||||
|
||||
private async void btnSendLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
// salvo valori button normali
|
||||
var stdColor = btnSendLog.BackColor;
|
||||
var stdText = btnSendLog.Text;
|
||||
// mostro che sto inviando dati...
|
||||
btnSendLog.Enabled = false;
|
||||
btnSendLog.BackColor = Color.OrangeRed;
|
||||
btnSendLog.Text = "fix directory";
|
||||
btnSendLog.Refresh();
|
||||
// svuoto area temp...
|
||||
string fileName = "LogFiles.zip";
|
||||
string tempDir = Path.Combine(Application.StartupPath, "temp", "logs");
|
||||
@@ -1300,6 +1308,8 @@ namespace IOB_MAN
|
||||
string logDir = TargetLogDir;
|
||||
if (dgvManagedItems.SelectedRows.Count > 0)
|
||||
{
|
||||
btnSendLog.Text = "zip start";
|
||||
btnSendLog.Refresh();
|
||||
// ciclo su row selezionate
|
||||
foreach (DataGridViewRow riga in dgvManagedItems.SelectedRows)
|
||||
{
|
||||
@@ -1326,6 +1336,8 @@ namespace IOB_MAN
|
||||
File.Delete(zipPath);
|
||||
}
|
||||
ZipFile.CreateFromDirectory(tempDir, zipPath);
|
||||
btnSendLog.Text = "zip end";
|
||||
btnSendLog.Refresh();
|
||||
|
||||
// ciclo di creazione ticket e upload file
|
||||
try
|
||||
@@ -1365,6 +1377,10 @@ namespace IOB_MAN
|
||||
idxSubLic = 0
|
||||
};
|
||||
}
|
||||
|
||||
btnSendLog.Text = "LogSend start";
|
||||
btnSendLog.BackColor = Color.DarkOrange;
|
||||
btnSendLog.Refresh();
|
||||
var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(newSuppReq);
|
||||
var ticketResp = await client.PostAsync<TicketDTO>(ticketReq);
|
||||
|
||||
@@ -1376,6 +1392,9 @@ namespace IOB_MAN
|
||||
// ... infine INVIA file zip che li contiene...
|
||||
//var fileUploadResp = client.Post(fileUploadReq);
|
||||
var fileUploadResp = await client.PostAsync<UploadResult>(fileUploadReq);
|
||||
btnSendLog.Text = "LogSend end";
|
||||
btnSendLog.BackColor = Color.DarkOliveGreen;
|
||||
btnSendLog.Refresh();
|
||||
|
||||
// elimino folder temporanea
|
||||
if (Directory.Exists(tempDir))
|
||||
@@ -1393,6 +1412,10 @@ namespace IOB_MAN
|
||||
Logging.LogError($"Eccezione in fase gestione REST services{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
btnSendLog.BackColor = stdColor;
|
||||
btnSendLog.Text = stdText;
|
||||
btnSendLog.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user