Exemplo n.º 1
0
        /// <summary>
        /// Method for initializating IntermediateClasss, receives the parameters contained in a configuration.
        /// </summary>
        /// <param name="pluginName">Full route to the plugin to be loaded as an assembly</param>
        /// <param name="reticleRoute">Full route to the image to be used as a reticle</param>
        /// <param name="mouseControl">Bool value that indicates if the user will control the mouse with its gaze</param>
        /// <param name="countdown">Number of seconds to be used as the countdown for generating a click</param>
        /// <param name="saveData">Bool value that indicates if the eye tracking data will be saved to a file</param>
        /// <param name="saveRoute">Route where the files will be saved</param>
        /// <param name="fileName">Name of the file to be generated</param>
        public void InitializeClass(string pluginName, string reticleRoute, bool mouseControl, int countdown, bool saveData, string saveRoute, string fileName)
        {
            proxyInstance.CreateAppDomain(pluginName);
            ClickTimer        = countdown * 1000;
            this.mouseControl = mouseControl;
            this.saveData     = saveData;

            //  If a reticle is selected, the class for managing its drawing is created
            if (reticleRoute != null)
            {
                if (drawingClass != null)
                {
                    drawingClass.ClearUp();
                }
                drawingClass = new ReticleDrawing(reticleRoute);
            }
            else if (reticleRoute == null && drawingClass != null)
            {
                drawingClass.ClearUp();
                drawingClass = null;
            }

            //  If saveData was selected, a file where contents will be written is created, after checking if a file has been
            //  created before (in which case, it's closed before creating the new file).
            if (saveData)
            {
                if (logging != null)
                {
                    logging.CloseLogTarget();
                }
                logging  = new StandardLogging();
                fileName = fileName + " - " + DateTime.Now.ToString("dd-M-yyyy_HH-mm-ss");
                logging.CreateLogTarget(saveRoute, fileName + ".csv");
            }

            //  If mouseControl was selected, the class for controlling the mouse through eye movements is instantiated
            if (mouseControl)
            {
                if (controller == null)
                {
                    controller = new MouseControl();
                }
                clickRegister = 0;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Method for cleaning up the class current configuration
 /// </summary>
 public void ClearClass()
 {
     //  Every variable related to eye tracking gets reinitialized
     mouseControl = false;
     saveData     = false;
     if (controller != null)
     {
         controller = null;
     }
     if (logging != null)
     {
         logging.CloseLogTarget();
         logging = null;
     }
     if (drawingClass != null)
     {
         drawingClass.ClearUp();
         drawingClass = null;
     }
 }