private void confirmButton_Click(object sender, EventArgs e)
 {
     Properties.Settings.Default.Save();
     ConfigManager.SaveToDisk();
     this.Close();
 }
Exemplo n.º 2
0
 private void exitButton_Click(object sender, EventArgs e)
 {
     ConfigManager.SaveToDisk();
     this.Hide();
 }
Exemplo n.º 3
0
        public static void errorReportingThread()
        {
            //The first time the thread starts, let it know it has started to execute
            lock (threadStartCond)
            {
                Monitor.PulseAll(threadStartCond);
            }

            while (true)
            {
                lock (errorReportCond)
                {
                    Monitor.Wait(errorReportCond);
                }

                try
                {
                    //1. create the folder for automatic errors
                    if (!Directory.Exists(autoErrorReportFolder))
                    {
                        Directory.CreateDirectory(autoErrorReportFolder);
                    }

                    long currentTimestamp = LogEntry.GetCurrentTimeStamp();
                    //2. create subfolder that stores all the files for this particular error report
                    string reportFolderName = autoErrorReportFolder + "/autoreport_" + currentTimestamp;
                    if (!Directory.Exists(reportFolderName))
                    {
                        Directory.CreateDirectory(reportFolderName);
                    }

                    string msg = knownErrorsList.Last().msg;

                    //3. Write the msg (error text) as a .txt file so that it can be read as the report description
                    File.WriteAllLines(reportFolderName + "/reportDescription.txt", msg.Split('\n'));

                    //4. Save the current loglist, variablesDict, FunctioncallsCountDict to the error reporting folder, csv gaze data
                    Logger.SaveToDisk(reportFolderName + "/");

                    //dataLogList.WriteToCsv(reportFolderName + "/gazedata.csv");

                    //Copy Config settings file over as well
                    ConfigManager.SaveToDisk();
                    File.Copy(ConfigManager.xmlExportFileName, reportFolderName + "/" + ConfigManager.xmlExportFileName);


                    //5. Zip up the folder and remove the original folder
                    if (Directory.Exists(reportFolderName))
                    {
                        Directory.Delete(reportFolderName, true);
                    }
                    //6. Notify precision gaze mouse form of created error report (increment)
                    autoErrorReportsCount++;

                    SaveKnownErrorsToDisk("");
                }
                catch (Exception ex)
                {
                    Debug.Write(ex);
                }
            }
        }