private void MicroTimerTest() { // Instantiate new MicroTimer and add event handler MicroLibrary.MicroTimer microTimer = new MicroLibrary.MicroTimer(); microTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEvent); microTimer.Interval = 1000 * 50; // Call micro timer every 1000µs (1ms) // Can choose to ignore event if late by Xµs (by default will try to catch up) // microTimer.IgnoreEventIfLateBy = 500; // 500µs (0.5ms) microTimer.Enabled = true; // Start timer // Do something whilst events happening, for demo sleep 2000ms (2sec) System.Threading.Thread.Sleep(50000); microTimer.Enabled = false; // Stop timer (executes asynchronously) // Alternatively can choose stop here until current timer event has finished // microTimer.StopAndWait(); // Stop timer (waits for timer thread to terminate) // Wait for user input Console.ReadLine(); }
public MainWindow() { InitializeComponent(); myDelegate = new TimeLoop(updateData); string[] ports = SerialPort.GetPortNames(); foreach (string port in ports) { cmbPorts.Items.Add(port); } foreach (string delimiter in delimitmarkup) { cmbDelimiter.Items.Add(delimiter); } cmbDelimiter.SelectedIndex = 0; testdatalst = new List <double>(); stopwatch = new Stopwatch(); serialMonitor = new SerialPort(); serialMonitor.BaudRate = 9600; serialMonitor.Handshake = System.IO.Ports.Handshake.None; serialMonitor.Parity = Parity.None; serialMonitor.DataBits = 8; serialMonitor.StopBits = StopBits.One; serialMonitor.ReadTimeout = 200; serialMonitor.WriteTimeout = 50; _microStopwatch = new MicroLibrary.MicroStopwatch(); _microTimer = new MicroLibrary.MicroTimer(); }
public FileLoadingForm() { InitializeComponent(); fastTimer = new MicroLibrary.MicroTimer(); fastTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEvent); fastTimer.Interval = 20000; //in microseconds whichBusSend = -1; }
public FileLoadingForm() { InitializeComponent(); fastTimer = new MicroLibrary.MicroTimer(); fastTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEvent); fastTimer.Interval = 20000; //in microseconds whichBusSend = -1; }
public FormMain() { InitializeComponent(); // Instantiate new MicroTimer and add event handler _microTimer = new MicroLibrary.MicroTimer(); _microTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEvent); }
private void MicroTimer() { // Instantiate new MicroTimer and add event handler MicroLibrary.MicroTimer microTimer = new MicroLibrary.MicroTimer(); microTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(DrawLine); microTimer.Interval = speed; // Call micro timer every 1000µs (1ms) microTimer.Enabled = true; // Start timer // Do something whilst events happening, for demo sleep 2000ms (2sec) System.Threading.Thread.Sleep(DrawDuration); microTimer.Enabled = false; // Stop timer (executes asynchronously) // Alternatively can choose stop here until current timer event has finished // microTimer.StopAndWait(); // Stop timer (waits for timer thread to terminate) }
public MainWindow() { // Interface InitializeComponent(); programText.View = View.Details; programText.Columns.Add("#", 50, HorizontalAlignment.Left); programText.Columns.Add("Command", 400, HorizontalAlignment.Left); procInfo.View = View.Details; procInfo.Columns.Add("Registers", 237, HorizontalAlignment.Left); procInfo.Columns.Add("Flags", 237, HorizontalAlignment.Left); // Timer microTimer = new MicroLibrary.MicroTimer(); microTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEvent); microTimer.Interval = interval; // Screen update screenUpdate.Start(); }
static void Main(string[] args) { Console.WriteLine("TrackBeamParser service"); Thread thread = new Thread(() => { TracksDataReceiver.StartListening((trackData) => { BeamMaker.onReceiveTracks(trackData); }); }); thread.Start(); timestart = DateTime.Now; AudioMicroTimer = new MicroLibrary.MicroTimer(); AudioMicroTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEventAudio); AudioMicroTimer.Interval = 100; // 1000µs = 1ms AudioMicroTimer.Enabled = true; // Start timer }
public tclsMDIParent() { string szComsTickUS; string szGUILayoutXMLPath; long lComsTickUS; InitializeComponent(); mboRequestShutdown = false; tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHost Calibration.INI"); try { szComsTickUS = mclsIniParser.GetSetting("Program", "ComsTickus"); } catch { szComsTickUS = "Unknown"; } try { szGUILayoutXMLPath = AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\" + mclsIniParser.GetSetting("Databases", "SelectedLayoutXML"); } catch { szGUILayoutXMLPath = "Unknown"; } if (File.Exists(szGUILayoutXMLPath)) { Program.mAPP_clsXMLConfig.ReadWindowConfigFile(szGUILayoutXMLPath); } mlstMeasValueCharView = new List <tclsMeasValueCharView>(); mlstMeasSegmentView = new List <tclsICMeasSegmentView>(); mlstMeasCurveMapView = new List <tclsMeasCurveMapView>(); mlstMeasValueLoggingView = new List <tclsMeasValueLoggingView>(); mlstMeasValueGaugeView = new List <tclsMeasValueGaugeView>(); mlstLogicBlockView = new List <tclsLogicBlockView>(); mlstDSGView = new List <tclsDSG>(); mclsCommsTimer = new MicroLibrary.MicroTimer(); mclsCommsTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnMicroTimerEvent); mlstChildViews = new List <Form>(); mlstLoggingViews = new List <tclsMeasValueLoggingView>(); lComsTickUS = Convert.ToUInt32(szComsTickUS); if ((ConstantData.APPDATA.ru32ComsTickMin <= lComsTickUS) && (ConstantData.APPDATA.ru32ComsTickMax >= lComsTickUS)) { mclsCommsTimer.Interval = lComsTickUS; mclsCommsTimer.Enabled = true; } mclsNavTreeView = new tclsNavGraphicalTreeView(); mclsNavTreeView.MdiParent = this; mclsNavTreeView.Show(); mclsNotify = new tclsNotify(); mclsNotify.MdiParent = this; mclsNotify.Left = 0; mclsNotify.Top = this.ClientRectangle.Height - 100; mclsNotify.Width = this.ClientRectangle.Width; mclsNotify.Show(); }
public Form1(string characterName) { InitializeComponent(); mKinectData = new KinectData(); mKinectData2 = new KinectData(); //second user data GazeOut1=new GazeDef(); GazeOut2 = new GazeDef(); GazeOut1 = GazeDef.none; GazeOut2 = GazeDef.none; LastGazeOut1 = new GazeDef(); LastGazeOut2 = new GazeDef(); LastGazeOut1 = GazeDef.none; LastGazeOut2 = GazeDef.none; simpleSound = new SoundPlayer(@"countA.wav"); eyebrowControllerUsr1 = new EyebrowsController(); eyebrowControllerUsr2 = new EyebrowsController(); serialPort1 = new System.IO.Ports.SerialPort(); serialPort2 = new System.IO.Ports.SerialPort(); sentonce = false; serialPort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(serialPort1_DataReceived); serialPort2.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(serialPort2_DataReceived); thalamusClient = new PerceptionClient(characterName); pipeServer = new PipeServer.Server(); engagementpipe = new PipeServer.Server(); Xp = 0; Yp = 0; Zp = 0; Xp2 = -1; Yp2 = -1; Zp2 = -1; Xpold = 0; Ypold = 0; Zpold = 0; Xp2old = -1; Yp2old = -1; Zp2old = -1; RotH = 0; RotV = 0; RotH2 = 0; RotV2 = 0; depth = 0; allOKAOdata = ""; allOKAOdata2 = ""; allQdata = ""; allQdata2 = ""; allkinectdata = ""; allkinectdata2 = ""; startstop = false; FparticipanID = 0; FparticipanID2 = 1; Fparticipantname = "None"; Fparticipantname2 = "None2"; isEmpathic = true; //default value OKAOdata = ""; OKAOdata2 = ""; Kinectdata = ""; Kinectdata2 = ""; Qdata1 = ""; Qdata2 = ""; saver = new System.Timers.Timer(); saver.Elapsed += new ElapsedEventHandler(OnsaverEvent); saver.Enabled = false; saver.Interval = 250; //Herz DetectedPerson = false; aTimer = new System.Timers.Timer(); aTimer.Stop(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); //publisher aTimer.Interval = 350;//increased the timer to reduce thalamus messages videoTimer = new MicroLibrary.MicroTimer(); videoTimer.Stop(); videoTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(saveframe); videoTimer.Interval = 33333; //30fps //thalamusClient.ClientConnected += connected; this.pipeServer.MessageReceived += new PipeServer.Server.MessageReceivedHandler(pipeServer_MessageReceived); this.engagementpipe.MessageReceived += new PipeServer.Server.MessageReceivedHandler(engagementpipe_MessageReceived); button1_Click(this,null); //auto start the pipe servers if (scenarioselected == 0) scenarioselected = 1; }
private void MicroTimerTest() { // Instantiate new MicroTimer and add event handler MicroLibrary.MicroTimer microTimer = new MicroLibrary.MicroTimer(); microTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnTimedEvent); microTimer.Interval = 1000; // Call micro timer every 1000µs (1ms) // Can choose to ignore event if late by Xµs (by default will try to catch up) // microTimer.IgnoreEventIfLateBy = 500; // 500µs (0.5ms) microTimer.Enabled = true; // Start timer // Do something whilst events happening, for demo sleep 2000ms (2sec) //System.Threading.Thread.Sleep(2000); //microTimer.Enabled = false; // Stop timer (executes asynchronously) // Alternatively can choose stop here until current timer event has finished // microTimer.StopAndWait(); // Stop timer (waits for timer thread to terminate) // Wait for user input }