1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
public string myValue;
public byte[] don;
private void button_envoyer_Click(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Appuyez sur 'F6' de la commande numérique puis patientez...";
serialPort1.Write("\u000A"); // lance la tache receveFil chr10
while (!ison) { }
myValue = textBox1.Text;
if (myValue.Length > 0)
{
don = System.Text.Encoding.ASCII.GetBytes(myValue);
serialPort1.Write(don, 0, don.Length);
timer2.Start();
}
}
private void timer2_Tick(object sender, EventArgs e)
{
progressBar1.Minimum = 1;
progressBar1.Maximum = 100;
progressBar1.Value = 1;
progressBar1.Step = 1;
for (int i = 1; i <= 100; i++)
{
progressBar1.Value = i;
toolStripStatusLabel1.Text = progressBar1.Value.ToString() + "%" + "Télechargement en court...";
}
if (progressBar1.Value == 100)
{
timer2.Stop();
toolStripStatusLabel1.Text = "Télechargement Fini";
}
} |
Partager