void Main(string[] args) { Clock = new System.Timers.Timer(); Clock.Elapsed += new ElapsedEventHandler(Clock_Elapsed); Clock.Interval = Convert.ToDouble(textBox3.Text); Clock.Enabled = false; Clock.AutoReset = false; } void Clock_Elapsed(object sender, ElapsedEventArgs e) { Clock.Stop(); if (code == "READBYTE") { button3.PerformClick(); } Clock.Start(); }
if (radioButton2.Checked == true ) { Clock.Enabled = !Clock.Enabled; }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO;// for using sw using System.Net.NetworkInformation;// for using ping using System.Runtime.InteropServices; // use with libnodave using System.Timers; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } static libnodave.daveOSserialType fds; static libnodave.daveInterface di; static libnodave.daveConnection dc; public static System.Timers.Timer Clock; void Main(string[] args) { Clock = new System.Timers.Timer(); Clock.Elapsed += new ElapsedEventHandler(Clock_Elapsed); Clock.Interval = Convert.ToDouble(textBox3.Text); Clock.Enabled = false; Clock.AutoReset = false; } void Clock_Elapsed(object sender, ElapsedEventArgs e) { Clock.Stop(); if (checkBox1.Checked == true ) button3.PerformClick(); if (checkBox2.Checked == true) button5.PerformClick(); if (checkBox3.Checked == true) button6.PerformClick(); Clock.Start(); }
void button7_Click(object sender, EventArgs e) { Clock.Enabled = true; } void button8_Click(object sender, EventArgs e) { Clock.Enabled = false; } } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionprivate void MaFonction(){ //code de la fonction que tu veux appeler } //fonction appelée par le timer Timer_tick(){ MaFonction(); } //fonction appelée par le bouton Button_click(){ MaFonction(); }
private void MaFonction(){ //code de la fonction que tu veux appeler } //fonction appelée par le timer Timer_tick(){ MaFonction(); } //timer démarré par le bouton Button_click(){ timer.start(); }
if (radioButton2.Checked == true ) { Clock.Enabled = !Clock.Enabled; }
void Clock_Elapsed(object sender, ElapsedEventArgs e) { Clock.Stop(); if (checkBox1.Checked == true ) button3.PerformClick(); if (checkBox2.Checked == true) button5.PerformClick(); if (checkBox3.Checked == true) button6.PerformClick(); Clock.Start(); }