Пример #1
0
        /// <summary>
        /// Record event trigered every 1/100 th second. Saves the coordinates curently present in the CoordinateHolder into the session file.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void Record(object sender, ElapsedEventArgs args)
        {
            if (timer.Interval <= 10)
            {
                timer.Interval = 10;
            }

            DateTime t = args.SignalTime;                                // Take the time the tick was done
            Point    ellipseCoordiante = buffer.GetEllipseCoordinates(); // Parse coordinates from StimulyWindow to service and then to thread where they will be recorded into the log file
            Point    controller1       = buffer.GetPointerCoordinates(0);
            Point    controller2       = buffer.GetPointerCoordinates(1);

            double[,] accel = buffer.getAccelValues();
            string toWrite = string.Concat(watch.Elapsed.ToString(), ";", ellipseCoordiante.ToString(), ";", controller1.ToString(), ";", controller2.ToString(), ";",
                                           accel[0, 0], ";", accel[0, 1], ";", accel[0, 2], ";", accel[1, 0], ";", accel[1, 1], ";", accel[1, 2]);

            //TO-DO runtime error when attempting to write to file on Synchronous mode.
            logstream.WriteLine(toWrite);
        }