Exemplo n.º 1
0
 // Close file
 public static void closeCSVFile(WriteCVS m_CSVWriter)
 {
     if (m_CSVWriter != null)
     {
         m_CSVWriter.CloseCVSFile();
     }
 }
Exemplo n.º 2
0
        public WriteCVS CreateCSVFile(string fileName)
        {
            WriteCVS m_CSVWrtier = FileWriter.CreateCSVFile(fileName);

            mTemplateData.Add("X");
            mTemplateData.Add("Y");
            mTemplateData.Add("Time");
            FileWriter.writeData(mTemplateData, m_CSVWrtier);
            mTemplateData.Clear();
            return(m_CSVWrtier);
        }
Exemplo n.º 3
0
        private void writeGazeData()
        {
            lock (writeLock)
            {
                // Record gaze data as candidate path
                if (trackerOn && trackingActive)
                {
                    //Console.WriteLine("X = {0} and Y = {1} and tracking = {2}", m_RawX, m_RawY);
                    mTemplateData.Add(screenX.ToString());
                    mTemplateData.Add(screenY.ToString());
                    mTemplateData.Add(m_RawX.ToString());
                    mTemplateData.Add(m_RawY.ToString());
                    mTemplateData.Add(m_SmoothedX.ToString());
                    mTemplateData.Add(m_SmoothedY.ToString());
                    mTemplateData.Add(DateTime.UtcNow.ToString(DateTime.UtcNow.ToString("hh:mm:ss:fff")));

                    Point   p       = new Point(screenX, screenY);
                    Control gBcntrl = null;

                    IntPtr hWnd = WindowFromPoint(Control.MousePosition);
                    if (hWnd != IntPtr.Zero)
                    {
                        gBcntrl = Control.FromHandle(hWnd);
                    }

                    if (gBcntrl != null)
                    {
                        if (!search_data.ContainsKey(searchTerm))
                        {
                            search_data[searchTerm] = new Data();
                        }

                        string controlName = gBcntrl.Name;

                        if (controlName.Contains("group") || controlName.Contains("rich") || controlName.Contains("label"))
                        {
                            string indexString = Regex.Match(controlName, @"\d+").Value;
                            int    index       = Int32.Parse(indexString);
                            search_data[searchTerm].gaze_data[index - 1] += 1;
                        }
                    }

                    string tabPageName = "";

                    tabControl1.Invoke(new MethodInvoker(delegate { tabPageName = tabControl1.SelectedTab.Text; }));

                    WriteCVS writer = dict_gazeCVS["tab" + tabPageName];

                    FileWriter.writeData(mTemplateData, writer);
                    mTemplateData.Clear();
                }
            }
        }
Exemplo n.º 4
0
        private void groupBox_Click(object sender, MouseEventArgs e, int i)
        {
            if (e is MouseEventArgs)
            {
                MouseEventArgs a = (MouseEventArgs)e;

                int x_coord = a.X;
                int y_coord = a.Y;
                mTemplateclick.Add(x_coord.ToString());
                mTemplateclick.Add(y_coord.ToString());
                mTemplateclick.Add(DateTime.UtcNow.ToString(DateTime.UtcNow.ToString("hh:mm:ss:fff")));

                Point p = new Point(x_coord, y_coord);
                // var cntrl = GetChildAtPoint(p);
                // Control tbpagecntrl = null;
                Control gBcntrl = null;

                IntPtr hWnd = WindowFromPoint(Control.MousePosition);
                if (hWnd != IntPtr.Zero)
                {
                    gBcntrl = Control.FromHandle(hWnd);
                }

                //if (cntrl != null)
                //{
                //    tbpagecntrl = cntrl.GetChildAtPoint(p);
                //    if (tbpagecntrl != null)
                //        gBcntrl = tbpagecntrl.GetChildAtPoint(p);
                //}

                if (gBcntrl != null)
                {
                    if (!search_data.ContainsKey(searchTerm))
                    {
                        search_data[searchTerm] = new Data();
                    }

                    string indexString = Regex.Match(gBcntrl.Name, @"\d+").Value;
                    int    index       = Int32.Parse(indexString);

                    search_data[searchTerm].click_data[index - 1] += 1;
                }

                string directryPath = @"..\..\Data\UserStudy\P_" + UserId.ToString();
                createDirectory(directryPath);
                string filePath = directryPath + "\\";

                filePath += searchTerm + "_groupBox" + i.ToString() + "_clickData.csv";
                StreamWriter strmwrtr = null;

                if (File.Exists(filePath))
                {
                    strmwrtr = new StreamWriter(filePath, append: true);
                }
                else
                {
                    strmwrtr = new StreamWriter(filePath);
                }

                WriteCVS.WriteRow1(mTemplateclick, strmwrtr);
                strmwrtr.Close();
                mTemplateclick.Clear();
            }
        }
Exemplo n.º 5
0
 // Write data row
 public static void writeData(CsvRow datarow, WriteCVS m_CSVWriter)
 {
     m_CSVWriter.WriteRow(datarow);
 }
Exemplo n.º 6
0
 //CSV file writing service
 public static WriteCVS CreateCSVFile(String fileName)
 {
     m_CSVWriter = new WriteCVS(fileName);
     return(m_CSVWriter);
 }