diff --git a/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino b/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino index 0b25355..6078f63 100644 --- a/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino +++ b/Hardware/OSRTT_Full_Code/OSRTT_Full_Code.ino @@ -35,7 +35,7 @@ SPISettings settingsA(10000000, MSBFIRST, SPI_MODE0); //Serial connection values bool connected = false; -String firmware = "2.2"; +String firmware = "2.3"; int testRuns = 4; bool vsync = true; bool extendedGamma = true; @@ -219,7 +219,7 @@ void digitalPotWrite(int value) int checkUSBVoltage() // Check USB voltage is between 4.8V and 5.2V { int counter = 0; - while (counter < 1000) + while (counter < 2000) { ADC1->SWTRIG.bit.START = 1; //Start ADC1 while(!ADC1->INTFLAG.bit.RESRDY); //wait for ADC to have a new value @@ -558,10 +558,7 @@ void loop() { { Serial.setTimeout(300); Keyboard.print(fpsLimit); - if (vsync == false) - { - Keyboard.print('V'); - } + Keyboard.print(fpsLimit); // Check USB voltage level //int voltageTest = checkUSBVoltage(); //if (voltageTest == 0) diff --git a/OSRTT Launcher/OSRTT Launcher/App.config b/OSRTT Launcher/OSRTT Launcher/App.config index 89b0157..a595ab2 100644 --- a/OSRTT Launcher/OSRTT Launcher/App.config +++ b/OSRTT Launcher/OSRTT Launcher/App.config @@ -1,7 +1,7 @@ - + - +
@@ -11,6 +11,10 @@ + + + + @@ -24,21 +28,6 @@ False - - False - - - False - - - True - - - False - - - True - False @@ -48,12 +37,6 @@ False - - False - - - True - False @@ -61,7 +44,7 @@ False - True + False False @@ -91,7 +74,7 @@ True - 0 + True True @@ -103,7 +86,37 @@ 5,15,20 - 95, 85, 75 + 75, 85, 95 + + + RGB 5 Tolerance + + + 5 + + + True + + + False + + + RGB Values + + + False + + + False + + + True + + + True + + + diff --git a/OSRTT Launcher/OSRTT Launcher/CFuncs.cs b/OSRTT Launcher/OSRTT Launcher/CFuncs.cs new file mode 100644 index 0000000..ffddd8a --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/CFuncs.cs @@ -0,0 +1,49 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OSRTT_Launcher +{ + class CFuncs + { + public DialogResult showMessageBox(string title, string message, MessageBoxButtons buttons, MessageBoxIcon icon) + { + if (!Properties.Settings.Default.SuppressDiagBox) + { + DialogResult d = MessageBox.Show(title, message, buttons, icon); + return d; + } + else + { + return DialogResult.None; + } + } + + public string createFileName(string resultsFolderPath, string searchParams) + { + decimal fileNumber = 001; + // search /Results folder for existing file names, pick new name + string[] existingFiles = Directory.GetFiles(resultsFolderPath, "*" + searchParams); + // Search \Results folder for existing results to not overwrite existing or have save conflict errors + foreach (var s in existingFiles) + { + decimal num = 0; + try + { num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); } + catch + { Console.WriteLine("Non-standard file name found"); } + if (num >= fileNumber) + { + fileNumber = num + 1; + } + } + return fileNumber.ToString("000") + searchParams; + } + + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/DataUpload.cs b/OSRTT Launcher/OSRTT Launcher/DataUpload.cs new file mode 100644 index 0000000..058e194 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/DataUpload.cs @@ -0,0 +1,140 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Management; + +namespace OSRTT_Launcher +{ + class DataUpload + { + public class SystemInfo + { + public string boardSerial { get; set; } + public CPU cpu { get; set; } + public GPU gpu { get; set; } + public RAM ram { get; set; } + public string MACAddress { get; set; } + } + public class CPU + { + public string CPUName { get; set; } + public int Cores { get; set; } + public int LogicalProcessors { get; set; } + } + public class GPU + { + public string GPUName { get; set; } + public Int64 VRAM { get; set; } + public string GPUDriver { get; set; } + } + public class RAM + { + public Int64 totalCapcity { get; set; } + public int sticks { get; set; } + public int FormFactor { get; set; } + public string PartNumber { get; set; } + public int RamSpeed { get; set; } + public int RamVolts { get; set; } + } + Thread uploadThread; + public async void UploadData(object data, string url) + { + string json = JsonConvert.SerializeObject(data); + var httpContent = new StringContent(json, Encoding.UTF8, "application/json"); + var httpClient = new HttpClient(); + var httpResponse = await httpClient.PostAsync(url, httpContent); + } + + public void systemInfo() + { + SystemInfo si = new SystemInfo + { + boardSerial = Properties.Settings.Default.serialNumber, + cpu = new CPU(), + gpu = new GPU(), + ram = new RAM() + }; + ManagementObjectSearcher cpu = new ManagementObjectSearcher("select * from Win32_Processor"); + foreach (ManagementObject cpuObj in cpu.Get()) + { + si.cpu.CPUName = cpuObj["Name"].ToString(); + si.cpu.Cores = Convert.ToInt32(cpuObj["NumberOfCores"]); + si.cpu.LogicalProcessors = Convert.ToInt32(cpuObj["NumberOfLogicalProcessors"]); + } + ManagementObjectSearcher gpu = new ManagementObjectSearcher("select * from Win32_VideoController"); + foreach (ManagementObject gpuObj in gpu.Get()) + { + si.gpu.GPUName = gpuObj["Name"].ToString(); + si.gpu.VRAM = Convert.ToInt64(gpuObj["AdapterRAM"]); + si.gpu.GPUDriver = gpuObj["DriverVersion"].ToString(); + } + ManagementObjectSearcher ram = new ManagementObjectSearcher("select * from Win32_PhysicalMemory "); + Int64 capacity = 0; + int sticks = 0; + foreach (ManagementObject ramObj in ram.Get()) + { + capacity += Convert.ToInt64(ramObj["Capacity"]); + sticks += 1; + si.ram.FormFactor = Convert.ToInt32(ramObj["FormFactor"]); + si.ram.PartNumber = ramObj["PartNumber"].ToString(); + si.ram.RamSpeed = Convert.ToInt32(ramObj["ConfiguredClockSpeed"]); + si.ram.RamVolts = Convert.ToInt32(ramObj["ConfiguredVoltage"]); + } + si.ram.totalCapcity = capacity; + si.ram.sticks = sticks; + ManagementObjectSearcher nac = new ManagementObjectSearcher("select * from Win32_NetworkAdapterConfiguration"); + foreach (ManagementObject nacObj in nac.Get()) + { + bool enabled = (bool)nacObj["IPEnabled"]; + if (enabled) + { + si.MACAddress = nacObj["MACAddress"].ToString(); + } + } + //UploadData(si, "https://api.osrtt.com/systemInfo"); + } + public void UploadRawData(List> rawData) + { + // thread this + string url = "https://api.osrtt.com/rawData"; + UploadData(rawData, url); + } + public void UploadGammaData(List gamma) + { + string url = "https://api.osrtt.com/gammaData"; + UploadData(gamma, url); + } + public void UploadTestLatency(List testLatency) + { + string url = "https://api.osrtt.com/testLatency"; + UploadData(testLatency, url); + } + public void UploadRunSettings(ProcessData.runSettings testLatency) + { + string url = "https://api.osrtt.com/runSetting"; + UploadData(testLatency, url); + } + + // PC config... + + public void ShareResults( + List> rawData, + List gamma, + List testLatency, + ProcessData.runSettings runSetting + // PC config + ) + { + Guid g = Guid.NewGuid(); + // put guid in request _somewhere_ + UploadRawData(rawData); + UploadGammaData(gamma); + UploadTestLatency(testLatency); + UploadRunSettings(runSetting); + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/Form1.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Form1.Designer.cs new file mode 100644 index 0000000..eded705 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Form1.Designer.cs @@ -0,0 +1,285 @@ +namespace OSRTT_Launcher +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.launchBtn = new System.Windows.Forms.Button(); + this.resultsBtn = new System.Windows.Forms.Button(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.deviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reconnectDeviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.checkDeviceFirmwareVersionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.resultsSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.devStatLbl = new System.Windows.Forms.Label(); + this.devStat = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.measFrm = new System.Windows.Forms.TextBox(); + this.measTo = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.updateTable = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.analyseResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.debugModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.SuspendLayout(); + // + // launchBtn + // + this.launchBtn.Font = new System.Drawing.Font("Arial Black", 16F, System.Drawing.FontStyle.Bold); + this.launchBtn.Location = new System.Drawing.Point(18, 59); + this.launchBtn.Name = "launchBtn"; + this.launchBtn.Size = new System.Drawing.Size(551, 46); + this.launchBtn.TabIndex = 0; + this.launchBtn.Text = "Launch Test"; + this.launchBtn.UseVisualStyleBackColor = true; + this.launchBtn.Click += new System.EventHandler(this.launchBtn_Click); + // + // resultsBtn + // + this.resultsBtn.Font = new System.Drawing.Font("Arial Black", 16F, System.Drawing.FontStyle.Bold); + this.resultsBtn.Location = new System.Drawing.Point(17, 89); + this.resultsBtn.Name = "resultsBtn"; + this.resultsBtn.Size = new System.Drawing.Size(552, 75); + this.resultsBtn.TabIndex = 1; + this.resultsBtn.Text = "Analyse Results"; + this.resultsBtn.UseVisualStyleBackColor = true; + this.resultsBtn.Click += new System.EventHandler(this.resultsBtn_Click); + // + // richTextBox1 + // + this.richTextBox1.Location = new System.Drawing.Point(723, 36); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(369, 760); + this.richTextBox1.TabIndex = 2; + this.richTextBox1.Text = ""; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.deviceToolStripMenuItem, + this.analyseResultsToolStripMenuItem, + this.resultsSettingsToolStripMenuItem, + this.debugModeToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(1104, 24); + this.menuStrip1.TabIndex = 4; + this.menuStrip1.Text = "menuStrip1"; + // + // deviceToolStripMenuItem + // + this.deviceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.reconnectDeviceToolStripMenuItem, + this.checkDeviceFirmwareVersionToolStripMenuItem}); + this.deviceToolStripMenuItem.Name = "deviceToolStripMenuItem"; + this.deviceToolStripMenuItem.Size = new System.Drawing.Size(54, 20); + this.deviceToolStripMenuItem.Text = "Device"; + // + // reconnectDeviceToolStripMenuItem + // + this.reconnectDeviceToolStripMenuItem.Name = "reconnectDeviceToolStripMenuItem"; + this.reconnectDeviceToolStripMenuItem.Size = new System.Drawing.Size(238, 22); + this.reconnectDeviceToolStripMenuItem.Text = "Reconnect Device"; + this.reconnectDeviceToolStripMenuItem.Click += new System.EventHandler(this.reconnectDeviceToolStripMenuItem_Click); + // + // checkDeviceFirmwareVersionToolStripMenuItem + // + this.checkDeviceFirmwareVersionToolStripMenuItem.Name = "checkDeviceFirmwareVersionToolStripMenuItem"; + this.checkDeviceFirmwareVersionToolStripMenuItem.Size = new System.Drawing.Size(238, 22); + this.checkDeviceFirmwareVersionToolStripMenuItem.Text = "Check Device Firmware Version"; + this.checkDeviceFirmwareVersionToolStripMenuItem.Click += new System.EventHandler(this.checkDeviceFirmwareVersionToolStripMenuItem_Click); + // + // resultsSettingsToolStripMenuItem + // + this.resultsSettingsToolStripMenuItem.Name = "resultsSettingsToolStripMenuItem"; + this.resultsSettingsToolStripMenuItem.Size = new System.Drawing.Size(101, 20); + this.resultsSettingsToolStripMenuItem.Text = "Results Settings"; + // + // devStatLbl + // + this.devStatLbl.AutoSize = true; + this.devStatLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.devStatLbl.Location = new System.Drawing.Point(13, 12); + this.devStatLbl.Name = "devStatLbl"; + this.devStatLbl.Size = new System.Drawing.Size(298, 25); + this.devStatLbl.TabIndex = 5; + this.devStatLbl.Text = "Device Connection Status: "; + // + // devStat + // + this.devStat.AutoSize = true; + this.devStat.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.devStat.Location = new System.Drawing.Point(317, 12); + this.devStat.Name = "devStat"; + this.devStat.Size = new System.Drawing.Size(252, 25); + this.devStat.TabIndex = 6; + this.devStat.Text = "Waiting for Connection"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 55); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(77, 13); + this.label1.TabIndex = 8; + this.label1.Text = "Measure From:"; + // + // measFrm + // + this.measFrm.Location = new System.Drawing.Point(96, 52); + this.measFrm.Name = "measFrm"; + this.measFrm.Size = new System.Drawing.Size(100, 20); + this.measFrm.TabIndex = 9; + // + // measTo + // + this.measTo.Location = new System.Drawing.Point(290, 52); + this.measTo.Name = "measTo"; + this.measTo.Size = new System.Drawing.Size(100, 20); + this.measTo.TabIndex = 11; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(217, 55); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(67, 13); + this.label2.TabIndex = 10; + this.label2.Text = "Measure To:"; + // + // updateTable + // + this.updateTable.Location = new System.Drawing.Point(422, 50); + this.updateTable.Name = "updateTable"; + this.updateTable.Size = new System.Drawing.Size(145, 23); + this.updateTable.TabIndex = 12; + this.updateTable.Text = "Update Results Table"; + this.updateTable.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(192, 12); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(200, 24); + this.label3.TabIndex = 13; + this.label3.Text = "Measurement Controls"; + // + // analyseResultsToolStripMenuItem + // + this.analyseResultsToolStripMenuItem.Name = "analyseResultsToolStripMenuItem"; + this.analyseResultsToolStripMenuItem.Size = new System.Drawing.Size(100, 20); + this.analyseResultsToolStripMenuItem.Text = "Analyse Results"; + this.analyseResultsToolStripMenuItem.Click += new System.EventHandler(this.analyseResultsToolStripMenuItem_Click); + // + // panel1 + // + this.panel1.Controls.Add(this.launchBtn); + this.panel1.Controls.Add(this.devStatLbl); + this.panel1.Controls.Add(this.devStat); + this.panel1.Location = new System.Drawing.Point(12, 36); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(588, 120); + this.panel1.TabIndex = 15; + this.panel1.Tag = ""; + // + // panel2 + // + this.panel2.Controls.Add(this.resultsBtn); + this.panel2.Controls.Add(this.label1); + this.panel2.Controls.Add(this.measFrm); + this.panel2.Controls.Add(this.label3); + this.panel2.Controls.Add(this.label2); + this.panel2.Controls.Add(this.updateTable); + this.panel2.Controls.Add(this.measTo); + this.panel2.Location = new System.Drawing.Point(12, 173); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(588, 183); + this.panel2.TabIndex = 16; + // + // debugModeToolStripMenuItem + // + this.debugModeToolStripMenuItem.Name = "debugModeToolStripMenuItem"; + this.debugModeToolStripMenuItem.Size = new System.Drawing.Size(88, 20); + this.debugModeToolStripMenuItem.Text = "Debug mode"; + this.debugModeToolStripMenuItem.Click += new System.EventHandler(this.debugModeToolStripMenuItem_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1104, 811); + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel1); + this.Controls.Add(this.menuStrip1); + this.Controls.Add(this.richTextBox1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form1"; + this.Text = "OSRTT Launcher"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button launchBtn; + private System.Windows.Forms.Button resultsBtn; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem deviceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem reconnectDeviceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem checkDeviceFirmwareVersionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem resultsSettingsToolStripMenuItem; + private System.Windows.Forms.Label devStatLbl; + private System.Windows.Forms.Label devStat; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox measFrm; + private System.Windows.Forms.TextBox measTo; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button updateTable; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ToolStripMenuItem analyseResultsToolStripMenuItem; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.ToolStripMenuItem debugModeToolStripMenuItem; + } +} + diff --git a/OSRTT Launcher/OSRTT Launcher/Form1.cs b/OSRTT Launcher/OSRTT Launcher/Form1.cs new file mode 100644 index 0000000..4a2525d --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Form1.cs @@ -0,0 +1,327 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Diagnostics; +using System.IO.Ports; +using Microsoft.Management.Infrastructure; +using System.Management; +using System.Threading; + +namespace OSRTT_Launcher +{ + public partial class Form1 : Form + { + // TODO + // Get system refresh rate? + // + // Actually save data into Results dictionary + // Save contents of dictionary to CSV "000-OSRTT-RAW-RESULTS.csv" + // Low ish priority - fix get firmware version + // LOW PRIORITY - Possibly set RGB values in C# + // Ultra low priority - Find monitor name if possible to save results file under than name + + + + + public static System.IO.Ports.SerialPort port; + delegate void SetTextCallback(string text); + private bool boardConfirmed = false; + private bool portConnected = false; + private int[] RGBArr; + private int resultsCounter = 0; + private int resultsLimit = 110; + class Results + { + public int FromRGB { get; set; } + public int ToRGB { get; set; } + public int SampleTime { get; set; } + public int SampleNum { get; set; } + public int[] Vals { get; set; } + } + private Dictionary res; + + // This BackgroundWorker is used to demonstrate the + // preferred way of performing asynchronous operations. + private BackgroundWorker hardWorker; + + private Thread readThread = null; + private Thread connectThread = null; + + public Form1() + { + InitializeComponent(); + this.launchBtn.Enabled = false; + this.FormClosed += new FormClosedEventHandler(Form1_FormClosed); + hardWorker = new BackgroundWorker(); + connectThread = new Thread(new ThreadStart(this.findAndConnectToBoard)); + connectThread.Start(); + Size = new Size(630, 206); + + + + + + } + private void findAndConnectToBoard() + { + while (true) + { + if (!portConnected) + { + foreach (string s in SerialPort.GetPortNames().Reverse()) + { + Console.WriteLine(s); + if (!portConnected) + { + connectToBoard(s); + } + else + { + break; + } + + } + } + else + { + Thread.Sleep(2000); + } + + } + + } + + private void connectToBoard(String comPort) + { + + System.ComponentModel.IContainer components = + new System.ComponentModel.Container(); + port = new System.IO.Ports.SerialPort(components); + port.PortName = comPort; + port.BaudRate = 115200; + port.DtrEnable = true; + port.ReadTimeout = 5000; + port.WriteTimeout = 500; + Console.WriteLine("Port details set"); + try + { port.Open(); } + catch (Exception ex) + { Console.WriteLine(ex); } + + if (port.IsOpen) + { + portConnected = true; + readThread = new Thread(new ThreadStart(this.Read)); + readThread.Start(); + this.hardWorker.RunWorkerAsync(); + + + + + // Check if board is correct, reading verification string + + // Have board send RGB Array to load in C# + + } + else + { + SetDeviceStatus("Board Disconnected"); + } + } + + private void sendText(String textToSend) + { + if (port.IsOpen) + { + port.Write(textToSend); + } + } + + private void SetDeviceStatus(string text) + { + // InvokeRequired required compares the thread ID of the + // calling thread to the thread ID of the creating thread. + // If these threads are different, it returns true. + if (this.devStat.InvokeRequired) + { + SetTextCallback d = new SetTextCallback(SetDeviceStatus); + this.Invoke(d, new object[] { text }); //check if this needs to be an array + } + else + { + this.devStat.Text = text; + + } + } + + private void SetText(string text) + { + // InvokeRequired required compares the thread ID of the + // calling thread to the thread ID of the creating thread. + // If these threads are different, it returns true. + if (this.richTextBox1.InvokeRequired) + { + SetTextCallback d = new SetTextCallback(SetText); + this.Invoke(d, new object[] { text }); + } + else + { + this.richTextBox1.Text += text; + this.richTextBox1.Text += "\n"; + } + } + + public void Read() + { + + while (port.IsOpen) + { + try + { + string message = port.ReadLine(); + Console.WriteLine(message); + if (!boardConfirmed) + { + if (message.Contains("OSRTT")) + { + boardConfirmed = true; + SetDeviceStatus("Connected to Device!"); + this.launchBtn.Enabled = true; // Invoke this too + port.Write("1"); + } + else if (message.Contains("Established")) + { + Console.WriteLine("C# Check"); + port.Write("RST"); + } + } + else if (message.Contains("RGB Array")) + { + string newMessage = message.Remove(0, 12); + string[] values = newMessage.Split(','); + RGBArr = new int[values.Length - 1]; + int counter = 0; + foreach (string s in values) + { + Console.WriteLine("String = " + s); + if (s.Length == 1 && !s.Contains("0")) + { + Console.WriteLine("Filtered the bugger"); + } + else + { + RGBArr[counter] = int.Parse(s); + Console.WriteLine(RGBArr[counter]); // stop it from recording the last empty value + counter++; + } + + + } + Console.Write("RGBArr Length: "); + Console.WriteLine(RGBArr.Length); + + resultsLimit = RGBArr.Length * (RGBArr.Length - 1); + Console.Write("Results Limit: "); + Console.WriteLine(resultsLimit); + } + else if (message.Contains("Result")) + { + // Split results + String newMessage = message.Remove(0, 7); + string[] values = newMessage.Split(','); + int[] intValues = Array.ConvertAll(values, int.Parse); + int fromRGBVal = intValues[0]; + int toRGBVal = intValues[1]; + int sampleTimeVal = intValues[2]; + int sampleNumVal = intValues[3]; + intValues = intValues.Where((source, index) => index > 3).ToArray(); + // Check if this shit works. + // + res = new Dictionary(); + res.Add(resultsCounter, new Results { FromRGB = fromRGBVal, ToRGB = toRGBVal, SampleTime = sampleTimeVal, SampleNum = sampleTimeVal, Vals = intValues }); + resultsCounter++; + Console.WriteLine(res[resultsCounter].FromRGB + " " + res[0].Vals.Length); + if (resultsCounter == resultsLimit) + { + resultsCounter = 0; + // Flush dictionary + } + } + else if (message.Contains("FW:")) + { + MessageBox.Show(message, "Firmware Version", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + this.SetText(message); + } + } + catch (Exception ex) { + Console.WriteLine(ex); + Console.WriteLine("Trying to reconnect"); + port.Close(); + portConnected = false; + boardConfirmed = false; + this.launchBtn.Enabled = false; // invoke via thread... + SetDeviceStatus("Board Disconnected"); + readThread.Abort(); + // findAndConnectToBoard(); + } + } + } + + private void Form1_FormClosed(object sender, FormClosedEventArgs e) + { + // When form is closed halt read thread & close Serial Port + readThread.Abort(); + connectThread.Abort(); + port.Close(); + + } + + private void launchBtn_Click(object sender, EventArgs e) + { + Size = new Size(1145, 868); + // richTextBox1.Text = sb.ToString(); + } + + private void resultsBtn_Click(object sender, EventArgs e) + { + // Save results table to csv + } + + private void reconnectDeviceToolStripMenuItem_Click(object sender, EventArgs e) + { + findAndConnectToBoard(); + } + + private void checkDeviceFirmwareVersionToolStripMenuItem_Click(object sender, EventArgs e) + { + if (port.IsOpen) + { + Console.WriteLine("Checking Firmware version..."); + port.Write("FW"); + } + else + { + MessageBox.Show("Please connect to the device first!", "Firmware Version", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void analyseResultsToolStripMenuItem_Click(object sender, EventArgs e) + { + Size = new Size(630, 406); + } + + private void debugModeToolStripMenuItem_Click(object sender, EventArgs e) + { + Size = new Size(1120, 850); + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/Form1.resx b/OSRTT Launcher/OSRTT Launcher/Form1.resx new file mode 100644 index 0000000..9c7af5a --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 34, 22 + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/Heatmaps.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Heatmaps.Designer.cs new file mode 100644 index 0000000..14fae2f --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Heatmaps.Designer.cs @@ -0,0 +1,929 @@ + +namespace OSRTT_Launcher +{ + partial class Heatmaps + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + this.standardResultsPanel = new System.Windows.Forms.Panel(); + this.runSettingsView = new System.Windows.Forms.DataGridView(); + this.panel5 = new System.Windows.Forms.Panel(); + this.panel6 = new System.Windows.Forms.Panel(); + this.vrrGreenLbl = new System.Windows.Forms.Label(); + this.panel7 = new System.Windows.Forms.Panel(); + this.vrrOrangeLbl = new System.Windows.Forms.Label(); + this.panel8 = new System.Windows.Forms.Panel(); + this.vrrRedLbl = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.osGreenLbl = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.osOrangeLbl = new System.Windows.Forms.Label(); + this.panel4 = new System.Windows.Forms.Panel(); + this.osRedLbl = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.rtKeyPanel = new System.Windows.Forms.Panel(); + this.rtGreen = new System.Windows.Forms.Panel(); + this.rtGreenLbl = new System.Windows.Forms.Label(); + this.rtOrange = new System.Windows.Forms.Panel(); + this.rtOrangeLbl = new System.Windows.Forms.Label(); + this.rtRed = new System.Windows.Forms.Panel(); + this.rtRedLbl = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.rtStatsRefreshGridView = new System.Windows.Forms.DataGridView(); + this.vrrSubTitle = new System.Windows.Forms.Label(); + this.vrrTitle = new System.Windows.Forms.Label(); + this.osSubTitle = new System.Windows.Forms.Label(); + this.osTitle = new System.Windows.Forms.Label(); + this.rtSubTitle = new System.Windows.Forms.Label(); + this.vrrStatsGridView = new System.Windows.Forms.DataGridView(); + this.osStatsGridView = new System.Windows.Forms.DataGridView(); + this.rtStatsGridView = new System.Windows.Forms.DataGridView(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.rtTitle = new System.Windows.Forms.Label(); + this.vrrGridView = new System.Windows.Forms.DataGridView(); + this.osGridView = new System.Windows.Forms.DataGridView(); + this.rtGridView = new System.Windows.Forms.DataGridView(); + this.from2 = new System.Windows.Forms.Label(); + this.from3 = new System.Windows.Forms.Label(); + this.from1 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.standardResultsPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.runSettingsView)).BeginInit(); + this.panel5.SuspendLayout(); + this.panel6.SuspendLayout(); + this.panel7.SuspendLayout(); + this.panel8.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.panel3.SuspendLayout(); + this.panel4.SuspendLayout(); + this.rtKeyPanel.SuspendLayout(); + this.rtGreen.SuspendLayout(); + this.rtOrange.SuspendLayout(); + this.rtRed.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.rtStatsRefreshGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.vrrStatsGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.osStatsGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rtStatsGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.vrrGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.osGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rtGridView)).BeginInit(); + this.SuspendLayout(); + // + // standardResultsPanel + // + this.standardResultsPanel.BackColor = System.Drawing.Color.Transparent; + this.standardResultsPanel.Controls.Add(this.runSettingsView); + this.standardResultsPanel.Controls.Add(this.panel5); + this.standardResultsPanel.Controls.Add(this.panel1); + this.standardResultsPanel.Controls.Add(this.rtKeyPanel); + this.standardResultsPanel.Controls.Add(this.rtStatsRefreshGridView); + this.standardResultsPanel.Controls.Add(this.vrrSubTitle); + this.standardResultsPanel.Controls.Add(this.vrrTitle); + this.standardResultsPanel.Controls.Add(this.osSubTitle); + this.standardResultsPanel.Controls.Add(this.osTitle); + this.standardResultsPanel.Controls.Add(this.rtSubTitle); + this.standardResultsPanel.Controls.Add(this.vrrStatsGridView); + this.standardResultsPanel.Controls.Add(this.osStatsGridView); + this.standardResultsPanel.Controls.Add(this.rtStatsGridView); + this.standardResultsPanel.Controls.Add(this.pictureBox1); + this.standardResultsPanel.Controls.Add(this.rtTitle); + this.standardResultsPanel.Controls.Add(this.vrrGridView); + this.standardResultsPanel.Controls.Add(this.osGridView); + this.standardResultsPanel.Controls.Add(this.rtGridView); + this.standardResultsPanel.Controls.Add(this.from2); + this.standardResultsPanel.Controls.Add(this.from3); + this.standardResultsPanel.Controls.Add(this.from1); + this.standardResultsPanel.Controls.Add(this.label12); + this.standardResultsPanel.Controls.Add(this.label10); + this.standardResultsPanel.Controls.Add(this.label9); + this.standardResultsPanel.Location = new System.Drawing.Point(0, 0); + this.standardResultsPanel.Name = "standardResultsPanel"; + this.standardResultsPanel.Size = new System.Drawing.Size(1775, 950); + this.standardResultsPanel.TabIndex = 3; + // + // runSettingsView + // + this.runSettingsView.AllowUserToAddRows = false; + this.runSettingsView.AllowUserToDeleteRows = false; + this.runSettingsView.AllowUserToResizeColumns = false; + this.runSettingsView.AllowUserToResizeRows = false; + this.runSettingsView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.runSettingsView.ColumnHeadersHeight = 40; + this.runSettingsView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.runSettingsView.ColumnHeadersVisible = false; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.runSettingsView.DefaultCellStyle = dataGridViewCellStyle1; + this.runSettingsView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.runSettingsView.EnableHeadersVisualStyles = false; + this.runSettingsView.GridColor = System.Drawing.Color.White; + this.runSettingsView.Location = new System.Drawing.Point(636, 603); + this.runSettingsView.MultiSelect = false; + this.runSettingsView.Name = "runSettingsView"; + this.runSettingsView.ReadOnly = true; + this.runSettingsView.RowHeadersVisible = false; + this.runSettingsView.RowHeadersWidth = 65; + this.runSettingsView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.runSettingsView.RowTemplate.Height = 35; + this.runSettingsView.RowTemplate.ReadOnly = true; + this.runSettingsView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.runSettingsView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.runSettingsView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.runSettingsView.ShowCellToolTips = false; + this.runSettingsView.ShowEditingIcon = false; + this.runSettingsView.Size = new System.Drawing.Size(450, 105); + this.runSettingsView.TabIndex = 41; + // + // panel5 + // + this.panel5.BackColor = System.Drawing.Color.White; + this.panel5.Controls.Add(this.panel6); + this.panel5.Controls.Add(this.panel7); + this.panel5.Controls.Add(this.panel8); + this.panel5.Controls.Add(this.label11); + this.panel5.Location = new System.Drawing.Point(1258, 816); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(200, 66); + this.panel5.TabIndex = 40; + // + // panel6 + // + this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(186)))), ((int)(((byte)(92))))); + this.panel6.Controls.Add(this.vrrGreenLbl); + this.panel6.Location = new System.Drawing.Point(133, 32); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(67, 34); + this.panel6.TabIndex = 3; + // + // vrrGreenLbl + // + this.vrrGreenLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vrrGreenLbl.ForeColor = System.Drawing.Color.White; + this.vrrGreenLbl.Location = new System.Drawing.Point(0, 1); + this.vrrGreenLbl.Name = "vrrGreenLbl"; + this.vrrGreenLbl.Size = new System.Drawing.Size(67, 33); + this.vrrGreenLbl.TabIndex = 2; + this.vrrGreenLbl.Text = "95"; + this.vrrGreenLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(183)))), ((int)(((byte)(98))))); + this.panel7.Controls.Add(this.vrrOrangeLbl); + this.panel7.Location = new System.Drawing.Point(66, 32); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(67, 34); + this.panel7.TabIndex = 2; + // + // vrrOrangeLbl + // + this.vrrOrangeLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vrrOrangeLbl.ForeColor = System.Drawing.Color.White; + this.vrrOrangeLbl.Location = new System.Drawing.Point(0, 1); + this.vrrOrangeLbl.Name = "vrrOrangeLbl"; + this.vrrOrangeLbl.Size = new System.Drawing.Size(67, 33); + this.vrrOrangeLbl.TabIndex = 2; + this.vrrOrangeLbl.Text = "85"; + this.vrrOrangeLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel8 + // + this.panel8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(73)))), ((int)(((byte)(70))))); + this.panel8.Controls.Add(this.vrrRedLbl); + this.panel8.Location = new System.Drawing.Point(-1, 32); + this.panel8.Name = "panel8"; + this.panel8.Size = new System.Drawing.Size(67, 34); + this.panel8.TabIndex = 1; + // + // vrrRedLbl + // + this.vrrRedLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vrrRedLbl.ForeColor = System.Drawing.Color.White; + this.vrrRedLbl.Location = new System.Drawing.Point(0, 0); + this.vrrRedLbl.Name = "vrrRedLbl"; + this.vrrRedLbl.Size = new System.Drawing.Size(67, 33); + this.vrrRedLbl.TabIndex = 1; + this.vrrRedLbl.Text = "75"; + this.vrrRedLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label11.Location = new System.Drawing.Point(0, 1); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(201, 27); + this.label11.TabIndex = 0; + this.label11.Text = "Response Rating Key"; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.White; + this.panel1.Controls.Add(this.panel2); + this.panel1.Controls.Add(this.panel3); + this.panel1.Controls.Add(this.panel4); + this.panel1.Controls.Add(this.label5); + this.panel1.Location = new System.Drawing.Point(951, 818); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(200, 66); + this.panel1.TabIndex = 40; + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(186)))), ((int)(((byte)(92))))); + this.panel2.Controls.Add(this.osGreenLbl); + this.panel2.Location = new System.Drawing.Point(133, 32); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(67, 34); + this.panel2.TabIndex = 3; + // + // osGreenLbl + // + this.osGreenLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osGreenLbl.ForeColor = System.Drawing.Color.White; + this.osGreenLbl.Location = new System.Drawing.Point(0, 1); + this.osGreenLbl.Name = "osGreenLbl"; + this.osGreenLbl.Size = new System.Drawing.Size(67, 33); + this.osGreenLbl.TabIndex = 2; + this.osGreenLbl.Text = "5"; + this.osGreenLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel3 + // + this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(183)))), ((int)(((byte)(98))))); + this.panel3.Controls.Add(this.osOrangeLbl); + this.panel3.Location = new System.Drawing.Point(66, 32); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(67, 34); + this.panel3.TabIndex = 2; + // + // osOrangeLbl + // + this.osOrangeLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osOrangeLbl.ForeColor = System.Drawing.Color.White; + this.osOrangeLbl.Location = new System.Drawing.Point(0, 1); + this.osOrangeLbl.Name = "osOrangeLbl"; + this.osOrangeLbl.Size = new System.Drawing.Size(67, 33); + this.osOrangeLbl.TabIndex = 2; + this.osOrangeLbl.Text = "10"; + this.osOrangeLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel4 + // + this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(73)))), ((int)(((byte)(70))))); + this.panel4.Controls.Add(this.osRedLbl); + this.panel4.Location = new System.Drawing.Point(-1, 32); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(67, 34); + this.panel4.TabIndex = 1; + // + // osRedLbl + // + this.osRedLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osRedLbl.ForeColor = System.Drawing.Color.White; + this.osRedLbl.Location = new System.Drawing.Point(0, 0); + this.osRedLbl.Name = "osRedLbl"; + this.osRedLbl.Size = new System.Drawing.Size(67, 33); + this.osRedLbl.TabIndex = 1; + this.osRedLbl.Text = "15"; + this.osRedLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(27, 1); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(147, 27); + this.label5.TabIndex = 0; + this.label5.Text = "Overshoot Key"; + // + // rtKeyPanel + // + this.rtKeyPanel.BackColor = System.Drawing.Color.White; + this.rtKeyPanel.Controls.Add(this.rtGreen); + this.rtKeyPanel.Controls.Add(this.rtOrange); + this.rtKeyPanel.Controls.Add(this.rtRed); + this.rtKeyPanel.Controls.Add(this.label1); + this.rtKeyPanel.Location = new System.Drawing.Point(636, 817); + this.rtKeyPanel.Name = "rtKeyPanel"; + this.rtKeyPanel.Size = new System.Drawing.Size(200, 66); + this.rtKeyPanel.TabIndex = 39; + // + // rtGreen + // + this.rtGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(186)))), ((int)(((byte)(92))))); + this.rtGreen.Controls.Add(this.rtGreenLbl); + this.rtGreen.Location = new System.Drawing.Point(133, 32); + this.rtGreen.Name = "rtGreen"; + this.rtGreen.Size = new System.Drawing.Size(67, 34); + this.rtGreen.TabIndex = 3; + // + // rtGreenLbl + // + this.rtGreenLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtGreenLbl.ForeColor = System.Drawing.Color.White; + this.rtGreenLbl.Location = new System.Drawing.Point(0, 1); + this.rtGreenLbl.Name = "rtGreenLbl"; + this.rtGreenLbl.Size = new System.Drawing.Size(67, 33); + this.rtGreenLbl.TabIndex = 2; + this.rtGreenLbl.Text = "1"; + this.rtGreenLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // rtOrange + // + this.rtOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(183)))), ((int)(((byte)(98))))); + this.rtOrange.Controls.Add(this.rtOrangeLbl); + this.rtOrange.Location = new System.Drawing.Point(66, 32); + this.rtOrange.Name = "rtOrange"; + this.rtOrange.Size = new System.Drawing.Size(67, 34); + this.rtOrange.TabIndex = 2; + // + // rtOrangeLbl + // + this.rtOrangeLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtOrangeLbl.ForeColor = System.Drawing.Color.White; + this.rtOrangeLbl.Location = new System.Drawing.Point(0, 1); + this.rtOrangeLbl.Name = "rtOrangeLbl"; + this.rtOrangeLbl.Size = new System.Drawing.Size(67, 33); + this.rtOrangeLbl.TabIndex = 2; + this.rtOrangeLbl.Text = "5"; + this.rtOrangeLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // rtRed + // + this.rtRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(73)))), ((int)(((byte)(70))))); + this.rtRed.Controls.Add(this.rtRedLbl); + this.rtRed.Location = new System.Drawing.Point(-1, 32); + this.rtRed.Name = "rtRed"; + this.rtRed.Size = new System.Drawing.Size(67, 34); + this.rtRed.TabIndex = 1; + // + // rtRedLbl + // + this.rtRedLbl.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtRedLbl.ForeColor = System.Drawing.Color.White; + this.rtRedLbl.Location = new System.Drawing.Point(0, 0); + this.rtRedLbl.Name = "rtRedLbl"; + this.rtRedLbl.Size = new System.Drawing.Size(67, 33); + this.rtRedLbl.TabIndex = 1; + this.rtRedLbl.Text = "10"; + this.rtRedLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(6, 1); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(188, 27); + this.label1.TabIndex = 0; + this.label1.Text = "Response Time Key"; + // + // rtStatsRefreshGridView + // + this.rtStatsRefreshGridView.AllowUserToAddRows = false; + this.rtStatsRefreshGridView.AllowUserToDeleteRows = false; + this.rtStatsRefreshGridView.AllowUserToResizeColumns = false; + this.rtStatsRefreshGridView.AllowUserToResizeRows = false; + this.rtStatsRefreshGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.rtStatsRefreshGridView.ColumnHeadersHeight = 40; + this.rtStatsRefreshGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.rtStatsRefreshGridView.ColumnHeadersVisible = false; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.rtStatsRefreshGridView.DefaultCellStyle = dataGridViewCellStyle2; + this.rtStatsRefreshGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.rtStatsRefreshGridView.EnableHeadersVisualStyles = false; + this.rtStatsRefreshGridView.GridColor = System.Drawing.Color.White; + this.rtStatsRefreshGridView.Location = new System.Drawing.Point(57, 462); + this.rtStatsRefreshGridView.MultiSelect = false; + this.rtStatsRefreshGridView.Name = "rtStatsRefreshGridView"; + this.rtStatsRefreshGridView.ReadOnly = true; + this.rtStatsRefreshGridView.RowHeadersVisible = false; + this.rtStatsRefreshGridView.RowHeadersWidth = 65; + this.rtStatsRefreshGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.rtStatsRefreshGridView.RowTemplate.Height = 35; + this.rtStatsRefreshGridView.RowTemplate.ReadOnly = true; + this.rtStatsRefreshGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.rtStatsRefreshGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.rtStatsRefreshGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.rtStatsRefreshGridView.ShowCellToolTips = false; + this.rtStatsRefreshGridView.ShowEditingIcon = false; + this.rtStatsRefreshGridView.Size = new System.Drawing.Size(450, 105); + this.rtStatsRefreshGridView.TabIndex = 38; + // + // vrrSubTitle + // + this.vrrSubTitle.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vrrSubTitle.ForeColor = System.Drawing.Color.Black; + this.vrrSubTitle.Location = new System.Drawing.Point(1264, 69); + this.vrrSubTitle.Name = "vrrSubTitle"; + this.vrrSubTitle.Size = new System.Drawing.Size(377, 28); + this.vrrSubTitle.TabIndex = 37; + this.vrrSubTitle.Text = "Score out of 100 on visible performance"; + this.vrrSubTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // vrrTitle + // + this.vrrTitle.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.vrrTitle.ForeColor = System.Drawing.Color.Black; + this.vrrTitle.Location = new System.Drawing.Point(1264, 36); + this.vrrTitle.Name = "vrrTitle"; + this.vrrTitle.Size = new System.Drawing.Size(377, 36); + this.vrrTitle.TabIndex = 36; + this.vrrTitle.Text = "Visual Response Rating"; + this.vrrTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // osSubTitle + // + this.osSubTitle.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osSubTitle.ForeColor = System.Drawing.Color.Black; + this.osSubTitle.Location = new System.Drawing.Point(676, 69); + this.osSubTitle.Name = "osSubTitle"; + this.osSubTitle.Size = new System.Drawing.Size(377, 28); + this.osSubTitle.TabIndex = 35; + this.osSubTitle.Text = "RGB Values above the target"; + this.osSubTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // osTitle + // + this.osTitle.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osTitle.ForeColor = System.Drawing.Color.Black; + this.osTitle.Location = new System.Drawing.Point(676, 36); + this.osTitle.Name = "osTitle"; + this.osTitle.Size = new System.Drawing.Size(377, 36); + this.osTitle.TabIndex = 34; + this.osTitle.Text = "RGB Overshoot"; + this.osTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // rtSubTitle + // + this.rtSubTitle.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtSubTitle.ForeColor = System.Drawing.Color.Black; + this.rtSubTitle.Location = new System.Drawing.Point(100, 69); + this.rtSubTitle.Name = "rtSubTitle"; + this.rtSubTitle.Size = new System.Drawing.Size(377, 28); + this.rtSubTitle.TabIndex = 33; + this.rtSubTitle.Text = "Fixed RGB 5 Tolerance"; + this.rtSubTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // vrrStatsGridView + // + this.vrrStatsGridView.AllowUserToAddRows = false; + this.vrrStatsGridView.AllowUserToDeleteRows = false; + this.vrrStatsGridView.AllowUserToResizeColumns = false; + this.vrrStatsGridView.AllowUserToResizeRows = false; + this.vrrStatsGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.vrrStatsGridView.ColumnHeadersHeight = 40; + this.vrrStatsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.vrrStatsGridView.ColumnHeadersVisible = false; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.vrrStatsGridView.DefaultCellStyle = dataGridViewCellStyle3; + this.vrrStatsGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.vrrStatsGridView.EnableHeadersVisualStyles = false; + this.vrrStatsGridView.GridColor = System.Drawing.Color.White; + this.vrrStatsGridView.Location = new System.Drawing.Point(1225, 464); + this.vrrStatsGridView.MultiSelect = false; + this.vrrStatsGridView.Name = "vrrStatsGridView"; + this.vrrStatsGridView.ReadOnly = true; + this.vrrStatsGridView.RowHeadersVisible = false; + this.vrrStatsGridView.RowHeadersWidth = 65; + this.vrrStatsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.vrrStatsGridView.RowTemplate.Height = 35; + this.vrrStatsGridView.RowTemplate.ReadOnly = true; + this.vrrStatsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.vrrStatsGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.vrrStatsGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.vrrStatsGridView.ShowCellToolTips = false; + this.vrrStatsGridView.ShowEditingIcon = false; + this.vrrStatsGridView.Size = new System.Drawing.Size(450, 173); + this.vrrStatsGridView.TabIndex = 32; + // + // osStatsGridView + // + this.osStatsGridView.AllowUserToAddRows = false; + this.osStatsGridView.AllowUserToDeleteRows = false; + this.osStatsGridView.AllowUserToResizeColumns = false; + this.osStatsGridView.AllowUserToResizeRows = false; + this.osStatsGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.osStatsGridView.ColumnHeadersHeight = 40; + this.osStatsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.osStatsGridView.ColumnHeadersVisible = false; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.osStatsGridView.DefaultCellStyle = dataGridViewCellStyle4; + this.osStatsGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.osStatsGridView.EnableHeadersVisualStyles = false; + this.osStatsGridView.GridColor = System.Drawing.Color.White; + this.osStatsGridView.Location = new System.Drawing.Point(636, 463); + this.osStatsGridView.MultiSelect = false; + this.osStatsGridView.Name = "osStatsGridView"; + this.osStatsGridView.ReadOnly = true; + this.osStatsGridView.RowHeadersVisible = false; + this.osStatsGridView.RowHeadersWidth = 65; + this.osStatsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.osStatsGridView.RowTemplate.Height = 35; + this.osStatsGridView.RowTemplate.ReadOnly = true; + this.osStatsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.osStatsGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.osStatsGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.osStatsGridView.ShowCellToolTips = false; + this.osStatsGridView.ShowEditingIcon = false; + this.osStatsGridView.Size = new System.Drawing.Size(450, 105); + this.osStatsGridView.TabIndex = 31; + // + // rtStatsGridView + // + this.rtStatsGridView.AllowUserToAddRows = false; + this.rtStatsGridView.AllowUserToDeleteRows = false; + this.rtStatsGridView.AllowUserToResizeColumns = false; + this.rtStatsGridView.AllowUserToResizeRows = false; + this.rtStatsGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.rtStatsGridView.ColumnHeadersHeight = 40; + this.rtStatsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.rtStatsGridView.ColumnHeadersVisible = false; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle5.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.rtStatsGridView.DefaultCellStyle = dataGridViewCellStyle5; + this.rtStatsGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.rtStatsGridView.EnableHeadersVisualStyles = false; + this.rtStatsGridView.GridColor = System.Drawing.Color.White; + this.rtStatsGridView.Location = new System.Drawing.Point(57, 603); + this.rtStatsGridView.MultiSelect = false; + this.rtStatsGridView.Name = "rtStatsGridView"; + this.rtStatsGridView.ReadOnly = true; + this.rtStatsGridView.RowHeadersVisible = false; + this.rtStatsGridView.RowHeadersWidth = 65; + this.rtStatsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.rtStatsGridView.RowTemplate.Height = 35; + this.rtStatsGridView.RowTemplate.ReadOnly = true; + this.rtStatsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.rtStatsGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.rtStatsGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.rtStatsGridView.ShowCellToolTips = false; + this.rtStatsGridView.ShowEditingIcon = false; + this.rtStatsGridView.Size = new System.Drawing.Size(450, 280); + this.rtStatsGridView.TabIndex = 30; + // + // pictureBox1 + // + this.pictureBox1.Image = global::OSRTT_Launcher.Properties.Resources.icon_wide; + this.pictureBox1.Location = new System.Drawing.Point(1587, 791); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(163, 93); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 29; + this.pictureBox1.TabStop = false; + // + // rtTitle + // + this.rtTitle.Font = new System.Drawing.Font("Calibri", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtTitle.ForeColor = System.Drawing.Color.Black; + this.rtTitle.Location = new System.Drawing.Point(100, 36); + this.rtTitle.Name = "rtTitle"; + this.rtTitle.Size = new System.Drawing.Size(377, 36); + this.rtTitle.TabIndex = 28; + this.rtTitle.Text = "Perceived Response Time"; + this.rtTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // vrrGridView + // + this.vrrGridView.AllowUserToAddRows = false; + this.vrrGridView.AllowUserToDeleteRows = false; + this.vrrGridView.AllowUserToResizeColumns = false; + this.vrrGridView.AllowUserToResizeRows = false; + this.vrrGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.vrrGridView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.vrrGridView.ColumnHeadersHeight = 50; + this.vrrGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.vrrGridView.DefaultCellStyle = dataGridViewCellStyle6; + this.vrrGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.vrrGridView.EnableHeadersVisualStyles = false; + this.vrrGridView.GridColor = System.Drawing.Color.White; + this.vrrGridView.Location = new System.Drawing.Point(1186, 100); + this.vrrGridView.MultiSelect = false; + this.vrrGridView.Name = "vrrGridView"; + this.vrrGridView.ReadOnly = true; + this.vrrGridView.RowHeadersWidth = 75; + this.vrrGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.vrrGridView.RowTemplate.Height = 35; + this.vrrGridView.RowTemplate.ReadOnly = true; + this.vrrGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.vrrGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.vrrGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.vrrGridView.ShowCellToolTips = false; + this.vrrGridView.ShowEditingIcon = false; + this.vrrGridView.Size = new System.Drawing.Size(525, 290); + this.vrrGridView.TabIndex = 9; + // + // osGridView + // + this.osGridView.AllowUserToAddRows = false; + this.osGridView.AllowUserToDeleteRows = false; + this.osGridView.AllowUserToResizeColumns = false; + this.osGridView.AllowUserToResizeRows = false; + this.osGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.osGridView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.osGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; + this.osGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; + this.osGridView.ColumnHeadersHeight = 50; + this.osGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.osGridView.DefaultCellStyle = dataGridViewCellStyle7; + this.osGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.osGridView.EnableHeadersVisualStyles = false; + this.osGridView.GridColor = System.Drawing.Color.White; + this.osGridView.Location = new System.Drawing.Point(603, 100); + this.osGridView.MultiSelect = false; + this.osGridView.Name = "osGridView"; + this.osGridView.ReadOnly = true; + this.osGridView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; + this.osGridView.RowHeadersWidth = 75; + this.osGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.osGridView.RowTemplate.Height = 35; + this.osGridView.RowTemplate.ReadOnly = true; + this.osGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.osGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.osGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.osGridView.ShowCellErrors = false; + this.osGridView.ShowCellToolTips = false; + this.osGridView.ShowEditingIcon = false; + this.osGridView.Size = new System.Drawing.Size(525, 290); + this.osGridView.TabIndex = 8; + // + // rtGridView + // + this.rtGridView.AllowUserToAddRows = false; + this.rtGridView.AllowUserToDeleteRows = false; + this.rtGridView.AllowUserToResizeColumns = false; + this.rtGridView.AllowUserToResizeRows = false; + this.rtGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; + this.rtGridView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.rtGridView.ColumnHeadersHeight = 50; + this.rtGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle8.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.rtGridView.DefaultCellStyle = dataGridViewCellStyle8; + this.rtGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.rtGridView.EnableHeadersVisualStyles = false; + this.rtGridView.GridColor = System.Drawing.Color.White; + this.rtGridView.Location = new System.Drawing.Point(26, 100); + this.rtGridView.MultiSelect = false; + this.rtGridView.Name = "rtGridView"; + this.rtGridView.ReadOnly = true; + this.rtGridView.RowHeadersWidth = 75; + this.rtGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this.rtGridView.RowTemplate.Height = 35; + this.rtGridView.RowTemplate.ReadOnly = true; + this.rtGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.rtGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.rtGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.rtGridView.ShowCellErrors = false; + this.rtGridView.ShowCellToolTips = false; + this.rtGridView.ShowEditingIcon = false; + this.rtGridView.Size = new System.Drawing.Size(525, 290); + this.rtGridView.TabIndex = 7; + // + // from2 + // + this.from2.AutoSize = true; + this.from2.BackColor = System.Drawing.Color.Transparent; + this.from2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.from2.ForeColor = System.Drawing.Color.Black; + this.from2.Location = new System.Drawing.Point(605, 393); + this.from2.Name = "from2"; + this.from2.Size = new System.Drawing.Size(67, 26); + this.from2.TabIndex = 24; + this.from2.Text = "From"; + // + // from3 + // + this.from3.AutoSize = true; + this.from3.BackColor = System.Drawing.Color.Transparent; + this.from3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.from3.ForeColor = System.Drawing.Color.Black; + this.from3.Location = new System.Drawing.Point(1189, 393); + this.from3.Name = "from3"; + this.from3.Size = new System.Drawing.Size(67, 26); + this.from3.TabIndex = 26; + this.from3.Text = "From"; + // + // from1 + // + this.from1.AutoSize = true; + this.from1.BackColor = System.Drawing.Color.Transparent; + this.from1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.from1.ForeColor = System.Drawing.Color.Black; + this.from1.Location = new System.Drawing.Point(28, 393); + this.from1.Name = "from1"; + this.from1.Size = new System.Drawing.Size(67, 26); + this.from1.TabIndex = 22; + this.from1.Text = "From"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.BackColor = System.Drawing.Color.Transparent; + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.ForeColor = System.Drawing.Color.Black; + this.label12.Location = new System.Drawing.Point(1715, 106); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(38, 26); + this.label12.TabIndex = 27; + this.label12.Text = "To"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.BackColor = System.Drawing.Color.Transparent; + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label10.ForeColor = System.Drawing.Color.Black; + this.label10.Location = new System.Drawing.Point(1129, 106); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(38, 26); + this.label10.TabIndex = 25; + this.label10.Text = "To"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.BackColor = System.Drawing.Color.Transparent; + this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label9.ForeColor = System.Drawing.Color.Black; + this.label9.Location = new System.Drawing.Point(554, 106); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(38, 26); + this.label9.TabIndex = 23; + this.label9.Text = "To"; + // + // Heatmaps + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.standardResultsPanel); + this.Name = "Heatmaps"; + this.Size = new System.Drawing.Size(1775, 950); + this.Load += new System.EventHandler(this.Heatmaps_Load); + this.standardResultsPanel.ResumeLayout(false); + this.standardResultsPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.runSettingsView)).EndInit(); + this.panel5.ResumeLayout(false); + this.panel5.PerformLayout(); + this.panel6.ResumeLayout(false); + this.panel7.ResumeLayout(false); + this.panel8.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel4.ResumeLayout(false); + this.rtKeyPanel.ResumeLayout(false); + this.rtKeyPanel.PerformLayout(); + this.rtGreen.ResumeLayout(false); + this.rtOrange.ResumeLayout(false); + this.rtRed.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.rtStatsRefreshGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.vrrStatsGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.osStatsGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rtStatsGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.vrrGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.osGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rtGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel standardResultsPanel; + private System.Windows.Forms.Label vrrSubTitle; + private System.Windows.Forms.Label vrrTitle; + private System.Windows.Forms.Label osSubTitle; + private System.Windows.Forms.Label osTitle; + private System.Windows.Forms.Label rtSubTitle; + private System.Windows.Forms.DataGridView vrrStatsGridView; + private System.Windows.Forms.DataGridView osStatsGridView; + private System.Windows.Forms.DataGridView rtStatsGridView; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label rtTitle; + private System.Windows.Forms.DataGridView vrrGridView; + private System.Windows.Forms.DataGridView osGridView; + private System.Windows.Forms.DataGridView rtGridView; + private System.Windows.Forms.Label from2; + private System.Windows.Forms.Label from3; + private System.Windows.Forms.Label from1; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.DataGridView rtStatsRefreshGridView; + private System.Windows.Forms.Panel rtKeyPanel; + private System.Windows.Forms.Panel rtGreen; + private System.Windows.Forms.Panel rtOrange; + private System.Windows.Forms.Panel rtRed; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.Label vrrGreenLbl; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Label vrrOrangeLbl; + private System.Windows.Forms.Panel panel8; + private System.Windows.Forms.Label vrrRedLbl; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label osGreenLbl; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label osOrangeLbl; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Label osRedLbl; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label rtGreenLbl; + private System.Windows.Forms.Label rtOrangeLbl; + private System.Windows.Forms.Label rtRedLbl; + private System.Windows.Forms.DataGridView runSettingsView; + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs b/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs new file mode 100644 index 0000000..d7fe054 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Heatmaps.cs @@ -0,0 +1,890 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OSRTT_Launcher +{ + public partial class Heatmaps : UserControl + { + public List averageData = new List(); + public List RGBArr = new List { 0, 51, 102, 153, 204, 255 }; + public int rtIndex = 4; + public class colourKey + { + public int keyType { get; set; } + public double min { get; set; } + public double middle { get; set; } + public double max { get; set; } + } + List colourKeys = new List(); + public ProcessData.rtMethods rtMethod; + public ProcessData.osMethods osMethod; + public ProcessData.runSettings runSettings; + public void setAverageData(List ad) + { + if (ad != null) + { + averageData.Clear(); + averageData.AddRange(ad); + } + } + public void setRGBArr(List RGB) + { + if (RGB != null) + { + RGBArr.Clear(); + RGBArr.AddRange(RGB); + } + } + public void setRtIndex(int i) + { + rtIndex = i; + } + public void setRtMethod(ProcessData.rtMethods rt) + { + if (rt != null) + { + rtMethod = rt; + } + } + public void setOsMethod(ProcessData.osMethods os) + { + if (os != null) + { + osMethod = os; + } + } + public void setRunSettings(ProcessData.runSettings run) + { + if (run != null) + { + runSettings = run; + } + } + public void hideText(bool state) + { + from1.Visible = state; + from2.Visible = state; + from3.Visible = state; + label12.Visible = state; + label10.Visible = state; + label9.Visible = state; + rtTitle.Visible = state; + rtSubTitle.Visible = state; + osTitle.Visible = state; + osSubTitle.Visible = state; + vrrTitle.Visible = state; + vrrSubTitle.Visible = state; + } + public Heatmaps() + { + Graphics g = this.CreateGraphics(); + g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; + InitializeComponent(); + this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); + string[] rtKey = Properties.Settings.Default.rtKey.Split(','); + if (rtKey.Length == 3) + { + colourKeys.Add(new colourKey { keyType = 0, min = double.Parse(rtKey[0]), middle = double.Parse(rtKey[1]), max = double.Parse(rtKey[2]) }); + rtGreenLbl.Text = rtKey[0]; + rtOrangeLbl.Text = rtKey[1]; + rtRedLbl.Text = rtKey[2]; + } + string[] osKey = Properties.Settings.Default.osKey.Split(','); + if (osKey.Length == 3) + { + colourKeys.Add(new colourKey { keyType = 1, min = double.Parse(osKey[0]), middle = double.Parse(osKey[1]), max = double.Parse(osKey[2]) }); + osGreenLbl.Text = osKey[0]; + osOrangeLbl.Text = osKey[1]; + osRedLbl.Text = osKey[2]; + } + string[] vrrKey = Properties.Settings.Default.vrrKey.Split(','); + if (vrrKey.Length == 3) + { + colourKeys.Add(new colourKey { keyType = 2, min = double.Parse(vrrKey[0]), middle = double.Parse(vrrKey[1]), max = double.Parse(vrrKey[2]) }); + vrrGreenLbl.Text = vrrKey[2]; + vrrOrangeLbl.Text = vrrKey[1]; + vrrRedLbl.Text = vrrKey[0]; + } + } + + private void Heatmaps_Load(object sender, EventArgs e) + { + + } + + private void drawTable(DataGridView dgv, string type) + { + // Create string arrays for rows + List data = new List(); + for (int i = 0; i < RGBArr.Count; i++) + { + // Fill list with sized empty string arrays to address later + string[] line = new string[6]; + data.Add(line); + } + int current = 0; + int next = 1; + for (int k = 0; k < averageData.Count; k++) + { + if (next < RGBArr.Count) + { + if (averageData[k].StartingRGB == RGBArr[current]) + { + if (type == "perceived") { data[current][next] = averageData[k].perTime.ToString(); } + else if (type == "initial") { data[current][next] = averageData[k].initTime.ToString(); } + else if (type == "complete") { data[current][next] = averageData[k].compTime.ToString(); } + else if (type == "overshoot") { data[current][next] = averageData[k].Overshoot.ToString(); } + else if (type == "vrr") { data[current][next] = averageData[k].visualResponseRating.ToString(); } + } + else + { + if (type == "perceived") { data[next][current] = averageData[k].perTime.ToString(); } + else if (type == "initial") { data[next][current] = averageData[k].initTime.ToString(); } + else if (type == "complete") { data[next][current] = averageData[k].compTime.ToString(); } + else if (type == "overshoot") { data[next][current] = averageData[k].Overshoot.ToString(); } + else if (type == "vrr") { data[next][current] = averageData[k].visualResponseRating.ToString(); } + next++; + } + } + else + { + current++; + next = current + 1; + if (averageData[k].StartingRGB == RGBArr[current]) + { + if (type == "perceived") { data[current][next] = averageData[k].perTime.ToString(); } + else if (type == "initial") { data[current][next] = averageData[k].initTime.ToString(); } + else if (type == "complete") { data[current][next] = averageData[k].compTime.ToString(); } + else if (type == "overshoot") { data[current][next] = averageData[k].Overshoot.ToString(); } + else if (type == "vrr") { data[current][next] = averageData[k].visualResponseRating.ToString(); } + } + else + { + if (type == "perceived") { data[next][current] = averageData[k].perTime.ToString(); } + else if (type == "initial") { data[next][current] = averageData[k].initTime.ToString(); } + else if (type == "complete") { data[next][current] = averageData[k].compTime.ToString(); } + else if (type == "overshoot") { data[next][current] = averageData[k].Overshoot.ToString(); } + else if (type == "vrr") { data[next][current] = averageData[k].visualResponseRating.ToString(); } + next++; + } + } + } + // Add string array to rows + foreach (var item in data) + { + dgv.Rows.Add(item); + } + for (int l = 0; l < dgv.Rows.Count; l++) + { + dgv.Rows[l].Height += 5; + dgv.Rows[l].HeaderCell.Value = RGBArr[l].ToString(); + Console.WriteLine(dgv.Rows[l].HeaderCell.Value); + } + } + + private void drawStatsTable(DataGridView dgv, string type) + { + // Average function + + // part average (rise or fall) - bundle into main average with if (start < end) += riseAvg + + // Best / worst + + // 0 - 255 - 0 - again roll through main loop. + Console.WriteLine(type); + // Basically just loop through the list, add value to any relevant sums then divide/round at the end. + if (type == "overshoot") + { + + double averageError = 0; + double errorOver10 = 0; + double worstRT = 0; + for (int l = 0; l < averageData.Count; l++) + { + averageError += averageData[l].Overshoot; + if (averageData[l].Overshoot > worstRT) + { + worstRT = averageData[l].Overshoot; + } + if (averageData[l].Overshoot > 10) + { + errorOver10++; + } + } + errorOver10 = (errorOver10 / averageData.Count) * 100; + errorOver10 = Math.Round(errorOver10, 2); + averageError = averageError / averageData.Count; + averageError = Math.Round(averageError, 2); + + // Create string arrays for rows + List data = new List(); + for (int i = 0; i < 3; i++) + { + // Fill list with sized empty string arrays to address later + string[] line = new string[2]; + data.Add(line); + } + data[0][0] = "Average Error"; + data[0][1] = averageError.ToString(); + data[1][0] = "Worst Error"; + data[1][1] = worstRT.ToString(); + string ostype = "Percent Above 10"; + if (osMethod.endPercent || osMethod.rangePercent) + { + ostype += "%"; + } + else + { + ostype += " RGB"; + } + data[2][0] = ostype; + data[2][1] = errorOver10.ToString(); + + foreach (var item in data) + { + dgv.Rows.Add(item); + } + } + else if (type == "vrr") + { + double averageRating = 0; + double averageFall = 0; + double averageRise = 0; + double worst = averageData[0].visualResponseRating; + double best = averageData[0].visualResponseRating; + for (int l = 0; l < averageData.Count; l++) + { + averageRating += averageData[l].visualResponseRating; + if (averageData[l].visualResponseRating < worst) + { + worst = averageData[l].visualResponseRating; + } + if (averageData[l].visualResponseRating > best) + { + best = averageData[l].visualResponseRating; + } + if (averageData[l].StartingRGB < averageData[l].EndRGB) + { + averageRise += averageData[l].visualResponseRating; + } + else + { + averageFall += averageData[l].visualResponseRating; + } + } + averageRating = (averageRating / averageData.Count); + averageRating = Math.Round(averageRating, 2); + double div2 = averageData.Count / 2; + averageFall = (averageFall / div2); + averageFall = Math.Round(averageFall, 2); + averageRise = (averageRise / div2); + averageRise = Math.Round(averageRise, 2); + List data = new List(); + for (int i = 0; i < 5; i++) + { + // Fill list with sized empty string arrays to address later + string[] line = new string[2]; + data.Add(line); + } + data[0][0] = "Average Rating"; + data[0][1] = averageRating.ToString(); + data[1][0] = "Average Rise"; + data[1][1] = averageRise.ToString(); + data[2][0] = "Average Fall"; + data[2][1] = averageFall.ToString(); + data[3][0] = "Best"; + data[3][1] = best.ToString(); + data[4][0] = "Worst"; + data[4][1] = worst.ToString(); + foreach (var item in data) + { + dgv.Rows.Add(item); + } + } + else if (dgv.Name.Contains("Refresh")) + { + int indexToUse = 0; + if (type == "perceived") { indexToUse = 0; } + else if (type == "initial") { indexToUse = 1; } + else if (type == "complete") { indexToUse = 2; } + double refreshRate = 60; + if (runSettings != null) + { + refreshRate = runSettings.RefreshRate; + } + double refreshWindow = Math.Round((1000 / refreshRate), 2); + double percentInWindow = 0; + for (int l = 0; l < averageData.Count; l++) + { + double[] rtTimes = { averageData[l].perTime, averageData[l].initTime, averageData[l].compTime }; + if (rtTimes[indexToUse] < refreshWindow) + { + percentInWindow++; + } + } + percentInWindow = (percentInWindow / averageData.Count) * 100; + percentInWindow = Math.Round(percentInWindow, 2); + // Create string arrays for rows + List data = new List(); + for (int i = 0; i < 3; i++) + { + // Fill list with sized empty string arrays to address later + string[] line = new string[2]; + data.Add(line); + } + data[0][0] = "Refresh Rate"; + data[0][1] = refreshRate.ToString(); + data[1][0] = "Refresh Window"; + data[1][1] = refreshWindow.ToString(); + data[2][0] = "Percent in Window"; + data[2][1] = percentInWindow.ToString(); + foreach (var item in data) + { + dgv.Rows.Add(item); + } + } + else if (dgv.Name.Contains("Settings")) + { + List data = new List(); + for (int i = 0; i < 3; i++) + { + // Fill list with sized empty string arrays to address later + string[] line = new string[2]; + data.Add(line); + } + data[0][0] = "Monitor Name"; + data[0][1] = runSettings.MonitorName.Remove(0,4); + data[1][0] = "FPS Limit"; + data[1][1] = runSettings.FPSLimit.ToString(); + data[2][0] = "V-Sync"; + data[2][1] = runSettings.Vsync.ToString(); + foreach (var item in data) + { + dgv.Rows.Add(item); + } + } + else + { + int indexToUse = 0; + if (type == "perceived") { indexToUse = 0; } + else if (type == "initial") { indexToUse = 1; } + else if (type == "complete") { indexToUse = 2; } + double averageInitialRT = 0; + double averageCompleteRT = 0; + double averagePerceivedRT = 0; + double averageRise = 0; + double averageFall = 0; + double roundTrip = 0; + double bestRT = averageData[0].perTime; + double worstRT = averageData[0].perTime; + for (int l = 0; l < averageData.Count; l++) + { + double[] rtTimes = { averageData[l].perTime, averageData[l].initTime, averageData[l].compTime }; + averageCompleteRT += averageData[l].compTime; + averageInitialRT += averageData[l].initTime; + averagePerceivedRT += averageData[l].perTime; + if (averageData[l].StartingRGB < averageData[l].EndRGB) + { + averageRise += rtTimes[indexToUse]; + } + else + { + averageFall += rtTimes[indexToUse]; + } + if ((averageData[l].StartingRGB == 0 && averageData[l].EndRGB == 255) || (averageData[l].StartingRGB == 255 && averageData[l].EndRGB == 0)) + { + roundTrip += rtTimes[indexToUse]; + } + if (rtTimes[indexToUse] < bestRT) + { + bestRT = rtTimes[indexToUse]; + } + if (rtTimes[indexToUse] > worstRT) + { + worstRT = rtTimes[indexToUse]; + } + + } + averageInitialRT = averageInitialRT / averageData.Count; + averageInitialRT = Math.Round(averageInitialRT, 2); + averageCompleteRT = averageCompleteRT / averageData.Count; + averageCompleteRT = Math.Round(averageCompleteRT, 2); + averagePerceivedRT = averagePerceivedRT / averageData.Count; + averagePerceivedRT = Math.Round(averagePerceivedRT, 2); + averageRise = averageRise / (averageData.Count / 2); + averageRise = Math.Round(averageRise, 2); + averageFall = averageFall / (averageData.Count / 2); + averageFall = Math.Round(averageFall, 2); + // Create string arrays for rows + List data = new List(); + for (int i = 0; i < 8; i++) + { + // Fill list with sized empty string arrays to address later + string[] line = new string[2]; + data.Add(line); + } + data[0][0] = "Average Initial Time"; + data[0][1] = averageInitialRT.ToString(); + data[1][0] = "Average Complete Time"; + data[1][1] = averageCompleteRT.ToString(); + data[2][0] = "Average Perceived Time"; + data[2][1] = averagePerceivedRT.ToString(); + data[3][0] = "Average Rise Time"; + data[3][1] = averageRise.ToString(); + data[4][0] = "Average Fall Time"; + data[4][1] = averageFall.ToString(); + data[5][0] = "0-255-0"; + data[5][1] = roundTrip.ToString(); + data[6][0] = "Best"; + data[6][1] = bestRT.ToString(); + data[7][0] = "Worst"; + data[7][1] = worstRT.ToString(); + foreach (var item in data) + { + dgv.Rows.Add(item); + } + } + } + + void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) + { + if (e.ColumnIndex == -1 && e.RowIndex > -1) + { + e.PaintBackground(e.CellBounds, true); + using (SolidBrush br = new SolidBrush(Color.White)) + { + StringFormat sf = new StringFormat(); + sf.Alignment = StringAlignment.Far; + sf.LineAlignment = StringAlignment.Center; + e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; + e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear; + e.Graphics.DrawString(e.Value.ToString(), + e.CellStyle.Font, br, e.CellBounds, sf); + } + e.Handled = true; + } + } + + private void initGridViewColumns(DataGridView dgv) + { + if (dgv.Columns.Count != 0) + { + dgv.Columns.Clear(); + } + if (dgv.Rows.Count != 0) + { + dgv.Rows.Clear(); + } + dgv.SelectionChanged += gridView_SelectionChanged; + dgv.CellPainting += dataGridView_CellPainting; + dgv.ColumnCount = 6; + dgv.BorderStyle = BorderStyle.None; + dgv.ColumnHeadersDefaultCellStyle.BackColor = ColorTranslator.FromHtml("#ACAEAE"); + dgv.RowHeadersDefaultCellStyle.BackColor = ColorTranslator.FromHtml("#ACAEAE"); + dgv.ColumnHeadersDefaultCellStyle.Font = new Font("Calibri", 22, FontStyle.Bold); + dgv.RowHeadersDefaultCellStyle.Font = new Font("Calibri", 22, FontStyle.Bold); + dgv.AdvancedColumnHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; + dgv.AdvancedRowHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; + dgv.DefaultCellStyle.BackColor = Color.FromArgb(84, 157, 178, 189); + dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(255, 255, 255, 255); + dgv.RowHeadersDefaultCellStyle.ForeColor = ColorTranslator.FromHtml("#FFFFFF"); + dgv.RowsDefaultCellStyle.Font = new Font("Calibri", 21); + dgv.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; + dgv.RowsDefaultCellStyle.ForeColor = ColorTranslator.FromHtml("#FFFFFF"); + if (dgv.Name.Contains("vrr")) + { + dgv.CellFormatting += new DataGridViewCellFormattingEventHandler(dgvVRR_CellFormatting); + } + else + { + dgv.CellFormatting += new DataGridViewCellFormattingEventHandler(dgv_CellFormatting); + } + for (int i = 0; i < RGBArr.Count; i++) + { + dgv.Columns[i].Name = RGBArr[i].ToString(); + } + + for (int k = 0; k < dgv.Columns.Count; k++) + { + dgv.Columns[k].Width = 75; + dgv.Columns[k].SortMode = DataGridViewColumnSortMode.NotSortable; + } + } + + + private void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + //Compare the value of second Column i.e. Column with Index 1. + DataGridView dgv = sender as DataGridView; + Color cellColour; + double min = colourKeys[0].min; + double middle = colourKeys[0].middle; + double max = colourKeys[0].max; + if (dgv.Name.Contains("os")) + { + min = colourKeys[1].min; + middle = colourKeys[1].middle; + max = colourKeys[1].max; + } + if (e.Value != null) + { + if (dgv.Name.Contains("Refresh")) + { + if ((e.RowIndex == 0 || e.RowIndex == 1) && dgv.Name.Contains("Refresh")) + { + cellColour = Color.SteelBlue; + } + else if (e.ColumnIndex == 0) + { + cellColour = Color.LightGray; + } + else + { + double val = Convert.ToDouble(e.Value); + if (val <= 60) + { + int r = 213; + int g = 73; + int b = 70; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else if (val > 60 && val <= 80) + { + int r = 213; + int g = 183; + int b = 98; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else + { + int r = 58; + int g = 186; + int b = 92; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + } + } + else if (dgv.Name.Contains("Stats") && e.ColumnIndex == 0 ) + { + cellColour = Color.LightGray; + } + else if (dgv.Name.Contains("Settings")) + { + cellColour = Color.LightGray; + e.CellStyle.ForeColor = Color.White; + } + else + { + double val = Convert.ToDouble(e.Value); + if (dgv.Name.Contains("Stats") && e.RowIndex == 5) + { + val *= 2; + } + if (val == middle) + { + int r = 213; + int g = 183; + int b = 98; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else if (val < middle) + { + if (val < min) + { + // set min colour + int r = 58; + int g = 186; + int b = 92; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else + { + double range = middle - min; + double time = val - min; + double result = time / range; + int greenRGB = 205; + int redRGB = Convert.ToInt32((160 * result) + 55); + int blueRGB = 80; + cellColour = ColorTranslator.FromHtml("#" + redRGB.ToString("X") + greenRGB.ToString("X") + blueRGB.ToString("X")); + } + } + else + { + if (val > max) + { + // set max colour + int r = 213; + int g = 73; + int b = 70; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else + { + double range = max - middle; + double time = max - val; + double result = time / range; + int greenRGB = Convert.ToInt32((135 * result) + 75); + int redRGB = 213; + int blueRGB = 70; + cellColour = ColorTranslator.FromHtml("#" + redRGB.ToString("X") + greenRGB.ToString("X") + blueRGB.ToString("X")); + } + } + } + } + else + { + cellColour = Color.LightGray; + } + e.CellStyle.BackColor = cellColour; + } + + private void dgvVRR_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + //Compare the value of second Column i.e. Column with Index 1. + DataGridView dgv = sender as DataGridView; + int colourKeyIndex = 0; + Color cellColour = Color.LightGray; + double min = colourKeys[2].min; + double middle = colourKeys[2].middle; + double max = colourKeys[2].max; + if (e.Value != null) + { + if (dgv.Name.Contains("Stats") && e.ColumnIndex == 0) + { + cellColour = Color.LightGray; + } + else + { + double val = Convert.ToDouble(e.Value); + if (dgv.Name.Contains("Stats") && e.RowIndex == 5) + { + val /= 2; + } + if (val == colourKeys[colourKeyIndex].middle) + { + int r = 213; + int g = 183; + int b = 98; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else if (val < middle) + { + if (val < min) + { + int r = 213; + int g = 73; + int b = 70; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else + { + double range = middle - min; + double time = val - min; + double result = time / range; + + int greenRGB = Convert.ToInt32((135 * result) + 75); + int redRGB = 213; + int blueRGB = 70; + cellColour = ColorTranslator.FromHtml("#" + redRGB.ToString("X") + greenRGB.ToString("X") + blueRGB.ToString("X")); + } + } + else + { + if (val > max) + { + int r = 58; + int g = 186; + int b = 92; + cellColour = ColorTranslator.FromHtml("#" + r.ToString("X") + g.ToString("X") + b.ToString("X")); + } + else + { + double range = max - middle; + double time = max - val; + double result = time / range; + + int greenRGB = 205; + int redRGB = Convert.ToInt32((160 * result) + 55); + int blueRGB = 80; + cellColour = ColorTranslator.FromHtml("#" + redRGB.ToString("X") + greenRGB.ToString("X") + blueRGB.ToString("X")); + } + } + } + } + else + { + cellColour = Color.LightGray; + } + e.CellStyle.BackColor = cellColour; + } + + + private void initStatsGridViewColumns(DataGridView dgv) + { + if (dgv.Columns.Count != 0) + { + dgv.Columns.Clear(); + } + if (dgv.Rows.Count != 0) + { + dgv.Rows.Clear(); + } + dgv.SelectionChanged += gridView_SelectionChanged; + dgv.ColumnCount = 2; + dgv.BorderStyle = BorderStyle.None; + dgv.ColumnHeadersVisible = false; + dgv.RowHeadersVisible = false; + dgv.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; + dgv.RowsDefaultCellStyle.ForeColor = Color.White; + dgv.RowsDefaultCellStyle.BackColor = Color.Gray; + dgv.RowsDefaultCellStyle.Font = new Font("Calibri", 22); + if (dgv.Name.Contains("vrr")) + { + dgv.CellFormatting += new DataGridViewCellFormattingEventHandler(dgvVRR_CellFormatting); + } + else + { + dgv.CellFormatting += new DataGridViewCellFormattingEventHandler(dgv_CellFormatting); + } + + // rtGridView.RowHeadersDefaultCellStyle.Padding = new Padding(rtGridView.RowHeadersWidth / 2 ); + for (int k = 0; k < dgv.Columns.Count; k++) + { + if (k == 0) + { + if (dgv.Name.Contains("Settings")) + { + dgv.Columns[k].Width = 200; + } + else + { + dgv.Columns[k].Width = 325; + } + dgv.Columns[k].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; + } + else + { + if (dgv.Name.Contains("Settings")) + { + dgv.Columns[k].Width = 250; + } + else + { + dgv.Columns[k].Width = 125; + } + } + dgv.Columns[k].SortMode = DataGridViewColumnSortMode.NotSortable; + } + + } + + private void gridView_SelectionChanged(Object sender, EventArgs e) + { + DataGridView dgv = sender as DataGridView; + dgv.ClearSelection(); + dgv.CurrentRow.Selected = false; + } + + public void standardView() + { + vrrTitle.Text = "Visual Response Rating"; + vrrSubTitle.Text = "Score out of 100 of visible performance"; + try + { + initGridViewColumns(rtGridView); + initGridViewColumns(osGridView); + initGridViewColumns(vrrGridView); + } + catch (Exception e) + { + Console.WriteLine(e.Message + e.StackTrace); + } + string rtType = "perceived"; + rtTitle.Text = "Perceived Response Time"; + if (rtIndex == 3) + { + rtType = "initial"; + rtTitle.Text = "Initial Response Time"; + } + else if (rtIndex == 2) + { + rtType = "complete"; + rtTitle.Text = "Complete Response Time"; + } + rtSubTitle.Text = rtMethod.Name; + if (osMethod.gammaCorrected && (!osMethod.endPercent || !osMethod.rangePercent)) + { + osTitle.Text = "RGB Overshoot"; + osSubTitle.Text = "RGB values over/under target"; + } + else if (osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + osTitle.Text = "Percent RGB Overshoot"; + if (osMethod.rangePercent) + { + osSubTitle.Text = "Percentage of RGB values over/under transition range"; + } + else + { + osSubTitle.Text = "Percentage of RGB values over/under target"; + } + } + else if (!osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + osTitle.Text = "Percent Overshoot"; + if (osMethod.rangePercent) + { + osSubTitle.Text = "Percent of light level over/under transition range"; + } + else + { + osSubTitle.Text = "Percent of light level over/under target"; + } + } + try + { + drawTable(rtGridView, rtType); + drawTable(osGridView, "overshoot"); + drawTable(vrrGridView, "vrr"); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message + ex.StackTrace); + } + try + { + initStatsGridViewColumns(rtStatsRefreshGridView); + initStatsGridViewColumns(rtStatsGridView); + initStatsGridViewColumns(osStatsGridView); + initStatsGridViewColumns(vrrStatsGridView); + initStatsGridViewColumns(runSettingsView); + } + catch (Exception e) + { + Console.WriteLine(e.Message + e.StackTrace); + } + try + { + drawStatsTable(rtStatsRefreshGridView, rtType); + drawStatsTable(rtStatsGridView, rtType); + drawStatsTable(osStatsGridView, "overshoot"); + drawStatsTable(vrrStatsGridView, "vrr"); + drawStatsTable(runSettingsView, "runSettings"); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message + ex.StackTrace); + } + // Set location, size, enabled/clickable/editable + // Draw averages + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/Heatmaps.resx b/OSRTT Launcher/OSRTT Launcher/Heatmaps.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Heatmaps.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/HelpView.Designer.cs b/OSRTT Launcher/OSRTT Launcher/HelpView.Designer.cs new file mode 100644 index 0000000..571bb98 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/HelpView.Designer.cs @@ -0,0 +1,383 @@ + +namespace OSRTT_Launcher +{ + partial class HelpView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HelpView)); + this.panel2 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label8 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.panel10 = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.label5 = new System.Windows.Forms.Label(); + this.panel6 = new System.Windows.Forms.Panel(); + this.label14 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.panel4 = new System.Windows.Forms.Panel(); + this.label6 = new System.Windows.Forms.Label(); + this.panel5 = new System.Windows.Forms.Panel(); + this.label9 = new System.Windows.Forms.Label(); + this.panel8 = new System.Windows.Forms.Panel(); + this.label15 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel2.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel10.SuspendLayout(); + this.panel3.SuspendLayout(); + this.panel6.SuspendLayout(); + this.panel4.SuspendLayout(); + this.panel5.SuspendLayout(); + this.panel8.SuspendLayout(); + this.SuspendLayout(); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Khaki; + this.panel2.Controls.Add(this.label1); + this.panel2.Location = new System.Drawing.Point(377, 65); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(356, 54); + this.panel2.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.Black; + this.label1.Location = new System.Drawing.Point(4, 11); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(295, 32); + this.label1.TabIndex = 11; + this.label1.Text = "Number of Test Runs"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label3.Location = new System.Drawing.Point(381, 128); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(349, 130); + this.label3.TabIndex = 11; + this.label3.Text = "This controls how many times you\r\nwould like the test to repeat before\r\naveraging" + + " the data. The more runs,\r\nthe more accurate the data is likely\r\nto be. Current " + + "maximum is 10."; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label7.Location = new System.Drawing.Point(10, 365); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(367, 130); + this.label7.TabIndex = 13; + this.label7.Text = "Adjust how long per transition the \r\ndevice should capture light samples.\r\nSlower" + + " monitors, or while testing \r\nwith VSync ON, should use a longer \r\ntime (i.e. 15" + + "0ms+)."; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Khaki; + this.panel1.Controls.Add(this.label8); + this.panel1.Location = new System.Drawing.Point(6, 302); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(356, 54); + this.panel1.TabIndex = 12; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label8.ForeColor = System.Drawing.Color.Black; + this.label8.Location = new System.Drawing.Point(4, 10); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(194, 32); + this.label8.TabIndex = 11; + this.label8.Text = "Capture Time"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label2.Location = new System.Drawing.Point(12, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(254, 31); + this.label2.TabIndex = 10; + this.label2.Text = "Main Window Help"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label13.Location = new System.Drawing.Point(11, 122); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(338, 176); + this.label13.TabIndex = 29; + this.label13.Text = resources.GetString("label13.Text"); + // + // panel10 + // + this.panel10.BackColor = System.Drawing.Color.Khaki; + this.panel10.Controls.Add(this.label14); + this.panel10.Location = new System.Drawing.Point(9, 65); + this.panel10.Name = "panel10"; + this.panel10.Size = new System.Drawing.Size(356, 54); + this.panel10.TabIndex = 28; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label4.Location = new System.Drawing.Point(381, 365); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(355, 130); + this.label4.TabIndex = 31; + this.label4.Text = "Toggle VSync on or off. On means\r\nmore stable results, less prone to \r\ncapture er" + + "rors. Off means true input\r\nlatency results, but capture errors \r\nare more like" + + "ly. "; + // + // panel3 + // + this.panel3.BackColor = System.Drawing.Color.Khaki; + this.panel3.Controls.Add(this.label5); + this.panel3.Location = new System.Drawing.Point(377, 302); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(356, 54); + this.panel3.TabIndex = 30; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.ForeColor = System.Drawing.Color.Black; + this.label5.Location = new System.Drawing.Point(4, 10); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(172, 32); + this.label5.TabIndex = 11; + this.label5.Text = "VSync State"; + // + // panel6 + // + this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel6.Controls.Add(this.label12); + this.panel6.Controls.Add(this.panel10); + this.panel6.Controls.Add(this.panel2); + this.panel6.Controls.Add(this.label3); + this.panel6.Controls.Add(this.panel1); + this.panel6.Controls.Add(this.label7); + this.panel6.Controls.Add(this.label4); + this.panel6.Controls.Add(this.label13); + this.panel6.Controls.Add(this.panel3); + this.panel6.Location = new System.Drawing.Point(12, 58); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(758, 529); + this.panel6.TabIndex = 36; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label14.ForeColor = System.Drawing.Color.Black; + this.label14.Location = new System.Drawing.Point(4, 11); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(225, 32); + this.label14.TabIndex = 11; + this.label14.Text = "Framerate Limit"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label12.Location = new System.Drawing.Point(10, 13); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(283, 31); + this.label12.TabIndex = 37; + this.label12.Text = "Response Time Test"; + // + // panel4 + // + this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel4.Controls.Add(this.label6); + this.panel4.Controls.Add(this.panel5); + this.panel4.Controls.Add(this.panel8); + this.panel4.Controls.Add(this.label16); + this.panel4.Controls.Add(this.label18); + this.panel4.Location = new System.Drawing.Point(785, 58); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(380, 529); + this.panel4.TabIndex = 38; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label6.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label6.Location = new System.Drawing.Point(10, 13); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(202, 31); + this.label6.TabIndex = 37; + this.label6.Text = "Input Lag Test"; + // + // panel5 + // + this.panel5.BackColor = System.Drawing.Color.Khaki; + this.panel5.Controls.Add(this.label9); + this.panel5.Location = new System.Drawing.Point(9, 65); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(356, 54); + this.panel5.TabIndex = 28; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label9.ForeColor = System.Drawing.Color.Black; + this.label9.Location = new System.Drawing.Point(4, 11); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(291, 32); + this.label9.TabIndex = 11; + this.label9.Text = "Time Between Clicks"; + // + // panel8 + // + this.panel8.BackColor = System.Drawing.Color.Khaki; + this.panel8.Controls.Add(this.label15); + this.panel8.Location = new System.Drawing.Point(6, 302); + this.panel8.Name = "panel8"; + this.panel8.Size = new System.Drawing.Size(356, 54); + this.panel8.TabIndex = 12; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label15.ForeColor = System.Drawing.Color.Black; + this.label15.Location = new System.Drawing.Point(4, 10); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(244, 32); + this.label15.TabIndex = 11; + this.label15.Text = "Number of Clicks"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label16.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label16.Location = new System.Drawing.Point(10, 365); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(349, 93); + this.label16.TabIndex = 13; + this.label16.Text = "How many clicks should the\r\ntest fire before finishing.\r\nDefault is 20."; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 19F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label18.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label18.Location = new System.Drawing.Point(11, 122); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(349, 90); + this.label18.TabIndex = 29; + this.label18.Text = "How much time should be left\r\nbetween mouse clicks during\r\nthe test. 0.5s is defa" + + "ult."; + // + // HelpView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlDark; + this.ClientSize = new System.Drawing.Size(1177, 599); + this.Controls.Add(this.panel4); + this.Controls.Add(this.panel6); + this.Controls.Add(this.label2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.Name = "HelpView"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Help"; + this.Load += new System.EventHandler(this.ResultsSettings_Load); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel10.ResumeLayout(false); + this.panel10.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel6.ResumeLayout(false); + this.panel6.PerformLayout(); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); + this.panel5.ResumeLayout(false); + this.panel5.PerformLayout(); + this.panel8.ResumeLayout(false); + this.panel8.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Panel panel10; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Panel panel8; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label18; + } +} \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/HelpView.cs b/OSRTT Launcher/OSRTT Launcher/HelpView.cs new file mode 100644 index 0000000..ce62fe9 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/HelpView.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Resources; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OSRTT_Launcher +{ + public partial class HelpView : Form + { + private ResourceManager rm = OSRTT_Launcher.Properties.Resources.ResourceManager; + public HelpView() + { + InitializeComponent(); + this.Icon = (Icon)rm.GetObject("osrttIcon"); + } + + private void ResultsSettings_Load(object sender, EventArgs e) + { + + } + + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/HelpView.resx b/OSRTT Launcher/OSRTT Launcher/HelpView.resx new file mode 100644 index 0000000..f6db5ed --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/HelpView.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + This setting limits the in-game framerate +during the test. This is most useful for +testing Variable Refresh Rate (VRR), as +you can set the FPS limit to below the +monitor's refresh rate, forcing it to refresh +slower than normal. Set this to equal or +above the quoted refresh rate for normal +testing. + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs index 8ab3328..ab7201d 100644 --- a/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs +++ b/OSRTT Launcher/OSRTT Launcher/Main.Designer.cs @@ -30,43 +30,14 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.launchBtn = new System.Windows.Forms.Button(); - this.resultsBtn = new System.Windows.Forms.Button(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.analyseResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.resultsSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.outputSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveXLSXMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveGraphsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.verboseOutputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveGammaTableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSmoothedDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveRawInputLagMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.convertRawGraphMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.recommendedSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.advancedSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.measurementsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.gamCorMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.fixedRGB5OffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.fixedRGB10OffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.threePercentMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.tenPercentMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.overshootSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.gammaCorrectedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.percentageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.differenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.endValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.extendedGammaTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.settingsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.programSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutProgramToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.bugReportMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.minimiseToTrayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.suppressDialogBoxesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.IgnoreErrorsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.BrightnessCalBtn = new System.Windows.Forms.ToolStripMenuItem(); this.deviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.debugModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -74,29 +45,21 @@ private void InitializeComponent() this.updateDeviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testButtonMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.devStatLbl = new System.Windows.Forms.Label(); this.devStat = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); this.controlsPanel = new System.Windows.Forms.Panel(); + this.testSettingsBtn = new System.Windows.Forms.Button(); this.vsyncStateList = new System.Windows.Forms.ComboBox(); - this.vsyncHelpBtn = new System.Windows.Forms.Button(); this.label15 = new System.Windows.Forms.Label(); - this.helpCaptureBtn = new System.Windows.Forms.Button(); - this.helpCyclesBtn = new System.Windows.Forms.Button(); - this.helpFramerateBtn = new System.Windows.Forms.Button(); this.captureTimeBox = new System.Windows.Forms.ComboBox(); this.label17 = new System.Windows.Forms.Label(); - this.label13 = new System.Windows.Forms.Label(); this.fpsLimitList = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.testCount = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); + this.helpBtn = new System.Windows.Forms.Button(); this.refreshMonitorListBtn = new System.Windows.Forms.Button(); this.monitorCB = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); - this.analysePanel = new System.Windows.Forms.Panel(); - this.opnResultsBtn = new System.Windows.Forms.Button(); - this.importRawFolder = new System.Windows.Forms.Button(); this.rawValText = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.resetBtn = new System.Windows.Forms.Button(); @@ -131,15 +94,19 @@ private void InitializeComponent() this.numberOfClicksSlider = new System.Windows.Forms.TrackBar(); this.label16 = new System.Windows.Forms.Label(); this.timeBetweenSlider = new System.Windows.Forms.TrackBar(); - this.label18 = new System.Windows.Forms.Label(); this.deviceStatusPanel = new System.Windows.Forms.Panel(); + this.checkImg = new System.Windows.Forms.PictureBox(); this.monitorPanel = new System.Windows.Forms.Panel(); this.mainPanel = new System.Windows.Forms.Panel(); + this.resultsFolderBtn = new System.Windows.Forms.Button(); + this.resultsViewBtn = new System.Windows.Forms.Button(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.toolTipController = new System.Windows.Forms.ToolTip(this.components); + this.boardSerialLbl = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.controlsPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.testCount)).BeginInit(); - this.analysePanel.SuspendLayout(); this.brightnessPanel.SuspendLayout(); this.aboutPanel.SuspendLayout(); this.debugPanel.SuspendLayout(); @@ -147,42 +114,31 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numberOfClicksSlider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.timeBetweenSlider)).BeginInit(); this.deviceStatusPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.checkImg)).BeginInit(); this.monitorPanel.SuspendLayout(); this.mainPanel.SuspendLayout(); this.SuspendLayout(); // // launchBtn // - this.launchBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.launchBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.launchBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(180)))), ((int)(((byte)(76))))); + this.launchBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.launchBtn.Font = new System.Drawing.Font("Consolas", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.launchBtn.Location = new System.Drawing.Point(17, 194); + this.launchBtn.ForeColor = System.Drawing.Color.White; + this.launchBtn.Location = new System.Drawing.Point(-1, -1); this.launchBtn.Name = "launchBtn"; - this.launchBtn.Size = new System.Drawing.Size(248, 74); + this.launchBtn.Size = new System.Drawing.Size(289, 74); this.launchBtn.TabIndex = 5; this.launchBtn.Text = "Start Response Time Testing"; + this.toolTipController.SetToolTip(this.launchBtn, "Start Response Time Test"); this.launchBtn.UseVisualStyleBackColor = false; this.launchBtn.Click += new System.EventHandler(this.launchBtn_Click); // - // resultsBtn - // - this.resultsBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.resultsBtn.FlatAppearance.BorderSize = 0; - this.resultsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.resultsBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); - this.resultsBtn.Location = new System.Drawing.Point(206, 46); - this.resultsBtn.Name = "resultsBtn"; - this.resultsBtn.Size = new System.Drawing.Size(175, 75); - this.resultsBtn.TabIndex = 6; - this.resultsBtn.Text = "Import Raw Data File"; - this.resultsBtn.UseVisualStyleBackColor = false; - this.resultsBtn.Click += new System.EventHandler(this.resultsBtn_Click); - // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(15, 11); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(364, 685); + this.richTextBox1.Size = new System.Drawing.Size(364, 309); this.richTextBox1.TabIndex = 2; this.richTextBox1.TabStop = false; this.richTextBox1.Text = ""; @@ -193,14 +149,14 @@ private void InitializeComponent() this.menuStrip1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.analyseResultsToolStripMenuItem, - this.resultsSettingsToolStripMenuItem, + this.settingsMenuItem, this.programSettingsToolStripMenuItem, this.BrightnessCalBtn, this.deviceToolStripMenuItem, this.toolStripMenuItem1}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Location = new System.Drawing.Point(5, 5); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1924, 24); + this.menuStrip1.Size = new System.Drawing.Size(2093, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -209,268 +165,25 @@ private void InitializeComponent() this.analyseResultsToolStripMenuItem.CheckOnClick = true; this.analyseResultsToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.analyseResultsToolStripMenuItem.Name = "analyseResultsToolStripMenuItem"; - this.analyseResultsToolStripMenuItem.Size = new System.Drawing.Size(100, 20); - this.analyseResultsToolStripMenuItem.Text = "Analyse Results"; + this.analyseResultsToolStripMenuItem.Size = new System.Drawing.Size(126, 20); + this.analyseResultsToolStripMenuItem.Text = "Heatmaps && Graphs"; this.analyseResultsToolStripMenuItem.Click += new System.EventHandler(this.analyseResultsToolStripMenuItem_Click); // - // resultsSettingsToolStripMenuItem - // - this.resultsSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.outputSettingsToolStripMenuItem, - this.toolStripSeparator2, - this.recommendedSettingsToolStripMenuItem, - this.advancedSettingsToolStripMenuItem}); - this.resultsSettingsToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; - this.resultsSettingsToolStripMenuItem.Name = "resultsSettingsToolStripMenuItem"; - this.resultsSettingsToolStripMenuItem.Size = new System.Drawing.Size(101, 20); - this.resultsSettingsToolStripMenuItem.Text = "Results Settings"; - // - // outputSettingsToolStripMenuItem - // - this.outputSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveXLSXMenuItem, - this.saveGraphsMenuItem, - this.verboseOutputToolStripMenuItem, - this.saveGammaTableToolStripMenuItem, - this.saveSmoothedDataToolStripMenuItem, - this.saveRawInputLagMenuItem, - this.toolStripSeparator4, - this.convertRawGraphMenuItem}); - this.outputSettingsToolStripMenuItem.Name = "outputSettingsToolStripMenuItem"; - this.outputSettingsToolStripMenuItem.Size = new System.Drawing.Size(200, 22); - this.outputSettingsToolStripMenuItem.Text = "Output Settings"; - // - // saveXLSXMenuItem - // - this.saveXLSXMenuItem.Checked = true; - this.saveXLSXMenuItem.CheckOnClick = true; - this.saveXLSXMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.saveXLSXMenuItem.Name = "saveXLSXMenuItem"; - this.saveXLSXMenuItem.Size = new System.Drawing.Size(242, 22); - this.saveXLSXMenuItem.Text = "Save Heatmaps in XLSX File"; - this.saveXLSXMenuItem.Click += new System.EventHandler(this.saveXLSXMenuItem_Click); - // - // saveGraphsMenuItem - // - this.saveGraphsMenuItem.CheckOnClick = true; - this.saveGraphsMenuItem.Name = "saveGraphsMenuItem"; - this.saveGraphsMenuItem.Size = new System.Drawing.Size(242, 22); - this.saveGraphsMenuItem.Text = "Save Raw Data with Graphs"; - this.saveGraphsMenuItem.Click += new System.EventHandler(this.saveGraphsMenuItem_Click); - // - // verboseOutputToolStripMenuItem - // - this.verboseOutputToolStripMenuItem.CheckOnClick = true; - this.verboseOutputToolStripMenuItem.Name = "verboseOutputToolStripMenuItem"; - this.verboseOutputToolStripMenuItem.Size = new System.Drawing.Size(242, 22); - this.verboseOutputToolStripMenuItem.Text = "Verbose Output"; - this.verboseOutputToolStripMenuItem.ToolTipText = "Include all processed fields in each \"FULL\" CSV. \r\nIncludes transition start & en" + - "d position, sample time, overshoot light level and overshoot RGB value."; - this.verboseOutputToolStripMenuItem.Click += new System.EventHandler(this.verboseOutputToolStripMenuItem_Click); - // - // saveGammaTableToolStripMenuItem - // - this.saveGammaTableToolStripMenuItem.CheckOnClick = true; - this.saveGammaTableToolStripMenuItem.Name = "saveGammaTableToolStripMenuItem"; - this.saveGammaTableToolStripMenuItem.Size = new System.Drawing.Size(242, 22); - this.saveGammaTableToolStripMenuItem.Text = "Save Gamma Table"; - this.saveGammaTableToolStripMenuItem.Click += new System.EventHandler(this.saveGammaTableToolStripMenuItem_Click); - // - // saveSmoothedDataToolStripMenuItem - // - this.saveSmoothedDataToolStripMenuItem.CheckOnClick = true; - this.saveSmoothedDataToolStripMenuItem.Name = "saveSmoothedDataToolStripMenuItem"; - this.saveSmoothedDataToolStripMenuItem.Size = new System.Drawing.Size(242, 22); - this.saveSmoothedDataToolStripMenuItem.Text = "Save Raw Smoothed Data"; - this.saveSmoothedDataToolStripMenuItem.Click += new System.EventHandler(this.saveSmoothedDataToolStripMenuItem_Click); - // - // saveRawInputLagMenuItem - // - this.saveRawInputLagMenuItem.Checked = true; - this.saveRawInputLagMenuItem.CheckOnClick = true; - this.saveRawInputLagMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.saveRawInputLagMenuItem.Name = "saveRawInputLagMenuItem"; - this.saveRawInputLagMenuItem.Size = new System.Drawing.Size(242, 22); - this.saveRawInputLagMenuItem.Text = "Save Raw Input Lag Data"; - this.saveRawInputLagMenuItem.Click += new System.EventHandler(this.saveRawInputLagDataToolStripMenuItem_Click); - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(239, 6); - this.toolStripSeparator4.Visible = false; - // - // convertRawGraphMenuItem - // - this.convertRawGraphMenuItem.Name = "convertRawGraphMenuItem"; - this.convertRawGraphMenuItem.Size = new System.Drawing.Size(242, 22); - this.convertRawGraphMenuItem.Text = "Convert Raw CSV to Graph View"; - this.convertRawGraphMenuItem.Visible = false; - this.convertRawGraphMenuItem.Click += new System.EventHandler(this.convertRawGraphMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(197, 6); - // - // recommendedSettingsToolStripMenuItem - // - this.recommendedSettingsToolStripMenuItem.Checked = true; - this.recommendedSettingsToolStripMenuItem.CheckOnClick = true; - this.recommendedSettingsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.recommendedSettingsToolStripMenuItem.Name = "recommendedSettingsToolStripMenuItem"; - this.recommendedSettingsToolStripMenuItem.Size = new System.Drawing.Size(200, 22); - this.recommendedSettingsToolStripMenuItem.Text = "Recommended Settings"; - this.recommendedSettingsToolStripMenuItem.Click += new System.EventHandler(this.recommendedSettingsToolStripMenuItem_Click); - // - // advancedSettingsToolStripMenuItem - // - this.advancedSettingsToolStripMenuItem.CheckOnClick = true; - this.advancedSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.measurementsToolStripMenuItem, - this.overshootSettingsMenuItem, - this.extendedGammaTestToolStripMenuItem}); - this.advancedSettingsToolStripMenuItem.Name = "advancedSettingsToolStripMenuItem"; - this.advancedSettingsToolStripMenuItem.Size = new System.Drawing.Size(200, 22); - this.advancedSettingsToolStripMenuItem.Text = "Advanced Settings"; - this.advancedSettingsToolStripMenuItem.Click += new System.EventHandler(this.advancedSettingsToolStripMenuItem_Click); - // - // measurementsToolStripMenuItem - // - this.measurementsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.gamCorMenuItem, - this.toolStripSeparator1, - this.fixedRGB5OffsetToolStripMenuItem, - this.fixedRGB10OffsetToolStripMenuItem, - this.toolStripSeparator3, - this.threePercentMenuItem, - this.tenPercentMenuItem}); - this.measurementsToolStripMenuItem.Name = "measurementsToolStripMenuItem"; - this.measurementsToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.measurementsToolStripMenuItem.Text = "Response Time Settings"; - this.measurementsToolStripMenuItem.Visible = false; - // - // gamCorMenuItem - // - this.gamCorMenuItem.Checked = true; - this.gamCorMenuItem.CheckOnClick = true; - this.gamCorMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.gamCorMenuItem.Name = "gamCorMenuItem"; - this.gamCorMenuItem.Size = new System.Drawing.Size(253, 22); - this.gamCorMenuItem.Text = "Gamma Corrected Response Time"; - this.gamCorMenuItem.Click += new System.EventHandler(this.gamCorMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(250, 6); - // - // fixedRGB5OffsetToolStripMenuItem - // - this.fixedRGB5OffsetToolStripMenuItem.Checked = true; - this.fixedRGB5OffsetToolStripMenuItem.CheckOnClick = true; - this.fixedRGB5OffsetToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.fixedRGB5OffsetToolStripMenuItem.Name = "fixedRGB5OffsetToolStripMenuItem"; - this.fixedRGB5OffsetToolStripMenuItem.Size = new System.Drawing.Size(253, 22); - this.fixedRGB5OffsetToolStripMenuItem.Text = "Fixed RGB 5 Offset"; - this.fixedRGB5OffsetToolStripMenuItem.Click += new System.EventHandler(this.fixedRGB5OffsetToolStripMenuItem_Click); - // - // fixedRGB10OffsetToolStripMenuItem - // - this.fixedRGB10OffsetToolStripMenuItem.CheckOnClick = true; - this.fixedRGB10OffsetToolStripMenuItem.Name = "fixedRGB10OffsetToolStripMenuItem"; - this.fixedRGB10OffsetToolStripMenuItem.Size = new System.Drawing.Size(253, 22); - this.fixedRGB10OffsetToolStripMenuItem.Text = "Fixed RGB 10 Offset"; - this.fixedRGB10OffsetToolStripMenuItem.Click += new System.EventHandler(this.fixedRGB10OffsetToolStripMenuItem_Click); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(250, 6); - // - // threePercentMenuItem - // - this.threePercentMenuItem.CheckOnClick = true; - this.threePercentMenuItem.Name = "threePercentMenuItem"; - this.threePercentMenuItem.Size = new System.Drawing.Size(253, 22); - this.threePercentMenuItem.Text = "3% / 97% Response Time"; - this.threePercentMenuItem.Click += new System.EventHandler(this.threePercentMenuItem_Click); - // - // tenPercentMenuItem - // - this.tenPercentMenuItem.CheckOnClick = true; - this.tenPercentMenuItem.Name = "tenPercentMenuItem"; - this.tenPercentMenuItem.Size = new System.Drawing.Size(253, 22); - this.tenPercentMenuItem.Text = "10% / 90% Response Time"; - this.tenPercentMenuItem.Click += new System.EventHandler(this.tenPercentMenuItem_Click); - // - // overshootSettingsMenuItem - // - this.overshootSettingsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.gammaCorrectedToolStripMenuItem, - this.percentageToolStripMenuItem}); - this.overshootSettingsMenuItem.Name = "overshootSettingsMenuItem"; - this.overshootSettingsMenuItem.Size = new System.Drawing.Size(198, 22); - this.overshootSettingsMenuItem.Text = "Overshoot Settings"; - this.overshootSettingsMenuItem.Visible = false; - // - // gammaCorrectedToolStripMenuItem - // - this.gammaCorrectedToolStripMenuItem.Checked = true; - this.gammaCorrectedToolStripMenuItem.CheckOnClick = true; - this.gammaCorrectedToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.gammaCorrectedToolStripMenuItem.Name = "gammaCorrectedToolStripMenuItem"; - this.gammaCorrectedToolStripMenuItem.Size = new System.Drawing.Size(240, 22); - this.gammaCorrectedToolStripMenuItem.Text = "Gamma Corrected (RGB Values)"; - this.gammaCorrectedToolStripMenuItem.Click += new System.EventHandler(this.gammaCorrectedToolStripMenuItem_Click); - // - // percentageToolStripMenuItem - // - this.percentageToolStripMenuItem.CheckOnClick = true; - this.percentageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.differenceToolStripMenuItem, - this.endValueToolStripMenuItem}); - this.percentageToolStripMenuItem.Name = "percentageToolStripMenuItem"; - this.percentageToolStripMenuItem.Size = new System.Drawing.Size(240, 22); - this.percentageToolStripMenuItem.Text = "Percentage"; - this.percentageToolStripMenuItem.Click += new System.EventHandler(this.percentageToolStripMenuItem_Click); - // - // differenceToolStripMenuItem - // - this.differenceToolStripMenuItem.CheckOnClick = true; - this.differenceToolStripMenuItem.Name = "differenceToolStripMenuItem"; - this.differenceToolStripMenuItem.Size = new System.Drawing.Size(195, 22); - this.differenceToolStripMenuItem.Text = "Difference (end-start)"; - this.differenceToolStripMenuItem.Click += new System.EventHandler(this.differenceToolStripMenuItem_Click); - // - // endValueToolStripMenuItem - // - this.endValueToolStripMenuItem.CheckOnClick = true; - this.endValueToolStripMenuItem.Name = "endValueToolStripMenuItem"; - this.endValueToolStripMenuItem.Size = new System.Drawing.Size(195, 22); - this.endValueToolStripMenuItem.Text = "End Value (% over end)"; - this.endValueToolStripMenuItem.Click += new System.EventHandler(this.endValueToolStripMenuItem_Click); - // - // extendedGammaTestToolStripMenuItem - // - this.extendedGammaTestToolStripMenuItem.Checked = true; - this.extendedGammaTestToolStripMenuItem.CheckOnClick = true; - this.extendedGammaTestToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.extendedGammaTestToolStripMenuItem.Name = "extendedGammaTestToolStripMenuItem"; - this.extendedGammaTestToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.extendedGammaTestToolStripMenuItem.Text = "Extended Gamma Test"; - this.extendedGammaTestToolStripMenuItem.ToolTipText = "Extended gamma test using 16 RGB shades instead of basic 6. Provides better accur" + - "acy, highly recommended."; - this.extendedGammaTestToolStripMenuItem.Click += new System.EventHandler(this.extendedGammaTestToolStripMenuItem_Click); + // settingsMenuItem + // + this.settingsMenuItem.CheckOnClick = true; + this.settingsMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.settingsMenuItem.Name = "settingsMenuItem"; + this.settingsMenuItem.Size = new System.Drawing.Size(84, 20); + this.settingsMenuItem.Text = "Test Settings"; + this.settingsMenuItem.Click += new System.EventHandler(this.settingsMenuItem_Click); // // programSettingsToolStripMenuItem // this.programSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.aboutProgramToolStripMenuItem, this.bugReportMenuItem, - this.minimiseToTrayToolStripMenuItem, - this.suppressDialogBoxesToolStripMenuItem, - this.IgnoreErrorsMenuItem}); + this.minimiseToTrayToolStripMenuItem}); this.programSettingsToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.programSettingsToolStripMenuItem.Name = "programSettingsToolStripMenuItem"; this.programSettingsToolStripMenuItem.Size = new System.Drawing.Size(110, 20); @@ -482,7 +195,7 @@ private void InitializeComponent() this.aboutProgramToolStripMenuItem.CheckOnClick = true; this.aboutProgramToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.aboutProgramToolStripMenuItem.Name = "aboutProgramToolStripMenuItem"; - this.aboutProgramToolStripMenuItem.Size = new System.Drawing.Size(192, 22); + this.aboutProgramToolStripMenuItem.Size = new System.Drawing.Size(162, 22); this.aboutProgramToolStripMenuItem.Text = "About Program"; this.aboutProgramToolStripMenuItem.Click += new System.EventHandler(this.aboutProgramToolStripMenuItem_Click); // @@ -492,7 +205,7 @@ private void InitializeComponent() this.bugReportMenuItem.CheckOnClick = true; this.bugReportMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.bugReportMenuItem.Name = "bugReportMenuItem"; - this.bugReportMenuItem.Size = new System.Drawing.Size(192, 22); + this.bugReportMenuItem.Size = new System.Drawing.Size(162, 22); this.bugReportMenuItem.Text = "Report A Bug"; this.bugReportMenuItem.Click += new System.EventHandler(this.bugReportMenuItem_Click); // @@ -502,34 +215,10 @@ private void InitializeComponent() this.minimiseToTrayToolStripMenuItem.CheckOnClick = true; this.minimiseToTrayToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ButtonFace; this.minimiseToTrayToolStripMenuItem.Name = "minimiseToTrayToolStripMenuItem"; - this.minimiseToTrayToolStripMenuItem.Size = new System.Drawing.Size(192, 22); + this.minimiseToTrayToolStripMenuItem.Size = new System.Drawing.Size(162, 22); this.minimiseToTrayToolStripMenuItem.Text = "Minimise To Tray"; this.minimiseToTrayToolStripMenuItem.Click += new System.EventHandler(this.minimiseToTrayToolStripMenuItem_Click); // - // suppressDialogBoxesToolStripMenuItem - // - this.suppressDialogBoxesToolStripMenuItem.BackColor = System.Drawing.SystemColors.ControlDarkDark; - this.suppressDialogBoxesToolStripMenuItem.CheckOnClick = true; - this.suppressDialogBoxesToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; - this.suppressDialogBoxesToolStripMenuItem.Name = "suppressDialogBoxesToolStripMenuItem"; - this.suppressDialogBoxesToolStripMenuItem.Size = new System.Drawing.Size(192, 22); - this.suppressDialogBoxesToolStripMenuItem.Text = "Suppress Dialog Boxes"; - this.suppressDialogBoxesToolStripMenuItem.ToolTipText = "Suppress warning and mid-test error dialog boxes."; - this.suppressDialogBoxesToolStripMenuItem.Click += new System.EventHandler(this.suppressDialogBoxesToolStripMenuItem_Click); - // - // IgnoreErrorsMenuItem - // - this.IgnoreErrorsMenuItem.BackColor = System.Drawing.SystemColors.ControlDarkDark; - this.IgnoreErrorsMenuItem.Checked = true; - this.IgnoreErrorsMenuItem.CheckOnClick = true; - this.IgnoreErrorsMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.IgnoreErrorsMenuItem.ForeColor = System.Drawing.SystemColors.ButtonHighlight; - this.IgnoreErrorsMenuItem.Name = "IgnoreErrorsMenuItem"; - this.IgnoreErrorsMenuItem.Size = new System.Drawing.Size(192, 22); - this.IgnoreErrorsMenuItem.Text = "Ignore Mid Run Errors"; - this.IgnoreErrorsMenuItem.ToolTipText = "Ignore mid-run errors "; - this.IgnoreErrorsMenuItem.Click += new System.EventHandler(this.IgnoreErrorsMenuItem_Click); - // // BrightnessCalBtn // this.BrightnessCalBtn.ForeColor = System.Drawing.SystemColors.ButtonHighlight; @@ -593,132 +282,80 @@ private void InitializeComponent() this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 20); // - // devStatLbl - // - this.devStatLbl.AutoSize = true; - this.devStatLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.devStatLbl.Location = new System.Drawing.Point(16, 8); - this.devStatLbl.Name = "devStatLbl"; - this.devStatLbl.Size = new System.Drawing.Size(298, 25); - this.devStatLbl.TabIndex = 5; - this.devStatLbl.Text = "Device Connection Status: "; - // // devStat // - this.devStat.AutoSize = true; this.devStat.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.devStat.Location = new System.Drawing.Point(320, 8); + this.devStat.Location = new System.Drawing.Point(12, 9); this.devStat.Name = "devStat"; - this.devStat.Size = new System.Drawing.Size(252, 25); + this.devStat.Size = new System.Drawing.Size(265, 25); this.devStat.TabIndex = 6; - this.devStat.Text = "Waiting for Connection"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.Location = new System.Drawing.Point(228, 12); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(143, 24); - this.label3.TabIndex = 13; - this.label3.Text = "Analyse Results"; + this.devStat.Text = "Device Connected"; + this.devStat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // controlsPanel // + this.controlsPanel.BackColor = System.Drawing.Color.White; this.controlsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.controlsPanel.Controls.Add(this.testSettingsBtn); this.controlsPanel.Controls.Add(this.vsyncStateList); - this.controlsPanel.Controls.Add(this.vsyncHelpBtn); this.controlsPanel.Controls.Add(this.label15); - this.controlsPanel.Controls.Add(this.helpCaptureBtn); - this.controlsPanel.Controls.Add(this.helpCyclesBtn); - this.controlsPanel.Controls.Add(this.helpFramerateBtn); this.controlsPanel.Controls.Add(this.captureTimeBox); + this.controlsPanel.Controls.Add(this.launchBtn); this.controlsPanel.Controls.Add(this.label17); - this.controlsPanel.Controls.Add(this.label13); this.controlsPanel.Controls.Add(this.fpsLimitList); this.controlsPanel.Controls.Add(this.label4); this.controlsPanel.Controls.Add(this.testCount); this.controlsPanel.Controls.Add(this.label2); - this.controlsPanel.Controls.Add(this.launchBtn); - this.controlsPanel.Location = new System.Drawing.Point(9, 121); + this.controlsPanel.Location = new System.Drawing.Point(8, 57); this.controlsPanel.Name = "controlsPanel"; - this.controlsPanel.Size = new System.Drawing.Size(286, 285); + this.controlsPanel.Size = new System.Drawing.Size(288, 296); this.controlsPanel.TabIndex = 15; this.controlsPanel.Tag = ""; // + // testSettingsBtn + // + this.testSettingsBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(195)))), ((int)(((byte)(53))))); + this.testSettingsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.testSettingsBtn.Font = new System.Drawing.Font("Consolas", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.testSettingsBtn.ForeColor = System.Drawing.Color.White; + this.testSettingsBtn.Location = new System.Drawing.Point(19, 83); + this.testSettingsBtn.Name = "testSettingsBtn"; + this.testSettingsBtn.Size = new System.Drawing.Size(214, 36); + this.testSettingsBtn.TabIndex = 29; + this.testSettingsBtn.Text = "> Test Settings"; + this.toolTipController.SetToolTip(this.testSettingsBtn, "Open Test Settings Window"); + this.testSettingsBtn.UseVisualStyleBackColor = false; + this.testSettingsBtn.Click += new System.EventHandler(this.testSettingsBtn_Click); + // // vsyncStateList // this.vsyncStateList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.vsyncStateList.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.vsyncStateList.FormattingEnabled = true; - this.vsyncStateList.Location = new System.Drawing.Point(158, 153); + this.vsyncStateList.Location = new System.Drawing.Point(157, 256); this.vsyncStateList.Name = "vsyncStateList"; - this.vsyncStateList.Size = new System.Drawing.Size(86, 26); + this.vsyncStateList.Size = new System.Drawing.Size(111, 26); this.vsyncStateList.TabIndex = 28; this.vsyncStateList.SelectedIndexChanged += new System.EventHandler(this.vsyncStateList_SelectedIndexChanged); // - // vsyncHelpBtn - // - this.vsyncHelpBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.vsyncHelpBtn.Location = new System.Drawing.Point(249, 152); - this.vsyncHelpBtn.Name = "vsyncHelpBtn"; - this.vsyncHelpBtn.Size = new System.Drawing.Size(28, 28); - this.vsyncHelpBtn.TabIndex = 27; - this.vsyncHelpBtn.Text = "?"; - this.vsyncHelpBtn.UseVisualStyleBackColor = true; - this.vsyncHelpBtn.Click += new System.EventHandler(this.vsyncHelpBtn_Click); - // // label15 // this.label15.AutoSize = true; this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label15.Location = new System.Drawing.Point(13, 153); + this.label15.Location = new System.Drawing.Point(12, 256); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(116, 24); this.label15.TabIndex = 26; this.label15.Text = "VSync State:"; // - // helpCaptureBtn - // - this.helpCaptureBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.helpCaptureBtn.Location = new System.Drawing.Point(249, 114); - this.helpCaptureBtn.Name = "helpCaptureBtn"; - this.helpCaptureBtn.Size = new System.Drawing.Size(28, 28); - this.helpCaptureBtn.TabIndex = 25; - this.helpCaptureBtn.Text = "?"; - this.helpCaptureBtn.UseVisualStyleBackColor = true; - this.helpCaptureBtn.Click += new System.EventHandler(this.helpCaptureBtn_Click); - // - // helpCyclesBtn - // - this.helpCyclesBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.helpCyclesBtn.Location = new System.Drawing.Point(249, 77); - this.helpCyclesBtn.Name = "helpCyclesBtn"; - this.helpCyclesBtn.Size = new System.Drawing.Size(28, 28); - this.helpCyclesBtn.TabIndex = 24; - this.helpCyclesBtn.Text = "?"; - this.helpCyclesBtn.UseVisualStyleBackColor = true; - this.helpCyclesBtn.Click += new System.EventHandler(this.helpCyclesBtn_Click); - // - // helpFramerateBtn - // - this.helpFramerateBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.helpFramerateBtn.Location = new System.Drawing.Point(249, 42); - this.helpFramerateBtn.Name = "helpFramerateBtn"; - this.helpFramerateBtn.Size = new System.Drawing.Size(28, 28); - this.helpFramerateBtn.TabIndex = 23; - this.helpFramerateBtn.Text = "?"; - this.helpFramerateBtn.UseVisualStyleBackColor = true; - this.helpFramerateBtn.Click += new System.EventHandler(this.helpFramerateBtn_Click); - // // captureTimeBox // this.captureTimeBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.captureTimeBox.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.captureTimeBox.FormattingEnabled = true; - this.captureTimeBox.Location = new System.Drawing.Point(158, 115); + this.captureTimeBox.Location = new System.Drawing.Point(157, 212); this.captureTimeBox.Name = "captureTimeBox"; - this.captureTimeBox.Size = new System.Drawing.Size(86, 26); + this.captureTimeBox.Size = new System.Drawing.Size(111, 26); this.captureTimeBox.TabIndex = 21; this.captureTimeBox.SelectedIndexChanged += new System.EventHandler(this.captureTimeBox_SelectedIndexChanged); // @@ -726,30 +363,20 @@ private void InitializeComponent() // this.label17.AutoSize = true; this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label17.Location = new System.Drawing.Point(13, 115); + this.label17.Location = new System.Drawing.Point(12, 212); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(129, 24); this.label17.TabIndex = 22; this.label17.Text = "Capture Time:"; // - // label13 - // - this.label13.AutoSize = true; - this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label13.Location = new System.Drawing.Point(37, 5); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(211, 24); - this.label13.TabIndex = 15; - this.label13.Text = "Response Time Testing"; - // // fpsLimitList // this.fpsLimitList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.fpsLimitList.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.fpsLimitList.FormattingEnabled = true; - this.fpsLimitList.Location = new System.Drawing.Point(158, 43); + this.fpsLimitList.Location = new System.Drawing.Point(157, 129); this.fpsLimitList.Name = "fpsLimitList"; - this.fpsLimitList.Size = new System.Drawing.Size(86, 26); + this.fpsLimitList.Size = new System.Drawing.Size(111, 26); this.fpsLimitList.TabIndex = 3; this.fpsLimitList.SelectedIndexChanged += new System.EventHandler(this.fpsLimitList_SelectedIndexChanged); // @@ -757,7 +384,7 @@ private void InitializeComponent() // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.Location = new System.Drawing.Point(13, 43); + this.label4.Location = new System.Drawing.Point(12, 129); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(138, 24); this.label4.TabIndex = 20; @@ -767,7 +394,7 @@ private void InitializeComponent() // this.testCount.Cursor = System.Windows.Forms.Cursors.Hand; this.testCount.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.testCount.Location = new System.Drawing.Point(196, 78); + this.testCount.Location = new System.Drawing.Point(212, 169); this.testCount.Maximum = new decimal(new int[] { 10, 0, @@ -779,7 +406,7 @@ private void InitializeComponent() 0, 0}); this.testCount.Name = "testCount"; - this.testCount.Size = new System.Drawing.Size(48, 26); + this.testCount.Size = new System.Drawing.Size(56, 26); this.testCount.TabIndex = 4; this.testCount.Value = new decimal(new int[] { 5, @@ -792,86 +419,64 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(13, 80); + this.label2.Location = new System.Drawing.Point(12, 171); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(165, 24); + this.label2.Size = new System.Drawing.Size(194, 24); this.label2.TabIndex = 17; - this.label2.Text = "Number of Cycles:"; + this.label2.Text = "Number of Test Runs:"; + // + // helpBtn + // + this.helpBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(195)))), ((int)(((byte)(53))))); + this.helpBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.helpBtn.Font = new System.Drawing.Font("Calibri", 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.helpBtn.ForeColor = System.Drawing.Color.White; + this.helpBtn.Location = new System.Drawing.Point(598, 57); + this.helpBtn.Name = "helpBtn"; + this.helpBtn.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); + this.helpBtn.Size = new System.Drawing.Size(55, 55); + this.helpBtn.TabIndex = 23; + this.helpBtn.Text = "?"; + this.toolTipController.SetToolTip(this.helpBtn, "Open Help Window"); + this.helpBtn.UseVisualStyleBackColor = false; + this.helpBtn.Click += new System.EventHandler(this.helpBtn_Click); // // refreshMonitorListBtn // - this.refreshMonitorListBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.refreshMonitorListBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(180)))), ((int)(((byte)(76))))); + this.refreshMonitorListBtn.BackgroundImage = global::OSRTT_Launcher.Properties.Resources.arrow_rotate_right; + this.refreshMonitorListBtn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.refreshMonitorListBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.refreshMonitorListBtn.Font = new System.Drawing.Font("Consolas", 12.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.refreshMonitorListBtn.Location = new System.Drawing.Point(442, 14); + this.refreshMonitorListBtn.Location = new System.Drawing.Point(307, 7); this.refreshMonitorListBtn.Name = "refreshMonitorListBtn"; - this.refreshMonitorListBtn.Size = new System.Drawing.Size(128, 26); + this.refreshMonitorListBtn.Padding = new System.Windows.Forms.Padding(10); + this.refreshMonitorListBtn.Size = new System.Drawing.Size(30, 30); this.refreshMonitorListBtn.TabIndex = 2; - this.refreshMonitorListBtn.Text = "Refresh List"; + this.toolTipController.SetToolTip(this.refreshMonitorListBtn, "Refresh Monitor List"); this.refreshMonitorListBtn.UseVisualStyleBackColor = false; this.refreshMonitorListBtn.Click += new System.EventHandler(this.refreshMonitorListBtn_Click); // // monitorCB // this.monitorCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.monitorCB.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.monitorCB.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.monitorCB.FormattingEnabled = true; - this.monitorCB.Location = new System.Drawing.Point(196, 14); + this.monitorCB.Location = new System.Drawing.Point(123, 10); this.monitorCB.Name = "monitorCB"; - this.monitorCB.Size = new System.Drawing.Size(238, 26); + this.monitorCB.Size = new System.Drawing.Size(176, 24); this.monitorCB.TabIndex = 1; this.monitorCB.SelectedIndexChanged += new System.EventHandler(this.monitorCB_SelectedIndexChanged); // // label1 // this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(15, 14); + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(6, 11); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(182, 24); + this.label1.Size = new System.Drawing.Size(119, 20); this.label1.TabIndex = 14; - this.label1.Text = "Select your monitor: "; - // - // analysePanel - // - this.analysePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.analysePanel.Controls.Add(this.opnResultsBtn); - this.analysePanel.Controls.Add(this.importRawFolder); - this.analysePanel.Controls.Add(this.resultsBtn); - this.analysePanel.Controls.Add(this.label3); - this.analysePanel.Location = new System.Drawing.Point(9, 417); - this.analysePanel.Name = "analysePanel"; - this.analysePanel.Size = new System.Drawing.Size(588, 133); - this.analysePanel.TabIndex = 16; - // - // opnResultsBtn - // - this.opnResultsBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.opnResultsBtn.FlatAppearance.BorderSize = 0; - this.opnResultsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.opnResultsBtn.Font = new System.Drawing.Font("Consolas", 16F, System.Drawing.FontStyle.Bold); - this.opnResultsBtn.ImageAlign = System.Drawing.ContentAlignment.TopRight; - this.opnResultsBtn.Location = new System.Drawing.Point(17, 47); - this.opnResultsBtn.Name = "opnResultsBtn"; - this.opnResultsBtn.Size = new System.Drawing.Size(175, 75); - this.opnResultsBtn.TabIndex = 15; - this.opnResultsBtn.Text = "Open Results Folder"; - this.opnResultsBtn.UseVisualStyleBackColor = false; - this.opnResultsBtn.Click += new System.EventHandler(this.opnResultsBtn_Click); - // - // importRawFolder - // - this.importRawFolder.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.importRawFolder.FlatAppearance.BorderSize = 0; - this.importRawFolder.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.importRawFolder.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); - this.importRawFolder.Location = new System.Drawing.Point(394, 47); - this.importRawFolder.Name = "importRawFolder"; - this.importRawFolder.Size = new System.Drawing.Size(175, 75); - this.importRawFolder.TabIndex = 7; - this.importRawFolder.Text = "Import Raw Data Folder"; - this.importRawFolder.UseVisualStyleBackColor = false; - this.importRawFolder.Click += new System.EventHandler(this.importRawFolder_Click); + this.label1.Text = "Select monitor: "; // // rawValText // @@ -1024,7 +629,7 @@ private void InitializeComponent() this.brightnessPanel.Controls.Add(this.brightnessText); this.brightnessPanel.Controls.Add(this.incPotValBtn); this.brightnessPanel.Controls.Add(this.label7); - this.brightnessPanel.Location = new System.Drawing.Point(1115, 36); + this.brightnessPanel.Location = new System.Drawing.Point(1099, 35); this.brightnessPanel.Name = "brightnessPanel"; this.brightnessPanel.Size = new System.Drawing.Size(994, 758); this.brightnessPanel.TabIndex = 28; @@ -1072,22 +677,24 @@ private void InitializeComponent() // aboutPanel // this.aboutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.aboutPanel.Controls.Add(this.boardSerialLbl); + this.aboutPanel.Controls.Add(this.label13); this.aboutPanel.Controls.Add(this.linkLabel1); this.aboutPanel.Controls.Add(this.firmVerLbl); this.aboutPanel.Controls.Add(this.label14); this.aboutPanel.Controls.Add(this.softVerLbl); this.aboutPanel.Controls.Add(this.label12); this.aboutPanel.Controls.Add(this.label10); - this.aboutPanel.Location = new System.Drawing.Point(9, 562); + this.aboutPanel.Location = new System.Drawing.Point(10, 402); this.aboutPanel.Name = "aboutPanel"; - this.aboutPanel.Size = new System.Drawing.Size(588, 109); + this.aboutPanel.Size = new System.Drawing.Size(645, 109); this.aboutPanel.TabIndex = 29; // // linkLabel1 // this.linkLabel1.AutoSize = true; this.linkLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.linkLabel1.Location = new System.Drawing.Point(197, 76); + this.linkLabel1.Location = new System.Drawing.Point(339, 10); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(197, 24); this.linkLabel1.TabIndex = 26; @@ -1099,7 +706,7 @@ private void InitializeComponent() // this.firmVerLbl.AutoSize = true; this.firmVerLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.firmVerLbl.Location = new System.Drawing.Point(524, 43); + this.firmVerLbl.Location = new System.Drawing.Point(573, 43); this.firmVerLbl.Name = "firmVerLbl"; this.firmVerLbl.Size = new System.Drawing.Size(48, 24); this.firmVerLbl.TabIndex = 24; @@ -1109,7 +716,7 @@ private void InitializeComponent() // this.label14.AutoSize = true; this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label14.Location = new System.Drawing.Point(300, 43); + this.label14.Location = new System.Drawing.Point(349, 43); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(227, 24); this.label14.TabIndex = 23; @@ -1139,7 +746,7 @@ private void InitializeComponent() // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label10.Location = new System.Drawing.Point(192, 9); + this.label10.Location = new System.Drawing.Point(101, 10); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(214, 24); this.label10.TabIndex = 14; @@ -1151,9 +758,9 @@ private void InitializeComponent() this.debugPanel.Controls.Add(this.serialSendBtn); this.debugPanel.Controls.Add(this.serialSendBox); this.debugPanel.Controls.Add(this.richTextBox1); - this.debugPanel.Location = new System.Drawing.Point(619, 30); + this.debugPanel.Location = new System.Drawing.Point(673, 32); this.debugPanel.Name = "debugPanel"; - this.debugPanel.Size = new System.Drawing.Size(395, 737); + this.debugPanel.Size = new System.Drawing.Size(395, 361); this.debugPanel.TabIndex = 30; // // serialSendBtn @@ -1161,7 +768,7 @@ private void InitializeComponent() this.serialSendBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; this.serialSendBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.serialSendBtn.Font = new System.Drawing.Font("Consolas", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.serialSendBtn.Location = new System.Drawing.Point(251, 702); + this.serialSendBtn.Location = new System.Drawing.Point(251, 327); this.serialSendBtn.Name = "serialSendBtn"; this.serialSendBtn.Size = new System.Drawing.Size(128, 26); this.serialSendBtn.TabIndex = 21; @@ -1172,13 +779,14 @@ private void InitializeComponent() // serialSendBox // this.serialSendBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.serialSendBox.Location = new System.Drawing.Point(15, 702); + this.serialSendBox.Location = new System.Drawing.Point(15, 327); this.serialSendBox.Name = "serialSendBox"; this.serialSendBox.Size = new System.Drawing.Size(230, 26); this.serialSendBox.TabIndex = 20; // // inputLagPanel // + this.inputLagPanel.BackColor = System.Drawing.Color.White; this.inputLagPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.inputLagPanel.Controls.Add(this.inputLagButton); this.inputLagPanel.Controls.Add(this.numberOfClicksLabel); @@ -1187,22 +795,24 @@ private void InitializeComponent() this.inputLagPanel.Controls.Add(this.numberOfClicksSlider); this.inputLagPanel.Controls.Add(this.label16); this.inputLagPanel.Controls.Add(this.timeBetweenSlider); - this.inputLagPanel.Controls.Add(this.label18); - this.inputLagPanel.Location = new System.Drawing.Point(314, 121); + this.inputLagPanel.Location = new System.Drawing.Point(303, 118); this.inputLagPanel.Name = "inputLagPanel"; - this.inputLagPanel.Size = new System.Drawing.Size(283, 285); + this.inputLagPanel.Size = new System.Drawing.Size(350, 235); this.inputLagPanel.TabIndex = 30; // // inputLagButton // - this.inputLagButton.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.inputLagButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.inputLagButton.Font = new System.Drawing.Font("Consolas", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.inputLagButton.Location = new System.Drawing.Point(20, 194); + this.inputLagButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(180)))), ((int)(((byte)(76))))); + this.inputLagButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.inputLagButton.Font = new System.Drawing.Font("Consolas", 20F, System.Drawing.FontStyle.Bold); + this.inputLagButton.ForeColor = System.Drawing.Color.White; + this.inputLagButton.Location = new System.Drawing.Point(-1, -1); this.inputLagButton.Name = "inputLagButton"; - this.inputLagButton.Size = new System.Drawing.Size(235, 74); - this.inputLagButton.TabIndex = 21; - this.inputLagButton.Text = "Start Latency Testing"; + this.inputLagButton.Padding = new System.Windows.Forms.Padding(20, 0, 10, 0); + this.inputLagButton.Size = new System.Drawing.Size(350, 74); + this.inputLagButton.TabIndex = 1; + this.inputLagButton.Text = "Start System Latency Testing"; + this.toolTipController.SetToolTip(this.inputLagButton, "Start Total System Latency Testing"); this.inputLagButton.UseVisualStyleBackColor = false; this.inputLagButton.Click += new System.EventHandler(this.inputLagButton_Click); // @@ -1210,7 +820,7 @@ private void InitializeComponent() // this.numberOfClicksLabel.AutoSize = true; this.numberOfClicksLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.numberOfClicksLabel.Location = new System.Drawing.Point(211, 119); + this.numberOfClicksLabel.Location = new System.Drawing.Point(240, 163); this.numberOfClicksLabel.Name = "numberOfClicksLabel"; this.numberOfClicksLabel.Size = new System.Drawing.Size(20, 24); this.numberOfClicksLabel.TabIndex = 31; @@ -1220,7 +830,7 @@ private void InitializeComponent() // this.label20.AutoSize = true; this.label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label20.Location = new System.Drawing.Point(48, 119); + this.label20.Location = new System.Drawing.Point(77, 163); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(158, 24); this.label20.TabIndex = 30; @@ -1230,7 +840,7 @@ private void InitializeComponent() // this.timeBetweenLabel.AutoSize = true; this.timeBetweenLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.timeBetweenLabel.Location = new System.Drawing.Point(218, 44); + this.timeBetweenLabel.Location = new System.Drawing.Point(248, 88); this.timeBetweenLabel.Name = "timeBetweenLabel"; this.timeBetweenLabel.Size = new System.Drawing.Size(44, 24); this.timeBetweenLabel.TabIndex = 28; @@ -1238,14 +848,14 @@ private void InitializeComponent() // // numberOfClicksSlider // - this.numberOfClicksSlider.BackColor = System.Drawing.SystemColors.ControlDark; + this.numberOfClicksSlider.BackColor = System.Drawing.Color.White; this.numberOfClicksSlider.Cursor = System.Windows.Forms.Cursors.SizeWE; this.numberOfClicksSlider.LargeChange = 1; - this.numberOfClicksSlider.Location = new System.Drawing.Point(18, 141); + this.numberOfClicksSlider.Location = new System.Drawing.Point(17, 185); this.numberOfClicksSlider.Maximum = 50; this.numberOfClicksSlider.Minimum = 1; this.numberOfClicksSlider.Name = "numberOfClicksSlider"; - this.numberOfClicksSlider.Size = new System.Drawing.Size(248, 45); + this.numberOfClicksSlider.Size = new System.Drawing.Size(310, 45); this.numberOfClicksSlider.TabIndex = 16; this.numberOfClicksSlider.TickFrequency = 5; this.numberOfClicksSlider.TickStyle = System.Windows.Forms.TickStyle.Both; @@ -1256,7 +866,7 @@ private void InitializeComponent() // this.label16.AutoSize = true; this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label16.Location = new System.Drawing.Point(14, 44); + this.label16.Location = new System.Drawing.Point(44, 88); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(191, 24); this.label16.TabIndex = 27; @@ -1265,85 +875,140 @@ private void InitializeComponent() // timeBetweenSlider // this.timeBetweenSlider.Cursor = System.Windows.Forms.Cursors.SizeWE; - this.timeBetweenSlider.Location = new System.Drawing.Point(18, 66); + this.timeBetweenSlider.Location = new System.Drawing.Point(17, 110); this.timeBetweenSlider.Minimum = 1; this.timeBetweenSlider.Name = "timeBetweenSlider"; - this.timeBetweenSlider.Size = new System.Drawing.Size(248, 45); + this.timeBetweenSlider.Size = new System.Drawing.Size(310, 45); this.timeBetweenSlider.TabIndex = 15; this.timeBetweenSlider.TickStyle = System.Windows.Forms.TickStyle.Both; this.timeBetweenSlider.Value = 1; this.timeBetweenSlider.Scroll += new System.EventHandler(this.timeBetweenSlider_Scroll); // - // label18 - // - this.label18.AutoSize = true; - this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label18.Location = new System.Drawing.Point(14, 5); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(254, 24); - this.label18.TabIndex = 14; - this.label18.Text = "Total System Latency Testing"; - // // deviceStatusPanel // + this.deviceStatusPanel.BackColor = System.Drawing.Color.White; this.deviceStatusPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.deviceStatusPanel.Controls.Add(this.devStatLbl); + this.deviceStatusPanel.Controls.Add(this.checkImg); this.deviceStatusPanel.Controls.Add(this.devStat); - this.deviceStatusPanel.Location = new System.Drawing.Point(9, 4); + this.deviceStatusPanel.Location = new System.Drawing.Point(8, 6); this.deviceStatusPanel.Name = "deviceStatusPanel"; - this.deviceStatusPanel.Size = new System.Drawing.Size(588, 43); + this.deviceStatusPanel.Size = new System.Drawing.Size(288, 45); this.deviceStatusPanel.TabIndex = 30; + this.toolTipController.SetToolTip(this.deviceStatusPanel, "Device Status"); + // + // checkImg + // + this.checkImg.Image = global::OSRTT_Launcher.Properties.Resources.check; + this.checkImg.Location = new System.Drawing.Point(219, 7); + this.checkImg.Name = "checkImg"; + this.checkImg.Size = new System.Drawing.Size(58, 29); + this.checkImg.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.checkImg.TabIndex = 7; + this.checkImg.TabStop = false; // // monitorPanel // + this.monitorPanel.BackColor = System.Drawing.Color.White; this.monitorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.monitorPanel.Controls.Add(this.monitorCB); this.monitorPanel.Controls.Add(this.label1); this.monitorPanel.Controls.Add(this.refreshMonitorListBtn); - this.monitorPanel.Location = new System.Drawing.Point(9, 56); + this.monitorPanel.Location = new System.Drawing.Point(303, 6); this.monitorPanel.Name = "monitorPanel"; - this.monitorPanel.Size = new System.Drawing.Size(588, 54); + this.monitorPanel.Size = new System.Drawing.Size(350, 45); this.monitorPanel.TabIndex = 31; // // mainPanel // - this.mainPanel.Controls.Add(this.deviceStatusPanel); + this.mainPanel.Controls.Add(this.resultsFolderBtn); + this.mainPanel.Controls.Add(this.resultsViewBtn); + this.mainPanel.Controls.Add(this.inputLagPanel); this.mainPanel.Controls.Add(this.controlsPanel); + this.mainPanel.Controls.Add(this.deviceStatusPanel); this.mainPanel.Controls.Add(this.monitorPanel); - this.mainPanel.Controls.Add(this.analysePanel); - this.mainPanel.Controls.Add(this.aboutPanel); - this.mainPanel.Controls.Add(this.inputLagPanel); - this.mainPanel.Location = new System.Drawing.Point(2, 26); + this.mainPanel.Controls.Add(this.helpBtn); + this.mainPanel.Location = new System.Drawing.Point(2, 29); this.mainPanel.Name = "mainPanel"; - this.mainPanel.Size = new System.Drawing.Size(611, 678); + this.mainPanel.Size = new System.Drawing.Size(662, 364); this.mainPanel.TabIndex = 32; // + // resultsFolderBtn + // + this.resultsFolderBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(197)))), ((int)(((byte)(230))))); + this.resultsFolderBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.resultsFolderBtn.Font = new System.Drawing.Font("Consolas", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.resultsFolderBtn.ForeColor = System.Drawing.Color.White; + this.resultsFolderBtn.Location = new System.Drawing.Point(481, 57); + this.resultsFolderBtn.Name = "resultsFolderBtn"; + this.resultsFolderBtn.Size = new System.Drawing.Size(111, 55); + this.resultsFolderBtn.TabIndex = 33; + this.resultsFolderBtn.Text = "Results Folder"; + this.toolTipController.SetToolTip(this.resultsFolderBtn, "Open Results Folder"); + this.resultsFolderBtn.UseVisualStyleBackColor = false; + this.resultsFolderBtn.Click += new System.EventHandler(this.ResultsFolderBtn_Click); + // + // resultsViewBtn + // + this.resultsViewBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(197)))), ((int)(((byte)(230))))); + this.resultsViewBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.resultsViewBtn.Font = new System.Drawing.Font("Consolas", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.resultsViewBtn.ForeColor = System.Drawing.Color.White; + this.resultsViewBtn.Location = new System.Drawing.Point(303, 57); + this.resultsViewBtn.Name = "resultsViewBtn"; + this.resultsViewBtn.Size = new System.Drawing.Size(172, 55); + this.resultsViewBtn.TabIndex = 32; + this.resultsViewBtn.Text = "Heatmaps && Graphs"; + this.toolTipController.SetToolTip(this.resultsViewBtn, "Open Results View to process && view existing results"); + this.resultsViewBtn.UseVisualStyleBackColor = false; + this.resultsViewBtn.Click += new System.EventHandler(this.resultsViewBtn_Click); + // // progressBar1 // - this.progressBar1.Location = new System.Drawing.Point(0, 710); + this.progressBar1.Location = new System.Drawing.Point(0, 514); this.progressBar1.MarqueeAnimationSpeed = 30; this.progressBar1.Maximum = 50; this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(613, 23); + this.progressBar1.Size = new System.Drawing.Size(664, 23); this.progressBar1.Step = 50; this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; this.progressBar1.TabIndex = 33; this.progressBar1.Visible = false; // + // boardSerialLbl + // + this.boardSerialLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.boardSerialLbl.Location = new System.Drawing.Point(290, 75); + this.boardSerialLbl.Name = "boardSerialLbl"; + this.boardSerialLbl.Size = new System.Drawing.Size(271, 24); + this.boardSerialLbl.TabIndex = 28; + this.boardSerialLbl.Text = "Not Connected"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.Location = new System.Drawing.Point(99, 75); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(191, 24); + this.label13.TabIndex = 27; + this.label13.Text = "Board Serial Number:"; + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.ControlDark; - this.ClientSize = new System.Drawing.Size(1924, 809); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); + this.ClientSize = new System.Drawing.Size(2103, 808); this.Controls.Add(this.progressBar1); this.Controls.Add(this.mainPanel); this.Controls.Add(this.debugPanel); this.Controls.Add(this.brightnessPanel); + this.Controls.Add(this.aboutPanel); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; this.MaximizeBox = false; this.Name = "Main"; + this.Padding = new System.Windows.Forms.Padding(5); this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Text = "OSRTT Launcher"; this.Load += new System.EventHandler(this.Main_Load); @@ -1352,8 +1017,6 @@ private void InitializeComponent() this.controlsPanel.ResumeLayout(false); this.controlsPanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.testCount)).EndInit(); - this.analysePanel.ResumeLayout(false); - this.analysePanel.PerformLayout(); this.brightnessPanel.ResumeLayout(false); this.brightnessPanel.PerformLayout(); this.aboutPanel.ResumeLayout(false); @@ -1365,7 +1028,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numberOfClicksSlider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.timeBetweenSlider)).EndInit(); this.deviceStatusPanel.ResumeLayout(false); - this.deviceStatusPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.checkImg)).EndInit(); this.monitorPanel.ResumeLayout(false); this.monitorPanel.PerformLayout(); this.mainPanel.ResumeLayout(false); @@ -1377,24 +1040,18 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Button launchBtn; - private System.Windows.Forms.Button resultsBtn; private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem deviceToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem updateDeviceToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem resultsSettingsToolStripMenuItem; - private System.Windows.Forms.Label devStatLbl; private System.Windows.Forms.Label devStat; - private System.Windows.Forms.Label label3; private System.Windows.Forms.ToolStripMenuItem analyseResultsToolStripMenuItem; private System.Windows.Forms.Panel controlsPanel; - private System.Windows.Forms.Panel analysePanel; private System.Windows.Forms.ComboBox monitorCB; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button refreshMonitorListBtn; private System.Windows.Forms.Label label2; private System.Windows.Forms.NumericUpDown testCount; - private System.Windows.Forms.Button importRawFolder; private System.Windows.Forms.ComboBox fpsLimitList; private System.Windows.Forms.Label label4; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; @@ -1414,16 +1071,10 @@ private void InitializeComponent() private System.Windows.Forms.NotifyIcon notifyIcon; private System.Windows.Forms.Label potValLabel; private System.Windows.Forms.Label label11; - private System.Windows.Forms.ToolStripMenuItem outputSettingsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem verboseOutputToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveGammaTableToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSmoothedDataToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem debugModeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveUSBOutputToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem programSettingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem minimiseToTrayToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem suppressDialogBoxesToolStripMenuItem; private System.Windows.Forms.Button closeBrightnessBtn; private System.Windows.Forms.ToolStripMenuItem aboutProgramToolStripMenuItem; private System.Windows.Forms.Panel aboutPanel; @@ -1436,27 +1087,8 @@ private void InitializeComponent() private System.Windows.Forms.Panel debugPanel; private System.Windows.Forms.Button serialSendBtn; private System.Windows.Forms.TextBox serialSendBox; - private System.Windows.Forms.ToolStripMenuItem saveXLSXMenuItem; - private System.Windows.Forms.ToolStripMenuItem recommendedSettingsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem advancedSettingsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem measurementsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem gamCorMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem threePercentMenuItem; - private System.Windows.Forms.ToolStripMenuItem tenPercentMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripMenuItem fixedRGB10OffsetToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem fixedRGB5OffsetToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem overshootSettingsMenuItem; - private System.Windows.Forms.ToolStripMenuItem gammaCorrectedToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem percentageToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem differenceToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem endValueToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveGraphsMenuItem; private System.Windows.Forms.Panel inputLagPanel; - private System.Windows.Forms.Label label18; private System.Windows.Forms.Panel deviceStatusPanel; - private System.Windows.Forms.Label label13; private System.Windows.Forms.Button inputLagButton; private System.Windows.Forms.Label numberOfClicksLabel; private System.Windows.Forms.Label label20; @@ -1468,21 +1100,20 @@ private void InitializeComponent() private System.Windows.Forms.Panel mainPanel; private System.Windows.Forms.ComboBox captureTimeBox; private System.Windows.Forms.Label label17; - private System.Windows.Forms.Button helpFramerateBtn; - private System.Windows.Forms.Button helpCyclesBtn; - private System.Windows.Forms.Button helpCaptureBtn; - private System.Windows.Forms.ToolStripMenuItem saveRawInputLagMenuItem; - private System.Windows.Forms.ToolStripMenuItem IgnoreErrorsMenuItem; + private System.Windows.Forms.Button helpBtn; private System.Windows.Forms.ToolStripMenuItem bugReportMenuItem; - private System.Windows.Forms.Button opnResultsBtn; private System.Windows.Forms.ComboBox vsyncStateList; - private System.Windows.Forms.Button vsyncHelpBtn; private System.Windows.Forms.Label label15; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - private System.Windows.Forms.ToolStripMenuItem convertRawGraphMenuItem; private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.ToolStripMenuItem testButtonMenuItem; - private System.Windows.Forms.ToolStripMenuItem extendedGammaTestToolStripMenuItem; + private System.Windows.Forms.Button testSettingsBtn; + private System.Windows.Forms.PictureBox checkImg; + private System.Windows.Forms.Button resultsViewBtn; + private System.Windows.Forms.ToolStripMenuItem settingsMenuItem; + private System.Windows.Forms.Button resultsFolderBtn; + private System.Windows.Forms.ToolTip toolTipController; + private System.Windows.Forms.Label boardSerialLbl; + private System.Windows.Forms.Label label13; } } diff --git a/OSRTT Launcher/OSRTT Launcher/Main.cs b/OSRTT Launcher/OSRTT Launcher/Main.cs index 7f32dfe..3a913d6 100644 --- a/OSRTT Launcher/OSRTT Launcher/Main.cs +++ b/OSRTT Launcher/OSRTT Launcher/Main.cs @@ -16,6 +16,7 @@ using WindowsDisplayAPI.DisplayConfig; using AutoUpdaterDotNET; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System.Resources; using System.Runtime.InteropServices; using Excel = Microsoft.Office.Interop.Excel; @@ -32,8 +33,6 @@ public partial class Main : Form private string softwareVersion = "2.3"; // TODO // - // Test new testing method (program run instead of device run) - // Save to results template // Denoising backlight strobing (gather data from gamma test) // // CANCEL TEST IF GAME CLOSED!!! (serial buffer still full of multiple results?? use checkfocusedwindow to also check if program is open? Although launchgame func should handle that and close..) @@ -66,6 +65,7 @@ public partial class Main : Form private bool paused = false; private bool testStarted = false; private bool triggerNextResult = false; + private bool vsyncTrigger = false; private List RGBArr = new List{0, 51, 102, 153, 204, 255}; private int currentStart = 0; @@ -79,26 +79,30 @@ public partial class Main : Form string path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase; string resultsFolderPath = ""; - private List> results = new List>(); - private List singleResults = new List(); + public ProcessData.runSettings runSettings; + private List> results = new List>(); + private List singleResults = new List(); + private List smoothedData = new List(); private List gamma = new List(); private List noiseLevel = new List(); - private List inputLagRawData = new List(); - private List inputLagProcessed = new List(); + private List inputLagRawData = new List(); + private List inputLagProcessed = new List(); private List importedFile = new List(); private List testLatency = new List(); - private List> multipleRunData = new List>(); - private Excel.Application resultsTemplate; - private Excel._Workbook resultsTemplateWorkbook; - private Excel.Application graphTemplate; - private Excel._Workbook graphTemplateWorkbook; + public ProcessData.rtMethods rtMethod; + public ProcessData.osMethods osMethod; + + private List> multipleRunData = new List>(); + private List averageData = new List(); + private List processedGamma = new List(); private bool excelInstalled = false; public class Displays { public string Name { get; set; } public int Freq { get; set; } public string Connection { get; set; } + public string ManufacturerCode { get; set; } } public List displayList = new List(); public class FPS @@ -230,51 +234,14 @@ private void setupFormElements() private void initialiseSettings() { testCount.Value = Properties.Settings.Default.Runs; - verboseOutputToolStripMenuItem.Checked = Properties.Settings.Default.Verbose; - saveGammaTableToolStripMenuItem.Checked = Properties.Settings.Default.saveGammaTable; - saveSmoothedDataToolStripMenuItem.Checked = Properties.Settings.Default.saveSmoothData; - threePercentMenuItem.Checked = Properties.Settings.Default.threePercentSetting; - tenPercentMenuItem.Checked = Properties.Settings.Default.tenPercentSetting; - fixedRGB5OffsetToolStripMenuItem.Checked = Properties.Settings.Default.RGB5Offset; - fixedRGB10OffsetToolStripMenuItem.Checked = Properties.Settings.Default.RGB10Offset; - gammaCorrectedToolStripMenuItem.Checked = Properties.Settings.Default.gammaCorrectedSetting; - endValueToolStripMenuItem.Checked = Properties.Settings.Default.gammaPercentSetting; - differenceToolStripMenuItem.Checked = Properties.Settings.Default.gammaPercentDiff; - if (Properties.Settings.Default.gammaPercentSetting || Properties.Settings.Default.gammaPercentDiff) - { - percentageToolStripMenuItem.Checked = true; - } - gamCorMenuItem.Checked = Properties.Settings.Default.gammaCorrRT; saveUSBOutputToolStripMenuItem.Checked = Properties.Settings.Default.USBOutput; minimiseToTrayToolStripMenuItem.Checked = Properties.Settings.Default.MinToTray; - suppressDialogBoxesToolStripMenuItem.Checked = Properties.Settings.Default.SuppressDiagBox; - saveXLSXMenuItem.Checked = Properties.Settings.Default.saveXLSX; - saveGraphsMenuItem.Checked = Properties.Settings.Default.saveGraphs; - if (Properties.Settings.Default.advancedSettings) - { - recommendedSettingsToolStripMenuItem.Checked = false; - advancedSettingsToolStripMenuItem.Checked = true; - measurementsToolStripMenuItem.Visible = true; - overshootSettingsMenuItem.Visible = true; - extendedGammaTestToolStripMenuItem.Visible = true; - } - else - { - recommendedSettingsToolStripMenuItem.Checked = true; - advancedSettingsToolStripMenuItem.Checked = false; - measurementsToolStripMenuItem.Visible = false; - overshootSettingsMenuItem.Visible = false; - extendedGammaTestToolStripMenuItem.Visible = false; - } timeBetween = Properties.Settings.Default.timeBetween; timeBetweenLabel.Text = timeBetween.ToString(); timeBetweenSlider.Value = Convert.ToInt32(timeBetween * 2); numberOfClicks = Properties.Settings.Default.numberOfClicks; numberOfClicksLabel.Text = numberOfClicks.ToString(); numberOfClicksSlider.Value = numberOfClicks; - saveRawInputLagMenuItem.Checked = Properties.Settings.Default.saveInputLagRaw; - IgnoreErrorsMenuItem.Checked = Properties.Settings.Default.ignoreErrors; - extendedGammaTestToolStripMenuItem.Checked = Properties.Settings.Default.extendedGammaTest; } public Main() @@ -286,6 +253,7 @@ public Main() Thread.CurrentThread.CurrentCulture = customCulture; setupFormElements(); + SetDeviceStatus(0); ControlDeviceButtons(false); path = new Uri(System.IO.Path.GetDirectoryName(path)).LocalPath; path += @"\Results"; @@ -396,8 +364,6 @@ private void initialSetup() showMessageBox("Warning: Excel doesn't seem to be installed. Saving to the XLSX or XLSM templates (results or graph view templates) won't work and have been disabled.","Excel Not Installed",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); Properties.Settings.Default.saveXLSX = false; Properties.Settings.Default.saveGraphs = false; - saveGraphsMenuItem.Checked = false; - saveXLSXMenuItem.Checked = false; Properties.Settings.Default.Save(); } } @@ -424,6 +390,7 @@ private void listMonitors(int selected) { monitorCB.Items.Clear(); // Clear existing array and list before filling them displayList.Clear(); + var i = WindowsDisplayAPI.Display.GetDisplays(); foreach (var target in WindowsDisplayAPI.DisplayConfig.PathInfo.GetActivePaths()) { @@ -440,11 +407,13 @@ private void listMonitors(int selected) } int refresh = ((int)item.FrequencyInMillihertz) / 1000; string name = item.DisplayTarget.ToString(); + string manCode = ""; if (name == "") { name = target.DisplaySource.ToString().Remove(0, 4); } - var data = new Displays { Name = name, Freq = refresh, Connection = con }; + else { manCode = item.DisplayTarget.EDIDManufactureCode; } + var data = new Displays { Name = name, Freq = refresh, Connection = con, ManufacturerCode = manCode }; displayList.Add(data); monitorCB.Items.Add(name); } @@ -489,7 +458,14 @@ private void listVsyncState() vsyncStateList.Items.Clear(); vsyncStateList.Items.Add("Disabled"); vsyncStateList.Items.Add("Enabled"); - vsyncStateList.SelectedIndex = Properties.Settings.Default.VSyncState; + if (Properties.Settings.Default.VSyncState) + { + vsyncStateList.SelectedIndex = 1; + } + else + { + vsyncStateList.SelectedIndex = 0; + } } private void checkFolderPermissions() @@ -526,7 +502,7 @@ private void findAndConnectToBoard() if (!portConnected) { ControlDeviceButtons(false); - SetDeviceStatus("Board Disconnected"); + SetDeviceStatus(0); testRunning = false; testStarted = false; testMode = false; @@ -534,6 +510,10 @@ private void findAndConnectToBoard() { this.firmVerLbl.Invoke((MethodInvoker)(() => this.firmVerLbl.Text = "N/A")); } + if (this.boardSerialLbl.IsHandleCreated) + { + this.boardSerialLbl.Invoke((MethodInvoker)(() => this.boardSerialLbl.Text = "Not Connected")); + } testRunning = false; if (!Properties.Settings.Default.updateInProgress) { @@ -579,8 +559,9 @@ private void findAndConnectToBoard() { connectToBoard(p); Thread.Sleep(1000); - SetDeviceStatus("Connected to Device!"); + SetDeviceStatus(1); ControlDeviceButtons(true); + getBoardSerial(); } catch (Exception e) { @@ -608,7 +589,7 @@ private void findAndConnectToBoard() } else { - SetDeviceStatus("Updating Firmware"); + SetDeviceStatus(2); setProgressBar(true); System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; @@ -630,12 +611,12 @@ private void findAndConnectToBoard() if (output.Contains("Error")) { MessageBox.Show("Firmware update failed. Error message: " + output, "Update Device Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); - SetDeviceStatus("Update Failed"); + SetDeviceStatus(4); } else { MessageBox.Show("Device has been updated successfully!", "Updated Device", MessageBoxButtons.OK, MessageBoxIcon.Information); - SetDeviceStatus("Update Complete"); + SetDeviceStatus(3); } boardUpdate = false; } @@ -660,7 +641,7 @@ private void findAndConnectToBoard() } } - private void connectToBoard(String comPort) + private void connectToBoard(string comPort) { System.ComponentModel.IContainer components = new System.ComponentModel.Container(); @@ -686,7 +667,7 @@ private void connectToBoard(String comPort) //port.Write("X"); //Thread.Sleep(250); port.Write("I" + (this.testCount.Value - 1).ToString()); - setFPSLimit(); + //setFPSLimit(); if (displayList[0].Freq < 140) { if (Properties.Settings.Default.captureTime == 0) @@ -701,7 +682,7 @@ private void connectToBoard(String comPort) } else { - SetDeviceStatus("Board Disconnected"); + SetDeviceStatus(0); ControlDeviceButtons(false); } } @@ -718,6 +699,47 @@ private void compareFirmware() } } } + + private void getBoardSerial() + { + System.Diagnostics.Process process = new System.Diagnostics.Process(); + process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + process.StartInfo.FileName = "cmd.exe"; + process.StartInfo.Arguments = "/C .\\arduinoCLI\\arduino-cli.exe board list --format json"; + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.CreateNoWindow = true; + process.Start(); + string output = process.StandardOutput.ReadToEnd(); + process.WaitForExit(); + Console.WriteLine(output); + var outputPreSplit = output.Replace("},", "#"); + var array = outputPreSplit.Split('#'); + for (int i = 0; i < array.Length; i++) + { + if (array[i].Contains("itsybitsy")) + { + var ports = array[i].Split(','); + foreach (var p in ports) + { + if (p.Contains("serialNumber")) + { + var sn = p.Split('\"'); + foreach (var s in sn) + { + if (s.Length > 15) + { + Properties.Settings.Default.serialNumber = s; + Properties.Settings.Default.Save(); + this.boardSerialLbl.Invoke((MethodInvoker)(() => this.boardSerialLbl.Text = s)); + } + } + } + } + } + } + + } private void ControlDeviceButtons(bool state) { @@ -770,19 +792,60 @@ private void setVsyncState(int state) else { this.vsyncStateList.SelectedIndex = state; } } - private void SetDeviceStatus(string text) + private void SetDeviceStatus(int state) { - // InvokeRequired required compares the thread ID of the - // calling thread to the thread ID of the creating thread. - // If these threads are different, it returns true. + string text = " Device Not Connected"; + Color bg = Color.FromArgb(255, 255, 131, 21); + Color btnBg = Color.Gray; + bool active = false; + bool check = false; + if (state == 1) + { + text = "Device Connected"; + bg = Color.White; + check = true; + active = true; + btnBg = Color.FromArgb(255, 105, 180, 76); + } + else if (state == 2) + { + text = "Updating Firmware Now"; + bg = Color.Violet; + } + else if (state == 3) + { + text = "Update Successful"; + bg = Color.FromArgb(255, 105, 180, 76); + check = true; + } + else if (state == 4) + { + text = "Firmware Update Failed"; + bg = Color.FromArgb(255, 255, 80, 80); + } if (this.devStat.InvokeRequired) { - SetTextCallback d = new SetTextCallback(SetDeviceStatus); - this.Invoke(d, new object[] { text }); //check if this needs to be an array - this.statusTrayBtn.Text = text; - this.notifyIcon.Text = text; + this.devStat.Invoke((MethodInvoker)(() => this.devStat.Text = text)); + this.checkImg.Invoke((MethodInvoker)(() => this.checkImg.Visible = check)); + this.deviceStatusPanel.Invoke((MethodInvoker)(() => this.deviceStatusPanel.BackColor = bg)); + this.controlsPanel.Invoke((MethodInvoker)(() => this.controlsPanel.Enabled = active)); + this.inputLagPanel.Invoke((MethodInvoker)(() => this.inputLagPanel.Enabled = active)); + this.launchBtn.Invoke((MethodInvoker)(() => this.launchBtn.BackColor = btnBg)); + this.inputLagButton.Invoke((MethodInvoker)(() => this.inputLagButton.BackColor = btnBg)); + } + else + { + this.devStat.Text = text; + this.checkImg.Visible = check; + this.deviceStatusPanel.BackColor = bg; + this.controlsPanel.Enabled = active; + this.inputLagPanel.Enabled = active; + this.launchBtn.BackColor = btnBg; + this.inputLagButton.BackColor = btnBg; } - else { this.devStat.Text = text; } + this.statusTrayBtn.Text = text; + this.notifyIcon.Text = text; + } private void SetText(string text) @@ -821,6 +884,33 @@ private string getSelectedFps() else { return fpsLimitList.SelectedItem.ToString(); } } + private bool getVsyncState() + { + if (vsyncStateList.InvokeRequired) + { + if ( (string)vsyncStateList.Invoke( + new Func(() => vsyncStateList.SelectedItem.ToString()) + ) == "Enabled") + { + return true; + } + else + { + return false; + } + } + else { + if (vsyncStateList.SelectedItem.ToString() == "Enabled") + { + return true; + } + else + { + return false; + } + } + } + private int getRunCount() { if (testCount.InvokeRequired) @@ -914,7 +1004,16 @@ public void Read() { if (start < end) { - singleResults.Add(intValues); + ProcessData.rawResultData rawResult = new ProcessData.rawResultData + { + StartingRGB = intValues[0], + EndRGB = intValues[1], + TimeTaken = intValues[2], + SampleCount = intValues[3], + SampleTime = ((double)intValues[2] / (double)intValues[3]), + Samples = intValues.Skip(4).ToList() + }; + results[currentRun].Add(rawResult); } else { @@ -932,7 +1031,16 @@ public void Read() } else { - singleResults.Add(intValues); + ProcessData.rawResultData rawResult = new ProcessData.rawResultData + { + StartingRGB = intValues[0], + EndRGB = intValues[1], + TimeTaken = intValues[2], + SampleCount = intValues[3], + SampleTime = ((double)intValues[2] / (double)intValues[3]), + Samples = intValues.Skip(4).ToList() + }; + results[currentRun].Add(rawResult); } } } @@ -940,7 +1048,16 @@ public void Read() { if (start > end) { - singleResults.Add(intValues); + ProcessData.rawResultData rawResult = new ProcessData.rawResultData + { + StartingRGB = intValues[0], + EndRGB = intValues[1], + TimeTaken = intValues[2], + SampleCount = intValues[3], + SampleTime = ((double)intValues[2] / (double)intValues[3]), + Samples = intValues.Skip(4).ToList() + }; + results[currentRun].Add(rawResult); } else { @@ -958,7 +1075,16 @@ public void Read() } else { - singleResults.Add(intValues); + ProcessData.rawResultData rawResult = new ProcessData.rawResultData + { + StartingRGB = intValues[0], + EndRGB = intValues[1], + TimeTaken = intValues[2], + SampleCount = intValues[3], + SampleTime = ((double)intValues[2] / (double)intValues[3]), + Samples = intValues.Skip(4).ToList() + }; + results[currentRun].Add(rawResult); } } } @@ -1033,19 +1159,6 @@ public void Read() "\n You are free to continue the test, but you may need to verify the results manually.", "Backlight Strobing Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } - else if (message.Contains("STARTING RUN")) - { // EOL - singleResults.Clear(); - testRunning = true; - } - else if (message.Contains("STARTING TEST")) - { // EOL - testRunning = true; - makeResultsFolder(); - multipleRunData.Clear(); - results.Clear(); - singleResults.Clear(); - } else if (message.Contains("Test Started")) { testStarted = true; @@ -1055,10 +1168,6 @@ public void Read() triggerNextResult = true; //Console.WriteLine("trigger next result true"); } - else if (message.Contains("Run Complete")) - { // EOL - runComplete(); - } else if (message.Contains("G Test")) { if (message.Contains("Starting")) @@ -1068,32 +1177,10 @@ public void Read() } else if (message.Contains("Complete")) { - processGammaTable(); + //processGammaTable(); gammaTest = false; } } - else if (message.Contains("Test Complete")) - { // EOL - if (processingFailed) - { - showMessageBox("One or more set of results failed to process and won't be included in the multi-run averaging. Brightness may be too high - try calibrating the brightness and running the test again.", "Processing Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); - processingFailed = false; - } - Thread.Sleep(500); //Had an issue with data processing not being finished by the time the command comes it to start averaging the data. - processMultipleRuns(); - //port.Write("T"); - DialogResult d = MessageBox.Show("Test complete, open results folder?","Test Complete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (d == DialogResult.Yes) - { - //open folder - Process.Start("explorer.exe", resultsFolderPath); - testRunning = false; - } - else - { - testRunning = false; - } - } else if (message.Contains("FW:")) { string[] sp = message.Split(':'); @@ -1103,12 +1190,12 @@ public void Read() } else if (message.Contains("Runs:")) { - string[] sp = message.Split(':'); + /*string[] sp = message.Split(':'); int runs = Int32.Parse(sp[1]); if (runs != (this.testCount.Value - 1)) { setRepeatCounter(runs); - } + }*/ } else if (message.Contains("FPS Key:")) { @@ -1234,7 +1321,7 @@ public void Read() { setCaptureTime(); setFPSLimit(); - port.Write("V" + Properties.Settings.Default.VSyncState.ToString()); + //port.Write("V" + Properties.Settings.Default.VSyncState.ToString()); } else if (message.Contains("IL")) { @@ -1263,7 +1350,15 @@ public void Read() } else { continue; } } - inputLagRawData.Add(intValues.ToArray()); + ProcessData.rawInputLagResult rawLag = new ProcessData.rawInputLagResult + { + ClickTime = intValues[0], + TimeTaken = intValues[1], + SampleCount = intValues[2], + SampleTime = (double)intValues[1] / (double)intValues[2], + Samples = intValues.Skip(3).ToList() + }; + inputLagRawData.Add(rawLag); } else if (message.Contains("Time")) { @@ -1454,9 +1549,22 @@ private void launchBtn_Click(object sender, EventArgs e) Properties.Settings.Default.Runs = Decimal.ToInt32(testCount.Value); Properties.Settings.Default.Save(); - // block game until brightness window closes - that done already thanks to dialog result? - launchGameThread = new Thread(new ThreadStart(this.launchGameAndWaitForExit)); - launchGameThread.Start(); + if (launchGameThread == null || !launchGameThread.IsAlive) + { + launchGameThread = new Thread(new ThreadStart(this.launchGameAndWaitForExit)); + launchGameThread.Start(); + } + else + { + CFuncs cf = new CFuncs(); + DialogResult d = cf.showMessageBox("Error: Can't run test with previous test results open. Close and continue?","Close Results",MessageBoxButtons.YesNo,MessageBoxIcon.Warning); + if (d == DialogResult.Yes) + { + launchGameThread.Abort(); + launchGameThread = new Thread(new ThreadStart(this.launchGameAndWaitForExit)); + launchGameThread.Start(); + } + } } private void launchGameAndWaitForExit() @@ -1480,7 +1588,7 @@ private void launchGameAndWaitForExit() } Thread.Sleep(200); testRunning = true; - + vsyncTrigger = false; // Launch UE4 game // thinking about it you can probably just bundle this into one process instead of launching, then finding it again... string ue4Path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase; @@ -1492,7 +1600,7 @@ private void launchGameAndWaitForExit() int WinX = 0; int WinY = 0; string vsync = " VSync"; - if (Properties.Settings.Default.VSyncState == 0) + if (!Properties.Settings.Default.VSyncState) { vsync = " NoVSync"; } @@ -1533,7 +1641,16 @@ private void launchGameAndWaitForExit() try { gamma.Clear(); + processedGamma.Clear(); + results.Clear(); + multipleRunData.Clear(); + singleResults.Clear(); testLatency.Clear(); + int runCount = getRunCount(); + for (int r = 0; r < runCount; r++) + { + results.Add(new List()); + } testStarted = false; port.Write("T"); } @@ -1549,6 +1666,7 @@ private void launchGameAndWaitForExit() if (boardVersion > 1.5) { testRunning = true; + initRtOsMethods(); makeResultsFolder(); runTestThread = new Thread(new ThreadStart(this.runTest)); runTestThread.Start(); @@ -1570,11 +1688,41 @@ private void launchGameAndWaitForExit() Console.WriteLine("Game closed"); SetText("Game closed"); port.Write("X"); + ControlDeviceButtons(true); setProgressBar(false); testRunning = false; testStarted = false; testMode = false; + /*if (Properties.Settings.Default.shareResults) + { + DataUpload du = new DataUpload(); + Thread uploadThread = new Thread(() => du.ShareResults(results,processedGamma,testLatency,runSettings)); + uploadThread.Start(); + }*/ + if (results.Count != 0) + { + processThread = new Thread(new ThreadStart(runProcessing)); + processThread.Start(); + + while (processThread.IsAlive) + { + Thread.Sleep(100); + } + this.Invoke((MethodInvoker)delegate () + { + ResultsView rv = new ResultsView(); + rv.setRawData(results); + rv.setMultiRunData(multipleRunData); + rv.setAverageData(averageData); + rv.setResultsFolder(resultsFolderPath); + rv.setRtMethod(rtMethod); + rv.setOsMethod(osMethod); + rv.setRunSettings(runSettings); + rv.setStandardView(); + rv.Show(); + }); + } } catch (InvalidOperationException e) { @@ -1615,6 +1763,21 @@ private void checkFocusedWindow() } else { + if (!vsyncTrigger) + { + var item = fpsList.Find(x => x.FPSValue == getSelectedFps()); + SendKeys.SendWait(item.Key); + Thread.Sleep(100); + if (Properties.Settings.Default.VSyncState) + { + SendKeys.SendWait("{PGUP}"); + } + else + { + SendKeys.SendWait("{PGDN}"); + } + vsyncTrigger = true; + } if (paused) { //port.Write("S"); @@ -1660,9 +1823,6 @@ private void runTest() currentRun = 0; currentStart = 0; currentEnd = 0; - multipleRunData.Clear(); - results.Clear(); - singleResults.Clear(); int testPatternSize = RGBArr.Count * (RGBArr.Count - 1); for (int r = 0; r < testCount.Value; r++) { // how many runs to do @@ -1689,7 +1849,7 @@ private void runTest() sw.Start(); while (sw.ElapsedMilliseconds < 5000) { // wait for CORRECT result to come back - if ((currentStart == RGBArr[i] && currentEnd == RGBArr[k]) && triggerNextResult) + if (currentStart == RGBArr[i] && currentEnd == RGBArr[k] && triggerNextResult) { break; } @@ -1724,7 +1884,7 @@ private void runTest() sw.Start(); while (sw.ElapsedMilliseconds < 5000) { // wait for CORRECT result to come back - if ((currentStart == RGBArr[k] && currentEnd == RGBArr[i]) && triggerNextResult) + if (currentStart == RGBArr[k] && currentEnd == RGBArr[i] && triggerNextResult) { break; } @@ -1754,14 +1914,13 @@ private void runTest() } if (!testRunning) { break; } Thread.Sleep(200); - results.Add(singleResults); + //results.Add(singleResults); runComplete(); Thread.Sleep(500); currentRun++; singleResults.Clear(); } if (!testRunning) { break; } - processMultipleRuns(); port.Write("X"); Process.Start("explorer.exe", resultsFolderPath); testRunning = false; @@ -1797,319 +1956,30 @@ private void runComplete() } foreach (var res in results[currentRun]) { - csvString.AppendLine(string.Join(strSeparator, res)); - } - File.WriteAllText(filePath, csvString.ToString()); - - decimal gammaFileNumber = 001; - // search /Results folder for existing file names, pick new name - string[] existingGammaFiles = Directory.GetFiles(resultsFolderPath, "*-GAMMA-RAW-OSRTT.csv"); - //search files for number - foreach (var s in existingGammaFiles) - { - decimal num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); - if (num >= gammaFileNumber) - { - gammaFileNumber = num + 1; - } + csvString.AppendLine( + res.StartingRGB + ","+ + res.EndRGB + "," + + res.TimeTaken + "," + + res.SampleCount + "," + + string.Join(strSeparator, res.Samples) + ); } - - /* - string gammaFilePath = resultsFolderPath + "\\" + gammaFileNumber.ToString("000") + "-GAMMA-RAW-OSRTT.csv"; - - StringBuilder gammaCsvString = new StringBuilder(); - foreach (var res in gamma) + if (runSettings != null) { - gammaCsvString.AppendLine(string.Join(strSeparator, res)); + csvString.AppendLine(JsonConvert.SerializeObject(runSettings)); } - File.WriteAllText(gammaFilePath, gammaCsvString.ToString()); - */ + File.WriteAllText(filePath, csvString.ToString()); - bool failed = false; - if (Properties.Settings.Default.saveGraphs) - { - string excelFilePath = resultsFolderPath + "\\" + fileNumber.ToString("000") + "-GRAPH-RAW-OSRTT.xlsm"; - try - { - File.Copy(path + "\\Graph View Template.xlsm", excelFilePath); - } - catch (IOException ioe) - { - if (ioe.StackTrace.Contains("exists")) - { - Console.WriteLine("File exists, skipping writing."); - } - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - graphTemplate = new Excel.Application(); - try - { - graphTemplateWorkbook = graphTemplate.Workbooks.Open(excelFilePath); - } - catch - { - DialogResult d = showMessageBox("Error writing data to XLSX results file, file may be open already. Would you like to try again?", "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - if (d == DialogResult.Yes) - { - try - { - graphTemplateWorkbook = graphTemplate.Workbooks.Open(excelFilePath); - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - failed = true; - } - } - else - { - failed = true; - } - } - if (!failed) - { - Excel._Worksheet graphTempSheet = graphTemplateWorkbook.Sheets[1]; - try - { - //Console.WriteLine("AverageData Count: " + averageData.Count); - for (int p = 0; p < results[currentRun].Count; p++) - { - for (int m = 0; m < results[currentRun][0].Length; m++) - { - //Console.WriteLine("M: " + m + " P: " + p); - graphTempSheet.Cells[p + 2, m + 1] = results[currentRun][p][m]; - } - } - graphTemplateWorkbook.Save(); - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - failed = true; - } - GC.Collect(); - GC.WaitForPendingFinalizers(); - Marshal.ReleaseComObject(graphTempSheet); - - } - graphTemplateWorkbook.Close(); - Marshal.ReleaseComObject(graphTemplateWorkbook); - graphTemplate.Quit(); - Marshal.ReleaseComObject(graphTemplate); - if (failed) - { - File.Delete(excelFilePath); - } - } // Process that raw data //processThread = new Thread(new ThreadStart(this.processResponseTimeData)); //processThread.Start(); - processResponseTimeData(); + //processResponseTimeData(); } private void refreshMonitorListBtn_Click(object sender, EventArgs e) { listMonitors(0); } - - private void resultsBtn_Click(object sender, EventArgs e) - { - // Open file picker dialogue - var filePath = string.Empty; - - using (System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog()) - { - openFileDialog.InitialDirectory = path; - openFileDialog.Filter = "csv files (*.csv)|*.csv"; - openFileDialog.FilterIndex = 2; - openFileDialog.RestoreDirectory = true; - - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - //Get the path of specified file - filePath = openFileDialog.FileName; - results.Clear(); - gamma.Clear(); - if (filePath.Contains("GAMMA-RAW")) - { - //Read the contents of the file into a stream - try - { - var fileStream = openFileDialog.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - gamma.Add(intLine); - } - } - resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); - // Save Gamma curve to a file too - decimal gammaFileNumber = 001; - // search /Results folder for existing file names, pick new name - string[] existingGammaFiles = Directory.GetFiles(resultsFolderPath, "*-GAMMA-OSRTT.csv"); - // Search \Results folder for existing results to not overwrite existing or have save conflict errors - foreach (var s in existingGammaFiles) - { - decimal num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); - if (num >= gammaFileNumber) - { - gammaFileNumber = num + 1; - } - } - - string gammaFilePath = resultsFolderPath + "\\" + gammaFileNumber.ToString("000") + "-GAMMA-OSRTT.csv"; - StringBuilder gammaCsvString = new StringBuilder(); - gammaCsvString.AppendLine("RGB, Light Reading"); - string strSeparator = ","; - List fullGammaTable = processGammaTable(); - foreach (var res in fullGammaTable) - { - gammaCsvString.AppendLine(string.Join(strSeparator, res)); - } - File.WriteAllText(gammaFilePath, gammaCsvString.ToString()); - Process.Start("explorer.exe", resultsFolderPath); - - } - catch - { - DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else if (filePath.Contains("RAW-OSRTT")) - { - //Read the contents of the file into a stream - try - { - List tempRes = new List(); - List tempGamma = new List(); - var fileStream = openFileDialog.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - if (intLine[0] == 1000) - { - testLatency.AddRange(intLine); - } - else if (intLine[0] == intLine[1]) - { - tempGamma.Add(intLine); - } - else - { - tempRes.Add(intLine); - } - } - } - results.AddRange(new List> { tempRes }); - gamma.AddRange(tempGamma); - resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); - //processGammaTable(); - //processThread = new Thread(new ThreadStart(this.processResponseTimeData)); - //processThread.Start(); - processResponseTimeData(); - Process.Start("explorer.exe", resultsFolderPath); - - } - catch - { - DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else if (filePath.Contains("LAG-RAW")) - { - //Read the contents of the file into a stream - try - { - var fileStream = openFileDialog.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - inputLagRawData.Add(intLine); - } - } - resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); - - processInputLagData(); - - Process.Start("explorer.exe", resultsFolderPath); - - } - catch - { - DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else - { - MessageBox.Show("Sorry, only 'RAW' files can be imported. Please select either a 'RAW-OSRTT.csv' file, or 'INPUT-LAG-RAW.csv' file instead.", "Importer Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - } - private void updateDeviceToolStripMenuItem_Click(object sender, EventArgs e) { compareFirmware(); @@ -2133,1533 +2003,21 @@ private void debugModeToolStripMenuItem_Click(object sender, EventArgs e) debugMode = debugModeToolStripMenuItem.Checked; } - PointF[] InterpolatePoints(PointF[] original, int numberRequired) + private void setRepeats() + { + decimal runs = getRunCount() - 1; + port.Write("M" + runs.ToString()); + } + + public static double GetMedian(double[] sourceNumbers) { - // The new array, ready to return. - PointF[] interpolated = new PointF[numberRequired]; + //Framework 2.0 version of this method. there is an easier way in F4 + if (sourceNumbers == null || sourceNumbers.Length == 0) + throw new System.Exception("Median of empty array not defined."); - // The number of interpolated points in between each pair of existing points. - int between = ((numberRequired - original.Length) / (original.Length - 1)) + 1; - - // Loop through the original list. - int index = 0; - for (int i = 0; i < original.Length - 1; i++) - { - // Add each original point to the interpolated points. - interpolated[index++] = original[i]; - - // The step distances in x and y directions between this original point and the next one. - float stepX = (original[i + 1].X - original[i].X) / ((float)between + 1); - float stepY = (original[i + 1].Y - original[i].Y) / ((float)between + 1); - - // Add the interpolated points at the given steps. - for (int j = 0; j < between; j++) - { - float x = original[i].X + stepX * (float)(j + 1); - float y = original[i].Y + stepY * (float)(j + 1); - - if (index < numberRequired) - { - interpolated[index++] = new PointF(x, y); - } - else - { - break; - } - } - } - return interpolated; - } - - private List processGammaTable() - { - if (gamma.Count == 0) - { - if (!Properties.Settings.Default.SuppressDiagBox) - { - MessageBox.Show("No Gamma data is stored in the program.", "Gamma Table Processing Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - return null; - } - else - { - noiseLevel.Clear(); - double[] rgbVals = new double[gamma.Count]; - double[] lightLevelVals = new double[gamma.Count]; - for (int i = 0; i < gamma.Count; i++) - { - int[] dataLine = gamma[i].Skip(300).ToArray(); - int lineAverage = 0; - for (int j = 0; j < (dataLine.Length - 100); j++) - { - lineAverage += dataLine[j]; - } - noiseLevel.Add(new int[] { gamma[i][0], (dataLine.Max() - dataLine.Min()) }); - lineAverage /= (dataLine.Length - 100); - rgbVals[i] = gamma[i][0]; - lightLevelVals[i] = lineAverage; - } - /*int gSize = tempGamma.Count; - PointF[] points = new PointF[gSize]; - for (int i = 0; i < gSize; i++) - { - points[i] = new PointF { X = tempGamma[i][0], Y = tempGamma[i][1] }; - }; - int numberOfPoints = 256; - PointF[] partGamma = InterpolatePoints(points, numberOfPoints);*/ - int pointsBetween = 51; - if (gamma.Count == 16) - { - pointsBetween = 17; - } - var interpPoints = new ScottPlot.Statistics.Interpolation.NaturalSpline(rgbVals, lightLevelVals, pointsBetween); - List x = new List(); - List y = new List(); - foreach (var p in interpPoints.interpolatedXs) - { - x.Add(Convert.ToInt32(p)); - } - foreach (var p in interpPoints.interpolatedYs) - { - y.Add(Convert.ToInt32(p)); - } - List xy = new List(); - for (int k = 0; k < x.Count; k++) - { - xy.Add(new int[] { x[k], y[k] }); - } - return xy; - } - } - - private void processResponseTimeData() - { - //This is a long one. This is the code that builds the gamma curve, finds the start/end points and calculates response times and overshoot % (gamma corrected) - List processedData = new List(); - - // First, create gamma array from the data - List localGamma = new List(); - List fullGammaTable = new List(); - List smoothedDataTable = new List(); - int noise = 0; - - try //Wrapped whole thing in try just in case - { - if (results[currentRun].Count == 30 || results[currentRun].Count == 110) - { - // CHECK IF GAMMA TABLE IS ALREADY PROCESSED AND IF SO DON'T BOTHER PROCESSING AGAIN + DON'T SAVE MORE THAN ONE GAMMA CSV IF USING A GAMMA-RAW-OSRTT.CSV FILE AS SOURCE (or from test) - if (gamma.Count == 6 || gamma.Count == 16) - { // if using the new test pattern (Constant step of 51) - fullGammaTable.AddRange(processGammaTable()); - } - else - { // if using old test pattern (Steps of 25 or 26) - noiseLevel.Clear(); - int steps = 0; - if (results[currentRun].Count == 30) - { - steps = 9; - } - else - { - steps = 20; - } - for (int i = 0; i < steps; i += 2) - { - int[] resLine = this.results[currentRun][i].Take(250).ToArray(); - int avg = 0; - if (resLine[0] == 0 && localGamma.Count == 0) - { - for (int j = 5; j < 250; j++) - { - avg += resLine[j]; - } - avg = avg / 245; - localGamma.Add(new int[] { resLine[0], avg }); - noiseLevel.Add(new int[] { resLine[1], (resLine.Max() - resLine.Min()) }); - for (int j = resLine.Length - 455; j < resLine.Length - 5; j++) - { - avg += resLine[j]; - } - avg = avg / 450; - localGamma.Add(new int[] { resLine[1], avg }); - } - else - { - for (int j = resLine.Length - 455; j < resLine.Length - 5; j++) - { - avg += resLine[j]; - } - avg = avg / 450; - noiseLevel.Add(new int[] { resLine[1], (resLine.Max() - resLine.Min()) }); - localGamma.Add(new int[] { resLine[1], avg }); - } - } - try - { - // Extrapolate rough values for every RGB value - for (int i = 0; i < localGamma.Count - 1; i++) - { - PointF[] points = new PointF[] - { - new PointF { X = localGamma[i][0], Y = localGamma[i][1]}, - new PointF { X = localGamma[i+1][0], Y = localGamma[i+1][1]} - }; - int numberOfPoints = localGamma[i + 1][0] - localGamma[i][0]; - - PointF[] partGamma = InterpolatePoints(points, numberOfPoints); - foreach (var p in partGamma) - { - int[] tempGamma = { - Convert.ToInt32(p.X), Convert.ToInt32(p.Y) - }; - fullGammaTable.Add(tempGamma); - } - } - if (results[currentRun].Count == 30) - { - fullGammaTable.Add(localGamma[5]); - } - else - { - fullGammaTable.Add(localGamma[10]); - } - } - catch (Exception ex) - { - if (ex.Message.Contains("Arithmetic")) - { - showMessageBox("Error: Results data may be incomplete or out of order. Please check the file or results and reimport.", "Unable to Process", MessageBoxButtons.OK, MessageBoxIcon.Error); - SetText(ex.Message + ex.StackTrace); - } - else - { - SetText(ex.Message + ex.StackTrace); - } - } - } - - int startDelay = 150; - if (testLatency.Count != 0) - { - int[] tl = testLatency.Skip(5).ToArray(); - for (int n = 0; n < tl.Length; n++) - { - if (tl[n] > 8000) - { - if (n <= 150 && n > 30) - { - startDelay = n - 30; - } - else if (n < 30) - { - n /= 2; - startDelay = n; - } - else if (n > 400) - { - startDelay = 250; - } - break; - } - } - } - - // Then process the lines - foreach (int[] item in this.results[currentRun]) - { - // Save start, end, time and sample count then clear the values from the array - int StartingRGB = item[0]; - int EndRGB = item[1]; - int TimeTaken = item[2]; - int SampleCount = item[3]; - int[] samples = item.Skip(4).ToArray(); - - double SampleTime = ((double)TimeTaken / (double)SampleCount); // Get the time taken between samples - - // Clean up noisy data using moving average function - int period = 10; - foreach (var n in noiseLevel) - { - if (n[0] == StartingRGB || n[0] == EndRGB) - { - noise = n[1]; - break; - } - } - if (noise < 250) - { - period = 20; - } - else if (noise < 500) - { - period = 30; - } - else if (noise < 750) - { - period = 40; - } - else - { - period = 50; - } - int[] buffer = new int[period]; - int[] averagedSamples = new int[samples.Length]; - int current_index = 0; - for (int a = 0; a < samples.Length; a++) - { - buffer[current_index] = samples[a] / period; - int movAvg = 0; - for (int b = 0; b < period; b++) - { - movAvg += buffer[b]; - } - averagedSamples[a] = movAvg; - current_index = (current_index + 1) % period; - } - - samples = averagedSamples.Skip(period).ToArray(); //Moving average spoils the first 10 samples so currently removing them. - - List fullSmoothedLine = new List { StartingRGB, EndRGB, TimeTaken, SampleCount }; - fullSmoothedLine.AddRange(samples); - smoothedDataTable.Add(fullSmoothedLine.ToArray()); - - int maxValue = samples.Max(); // Find the maximum value for overshoot - int minValue = samples.Min(); // Find the minimum value for undershoot - // Initialise in-use variables - int transStart = 0; - int transEnd = 0; - int initialTransStart = 0; - int initialTransEnd = 0; - int perceivedTransStart = 0; - int perceivedTransEnd = 0; - - double overUnderRGB = 0.0; - - int startMax = samples[5]; // Initialise these variables with a real value - int startMin = samples[5]; // Initialise these variables with a real value - int endMax = samples[samples.Length - 10]; // Initialise these variables with a real value - int endMin = samples[samples.Length - 10]; // Initialise these variables with a real value - - // Build start min/max to compare against - for (int l = 0; l < startDelay; l++) //CHANGE TO 180 FOR RUN 2 DATA - { - if (samples[l] < startMin) - { - startMin = samples[l]; - } - else if (samples[l] > startMax) - { - startMax = samples[l]; - } - } - - // Build end min/max to compare against - for (int m = samples.Length - 5; m > samples.Length - 150; m--) - { - if (samples[m] < endMin) - { - endMin = samples[m]; - } - else if (samples[m] > endMax) - { - endMax = samples[m]; - } - } - - // Search for where the result starts transitioning - start is almost always less sensitive - for (int j = 0; j < samples.Length; j++) - { - if (StartingRGB < EndRGB) - { - if (samples[j] > (startMax)) - { - if (StartingRGB == 0 && EndRGB == 26) - { - if ((samples[j + 50] > (samples[j] + 25) || samples[j + 56] > (samples[j] + 25)) - && (samples[j + 100] > (samples[j] + 50) || samples[j + 106] > (samples[j] + 50)) - && (samples[j + 125] > (samples[j] + 75) || samples[j + 131] > (samples[j] + 75)) - && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] > startMax) - { - startMax = samples[j]; - } - } - } - else - { - if ((samples[j + 50] > (samples[j] + 50) || samples[j + 56] > (samples[j] + 50)) - && (samples[j + 100] > (samples[j] + 100) || samples[j + 106] > (samples[j] + 100)) - && (samples[j + 125] > (samples[j] + 100) || samples[j + 131] > (samples[j] + 100)) - && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] > startMax) - { - startMax = samples[j]; - } - } - } - } - } - else - { - if (samples[j] < (startMin)) - { - if (StartingRGB == 26 && EndRGB == 0) - { - if ((samples[j + 50] < (samples[j] - 25) || samples[j + 56] < (samples[j] - 25)) - && (samples[j + 100] < (samples[j] - 50) || samples[j + 106] < (samples[j] - 50)) - && (samples[j + 125] < (samples[j] - 75) || samples[j + 131] < (samples[j] - 75)) - && (samples[j + 150] < (samples[j] - 100) || samples[j + 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] < startMin) - { - startMin = samples[j]; - } - } - } - else - { - if ((samples[j + 50] < (samples[j] - 50) || samples[j + 56] < (samples[j] - 50)) - && (samples[j + 100] < (samples[j] - 100) || samples[j + 106] < (samples[j] - 100)) - && (samples[j + 125] < (samples[j] - 100) || samples[j + 131] < (samples[j] - 100)) - && (samples[j + 150] < (samples[j] - 100) || samples[j + 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] < startMin) - { - startMin = samples[j]; - } - } - } - } - } - } - - // Search for where the result stops transitioning (from the end) - end position is almost always more sensitive hence lower values - also must account for over/undershoot - for (int j = samples.Length - 1; j > 0; j--) - { - if (StartingRGB < EndRGB) - { - if (maxValue > (endMax + 100)) //Check for overshoot - { - if (samples[j] > endMax) - { - if (samples[j - 100] > (samples[j] + 50) && samples[j - 125] > (samples[j] + 50)) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] > endMax) - { - endMax = samples[j]; - } - } - } - } - else - { - if (samples[j] <= (endMin + 20)) //Check for regular finish point - { - if (StartingRGB == 0 && EndRGB == 26) - { - if ((samples[j - 100] < (samples[j] - 25) || samples[j - 106] < (samples[j] - 25)) - && (samples[j - 125] < (samples[j] - 50) || samples[j - 131] < (samples[j] - 50)) - && (samples[j - 150] < (samples[j] - 75) || samples[j - 156] < (samples[j] - 75))) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] < endMin) - { - endMin = samples[j]; - } - } - } - else - { - if ((samples[j - 100] < (samples[j] - 50) || samples[j - 106] < (samples[j] - 50)) - && (samples[j - 125] < (samples[j] - 75) || samples[j - 131] < (samples[j] - 75)) - && (samples[j - 150] < (samples[j] - 100) || samples[j - 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] < endMin) - { - endMin = samples[j]; - } - } - } - } - } - } - else - { - if (minValue < (endMin - 100)) //Check for undershoot - { - if (samples[j] < endMin) //Check for under-shot finish point - { - if (samples[j - 100] < (samples[j] - 50) && samples[j - 125] < (samples[j] - 50)) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] < endMin) - { - endMin = samples[j]; - } - } - } - } - else - { - if (samples[j] > endMax) //Check for regular finish point - { - if (StartingRGB == 26 && EndRGB == 0) - { - if ((samples[j - 100] > (samples[j] + 25) || samples[j - 106] > (samples[j] + 25)) - && (samples[j - 125] > (samples[j] + 50) || samples[j - 131] > (samples[j] + 50)) - && (samples[j - 150] > (samples[j] + 75) || samples[j - 156] > (samples[j] + 75))) - { - transEnd = j; - break; - } - else - { - if (samples[j] > endMax) - { - endMax = samples[j]; - } - } - } - else - { - if ((samples[j - 100] > (samples[j] + 50) || samples[j - 106] > (samples[j] + 50)) - && (samples[j - 125] > (samples[j] + 75) || samples[j - 131] > (samples[j] + 75)) - && (samples[j - 150] > (samples[j] + 100) || samples[j - 156] > (samples[j] + 100))) - { - transEnd = j; - break; - } - else - { - if (samples[j] > endMax) - { - endMax = samples[j]; - } - } - } - } - } - } - } - double startAverage = 0; - double endAverage = 0; - int avgStart = transStart - 200; - int avgEnd = transEnd + 400; - if (transStart < 200) - { - int t = transStart / 5; - avgStart = transStart - t; - } - if ((samples.Length - transEnd) < 400) - { - int t = (samples.Length - transEnd) / 5; - avgEnd = transEnd + t; - } - for (int q = 0; q < avgStart; q++) - { - startAverage += samples[q]; - } - startAverage /= avgStart; - startAverage = Math.Round(startAverage, 0); - for (int q = avgEnd; q < samples.Length; q++) - { - endAverage += samples[q]; - } - endAverage /= (samples.Length - avgEnd); - endAverage = Math.Round(endAverage, 0); - int arrSize = (transEnd - transStart + 100); - if (samples.Length < (transEnd + 100)) - { - arrSize = samples.Length - transStart; - } - if (arrSize < 110) - { - arrSize = 200; - } - int[] transitionSamples = new int[arrSize]; - // Getting min/max from INSIDE the transition window - if ((transEnd - transStart) != 0) - { - Array.Copy(samples, transStart, transitionSamples, 0, arrSize); - maxValue = transitionSamples.Max(); - minValue = transitionSamples.Min(); - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Overshoot calculations - double overshootPercent = 0; - double overshootRGBDiff = 0; - double peakValue = 0; - if (StartingRGB < EndRGB) - { - peakValue = maxValue; - // Dark to light transition - if (maxValue > (endAverage + 100) && maxValue > (fullGammaTable[EndRGB][1] + 100)) - { - // undershoot may have occurred - Console.WriteLine("Overshoot found"); - // convert maxValue to RGB using gamma table - for (int i = 0; i < fullGammaTable.Count; i++) - { - // Find what RGB value matches or exceeds the peak light reading for this run - if (maxValue <= fullGammaTable[i][1]) - { - // Check if peak light reading is closer to upper or lower bound value - int diff1 = fullGammaTable[i][1] - maxValue; - int diff2 = maxValue - fullGammaTable[i - 1][1]; - if (diff1 < diff2) - { - overUnderRGB = fullGammaTable[i][0]; - } - else - { - overUnderRGB = fullGammaTable[i - 1][0]; - } - break; - } - else if (maxValue > fullGammaTable.Last()[1]) - { - if (maxValue > 65500) - { - overUnderRGB = 260; - break; - } - else - { - overUnderRGB = 256; - break; - } - } - } - if (overUnderRGB == -1) - { - //overshootPercent = 100; - } - else - { - overshootRGBDiff = overUnderRGB - EndRGB; - double os = 0; - if (endValueToolStripMenuItem.Checked) - { - os = (overUnderRGB - EndRGB) / EndRGB; - } - else - { - double range = EndRGB - StartingRGB; - os = overshootRGBDiff / range; - } - os *= 100; - overshootPercent = Math.Round(os, 1); - } - } - } - else - { - peakValue = minValue; - // Light to dark transistion - if (minValue < (endAverage - 100) && minValue < (fullGammaTable[EndRGB][1] - 100)) - { - // overshoot may have occurred - // convert minValue to RGB using gamma table - Console.WriteLine("Undershoot found"); - for (int i = 0; i < fullGammaTable.Count; i++) - { - // Find what RGB value matches or exceeds the peak light reading for this run - if (minValue <= fullGammaTable[i][1]) - { - if (i == 0) - { - overUnderRGB = 0; - break; - } - else - { - // Check if peak light reading is closer to upper or lower bound value - int diff1 = fullGammaTable[i][1] - minValue; - int diff2 = minValue - fullGammaTable[i - 1][1]; - if (diff1 < diff2) - { - overUnderRGB = fullGammaTable[i][0]; - } - else - { - overUnderRGB = fullGammaTable[i - 1][0]; - } - break; - } - } - } - overshootRGBDiff = EndRGB - overUnderRGB; - double os = 0; - if (endValueToolStripMenuItem.Checked) - { - os = (EndRGB - overUnderRGB) / EndRGB; - } - else - { - double range = StartingRGB - EndRGB; - os = overshootRGBDiff / range; - } - // os *= -1; - os *= 100; - overshootPercent = Math.Round(os, 1); - if (overshootPercent != 0 && overshootPercent < 1) - { - overshootPercent = 0; - } - } - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // INITIAL AND PERCEIVED RESPONSE TIME MEASUREMENTS - if (StartingRGB < EndRGB) - { - // Setup variables for start/end trigger points - double start3 = 0; - double endOffsetRGB = 0; - double end3 = 0; - double endPer3 = 0; - double RGBTolerance = 5; - if ((Properties.Settings.Default.threePercentSetting || Properties.Settings.Default.tenPercentSetting) && !Properties.Settings.Default.gammaCorrRT) - { - double tol = 0; - if (Properties.Settings.Default.threePercentSetting) - { tol = 0.03; } - else - { tol = 0.1; } - double range3 = (endAverage - startAverage) * tol; // Subtract low value from high value to get light level range - start3 = startAverage + range3; // Start trigger value - end3 = endAverage - range3; - if (peakValue > (endAverage + range3)) - { endPer3 = endAverage + range3; } // End trigger value - else - { endPer3 = endAverage - range3; } // End trigger value - } - else - { - if (Properties.Settings.Default.RGB5Offset) - { RGBTolerance = 5; } - else if (Properties.Settings.Default.RGB10Offset) - { RGBTolerance = 10; } - else if (Properties.Settings.Default.threePercentSetting) - { - RGBTolerance = (EndRGB - StartingRGB) * 0.03; - RGBTolerance = Math.Round(RGBTolerance, 0); - } - else if (Properties.Settings.Default.tenPercentSetting) - { - RGBTolerance = (EndRGB - StartingRGB) * 0.1; - RGBTolerance = Math.Round(RGBTolerance, 0); - } - endOffsetRGB = EndRGB - RGBTolerance; - start3 = fullGammaTable[Convert.ToInt32(StartingRGB + RGBTolerance)][1]; - end3 = fullGammaTable[Convert.ToInt32(EndRGB - RGBTolerance)][1]; - if (overUnderRGB > (EndRGB + RGBTolerance) && overUnderRGB != 0) - { endOffsetRGB = EndRGB + RGBTolerance; } - else if (overUnderRGB == -1) - { endOffsetRGB = EndRGB; } - endPer3 = fullGammaTable[Convert.ToInt32(endOffsetRGB)][1]; - if (overUnderRGB == -1) - { endPer3 *= 1.02; } - - } - if (endPer3 >= 65520) - { endPer3 = 65500; } - - // Actually find the start/end points - for (int j = (transStart - 20); j < (transEnd + 20); j++) // search samples for start & end trigger points - { - if (samples[j] >= start3 && initialTransStart == 0) // save the FIRST time value exceeds start trigger - { - if ((samples[j + 50] > (start3 + 25) || samples[j + 60] > (start3 + 25)) - && (samples[j + 100] > (start3 + 50) || samples[j + 110] > (start3 + 50)) - && (samples[j + 150] > (start3 + 75) || samples[j + 160] > (start3 + 75))) - { - initialTransStart = j; - perceivedTransStart = j; - } - else if (j == transEnd) - { - initialTransStart = transStart; - perceivedTransStart = transStart; - } - } - else if (samples[j] >= end3) // Save when value exceeds end trigger then break. - { - if ((samples[j + 20] > (end3 + 25) || samples[j + 25] > (end3 + 25)) - && (samples[j + 30] > (end3 + 50) || samples[j + 35] > (end3 + 50)) - && (samples[j + 50] > (end3 + 75) || samples[j + 55] > (end3 + 75))) - { - initialTransEnd = j; - break; - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - for (int j = (transEnd + 20); j > (transStart - 20); j--) // search samples for end point - { - if (endOffsetRGB > EndRGB || overUnderRGB == -1 || (endOffsetRGB == 0 && endPer3 > endAverage && overshootPercent > 1)) // Including overshoot in the curve - { - if (samples[j] >= endPer3) // add the same sort of more detailed check like complete for finding this - { - if ((samples[j - 25] > (endPer3 + 25) || samples[j - 30] > (endPer3 + 25)) - && (samples[j - 35] > (endPer3 + 50) || samples[j - 40] > (endPer3 + 50))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - else // No overshoot found within RGB tolerance - { - if (samples[j] <= endPer3) - { - if ((samples[j - 50] < (endPer3 - 25) || samples[j - 60] < (endPer3 - 25)) - && (samples[j - 100] < (endPer3 - 50) || samples[j - 110] < (endPer3 - 50)) - && (samples[j - 150] < (endPer3 - 75) || samples[j - 160] < (endPer3 - 75))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - } - if (perceivedTransEnd < initialTransEnd) - { // just in case the two methods differ slightly and perceived would come out as shorter. - perceivedTransEnd = initialTransEnd; - } - } - else - { - // Setup variables for start/end trigger points - double start3 = 0; - double endOffsetRGB = 0; - double end3 = 0; - double endPer3 = 0; - double RGBTolerance = 5; - if ((Properties.Settings.Default.threePercentSetting || Properties.Settings.Default.tenPercentSetting) && !Properties.Settings.Default.gammaCorrRT) - { - double tol = 0; - if (Properties.Settings.Default.threePercentSetting) - { tol = 0.03; } - else - { tol = 0.1; } - double range3 = (startAverage - endAverage) * tol; // Subtract low value from high value to get light level range - start3 = startAverage - range3; // Start trigger value - end3 = endAverage + range3; - if (peakValue < (endAverage - range3)) - { endPer3 = endAverage - range3; } // End trigger value - else - { endPer3 = endAverage + range3; } // End trigger value - } - else - { - if (Properties.Settings.Default.RGB5Offset) - { RGBTolerance = 5; } - else if (Properties.Settings.Default.RGB10Offset) - { RGBTolerance = 10; } - else if (Properties.Settings.Default.threePercentSetting) - { - RGBTolerance = (StartingRGB - EndRGB) * 0.03; - RGBTolerance = Math.Round(RGBTolerance, 0); - } - else if (Properties.Settings.Default.tenPercentSetting) - { - RGBTolerance = (StartingRGB - EndRGB) * 0.1; - RGBTolerance = Math.Round(RGBTolerance, 0); - } - endOffsetRGB = EndRGB + RGBTolerance; - start3 = fullGammaTable[Convert.ToInt32(StartingRGB - RGBTolerance)][1]; - end3 = fullGammaTable[Convert.ToInt32(EndRGB + RGBTolerance)][1]; - if (overUnderRGB < (EndRGB - RGBTolerance) && overUnderRGB != 0) - { - endOffsetRGB = EndRGB - RGBTolerance; - } - endPer3 = fullGammaTable[Convert.ToInt32(endOffsetRGB)][1]; - } - - for (int j = (transStart - 20); j < (transEnd + 20); j++) // search samples for start point - { - if (samples[j] <= start3 && initialTransStart == 0) // save the FIRST time value exceeds start trigger - { - if ((samples[j + 50] < (start3 - 25) || samples[j + 60] < (start3 - 25)) - && (samples[j + 100] < (start3 - 50) || samples[j + 110] < (start3 - 50)) - && (samples[j + 150] < (start3 - 75) || samples[j + 160] < (start3 - 75))) - { - initialTransStart = j; - perceivedTransStart = j; - } - else if (j == transEnd) - { - initialTransStart = transStart; - perceivedTransStart = transStart; - } - } - else if (samples[j] <= end3) // Save when value exceeds end trigger then break. - { - if ((samples[j + 50] < (end3 - 25) || samples[j + 60] < (end3 - 25)) - && (samples[j + 100] < (end3 - 50) || samples[j + 110] < (end3 - 50)) - && (samples[j + 150] < (end3 - 75) || samples[j + 160] < (end3 - 75))) - { - initialTransEnd = j; - break; - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - for (int j = (transEnd + 20); j > (transStart - 20); j--) // search samples for end point - { - if ((endOffsetRGB < EndRGB && endOffsetRGB != 0) || (endPer3 < endAverage && endOffsetRGB == 0 && overshootPercent > 1)) // Including undershoot in the curve - { - if (samples[j] <= endPer3) - { - if ((samples[j - 20] < (endPer3 - 25) || samples[j - 25] < (endPer3 - 25)) - && (samples[j - 30] < (endPer3 - 50) || samples[j - 35] < (endPer3 - 50))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - else // No overshoot found within RGB tolerance - { - if (samples[j] >= endPer3) - { - - if ((samples[j - 50] > (endPer3 + 25) || samples[j - 60] > (endPer3 + 25)) - && (samples[j - 100] > (endPer3 + 50) || samples[j - 110] > (endPer3 + 50)) - && (samples[j - 150] > (endPer3 + 75) || samples[j - 160] > (endPer3 + 75))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - } - if (perceivedTransEnd < initialTransEnd) - { // just in case the two methods differ slightly and perceived would come out as shorter. - perceivedTransEnd = initialTransEnd; - } - } - - double transCount = transEnd - transStart; - double transTime = (transCount * SampleTime) / 1000; - - double initialTransCount = initialTransEnd - initialTransStart; - double initialTransTime = (initialTransCount * SampleTime) / 1000; - - double perceivedTransCount = perceivedTransEnd - perceivedTransStart; - double perceivedTransTime = (perceivedTransCount * SampleTime) / 1000; - - double inputLagTime = (transStart * SampleTime) / 1000; - - double responseTime = Math.Round(transTime, 1); - double initialResponseTime = Math.Round(initialTransTime, 1); - double perceivedResponseTime = Math.Round(perceivedTransTime, 1); - - double visualResponseRating = 100 - (initialResponseTime + perceivedResponseTime); - - double inputLag = Math.Round(inputLagTime, 1); - - if (verboseOutputToolStripMenuItem.Checked) - { - // Verbose output with ALLLL the data - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootPercent, visualResponseRating, inputLag, transStart, transEnd, SampleTime, endAverage, peakValue, overUnderRGB }; - processedData.Add(completeResult); - } - else if (!percentageToolStripMenuItem.Checked && gammaCorrectedToolStripMenuItem.Checked) - { - // Standard output with total transition time & gamma corrected overshoot value - if (overUnderRGB == -1) - { - overshootRGBDiff = 100; - } - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootRGBDiff, visualResponseRating, inputLag }; - processedData.Add(completeResult); - } - else if (!gammaCorrectedToolStripMenuItem.Checked && percentageToolStripMenuItem.Checked) - { - // Standard output with total transition time & overshoot light level percentage - double os = 0; - if (endValueToolStripMenuItem.Checked) - { - if (StartingRGB < EndRGB) - { - if (peakValue > (endAverage + 100)) - { - os = (peakValue - endAverage) / endAverage; - os *= 100; - os = Math.Round(os, 1); - } - } - else - { - if (peakValue < (endAverage - 100)) - { - os = (endAverage - peakValue) / endAverage; - // os *= -1; - os *= 100; - os = Math.Round(os, 1); - } - } - } - else - { - if (StartingRGB < EndRGB) - { - if (peakValue > (endAverage + 100)) - { - double range = endAverage - startAverage; - double peakRange = peakValue - endAverage; - os = peakRange / range; - os *= 100; - os = Math.Round(os, 1); - } - } - else - { - if (peakValue < (endAverage - 100)) - { - double range = startAverage - endAverage; - double peakRange = endAverage - peakValue; - os = peakRange / range; - // os *= -1; - os *= 100; - os = Math.Round(os, 1); - } - } - } - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, os, visualResponseRating, inputLag }; - processedData.Add(completeResult); - } - else - { - // Standard output with total transition time & gamma corrected overshoot percentage - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootPercent, visualResponseRating, inputLag }; - processedData.Add(completeResult); - } - - } - List temp = new List(); //probably not needed now processedData is a local variable - temp.AddRange(processedData); - multipleRunData.Add(temp); - - // Write results to csv using new name - decimal fileNumber = 001; - // search /Results folder for existing file names, pick new name - string[] existingFiles = Directory.GetFiles(resultsFolderPath, "*-FULL-OSRTT.csv"); - // Search \Results folder for existing results to not overwrite existing or have save conflict errors - foreach (var s in existingFiles) - { - decimal num = 0; - try - { num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); } - catch - { Console.WriteLine("Non-standard file name found"); } - if (num >= fileNumber) - { - fileNumber = num + 1; - } - } - - string filePath = resultsFolderPath + "\\" + fileNumber.ToString("000") + "-FULL-OSRTT.csv"; - - string strSeparator = ","; - StringBuilder csvString = new StringBuilder(); - string rtType = "Initial Response Time - 3% (ms)"; - string osType = "Overshoot"; - string osSign = "(%)"; - string perType = "Perceived Response Time - 3% (ms)"; - if (tenPercentMenuItem.Checked) - { - rtType = "Initial Response Time - 10% (ms)"; - perType = "Perceived Response Time - 10% (ms)"; - } - else if (fixedRGB10OffsetToolStripMenuItem.Checked) - { - rtType = "Initial Response Time - RGB10 (ms)"; - perType = "Perceived Response Time - RGB10 (ms)"; - } - else if (fixedRGB5OffsetToolStripMenuItem.Checked) - { - rtType = "Initial Response Time - RGB5 (ms)"; - perType = "Perceived Response Time - RGB5 (ms)"; - } - if (gammaCorrectedToolStripMenuItem.Checked) - { - osSign = "(RGB)"; - } - if (gammaCorrectedToolStripMenuItem.Checked && percentageToolStripMenuItem.Checked) - { - osSign = "(RGB %)"; - } - if (verboseOutputToolStripMenuItem.Checked) - { - csvString.AppendLine("Starting RGB,End RGB,Complete Response Time (ms)," + rtType + "," + perType + "," + osType + " " + osSign + ",Visual Response Rating,Input Lag (ms),Transition Start Position,Transition End Position,Sampling Time (ms),End Light Level,Min/Max Light Level,Overshoot/Undershoot RGB Value"); - } - else - { - csvString.AppendLine("Starting RGB,End RGB,Complete Response Time (ms)," + rtType + "," + perType + "," + osType + " " + osSign + ",Visual Response Rating,Input Lag (ms)"); - } - foreach (var res in processedData) - { - csvString.AppendLine(string.Join(strSeparator, res)); - } - Console.WriteLine(filePath); - File.WriteAllText(filePath, csvString.ToString()); - - if (saveGammaTableToolStripMenuItem.Checked) - { - // Save Gamma curve to a file too - decimal gammaFileNumber = 001; - // search /Results folder for existing file names, pick new name - string[] existingGammaFiles = Directory.GetFiles(resultsFolderPath, "*-GAMMA-OSRTT.csv"); - // Search \Results folder for existing results to not overwrite existing or have save conflict errors - foreach (var s in existingGammaFiles) - { - decimal num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); - if (num >= gammaFileNumber) - { - gammaFileNumber = num + 1; - } - } - - string gammaFilePath = resultsFolderPath + "\\" + gammaFileNumber.ToString("000") + "-GAMMA-OSRTT.csv"; - StringBuilder gammaCsvString = new StringBuilder(); - gammaCsvString.AppendLine("RGB, Light Reading"); - foreach (var res in fullGammaTable) - { - gammaCsvString.AppendLine(string.Join(strSeparator, res)); - } - File.WriteAllText(gammaFilePath, gammaCsvString.ToString()); - } - if (saveSmoothedDataToolStripMenuItem.Checked) - { - //Save Smoothed Data To File - decimal smoothedFileNumber = 001; - // search /Results folder for existing file names, pick new name - string[] existingSmoothedFiles = Directory.GetFiles(resultsFolderPath, "*-CLEAN-OSRTT.csv"); - // Search \Results folder for existing results to not overwrite existing or have save conflict errors - foreach (var s in existingSmoothedFiles) - { - decimal num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); - if (num >= smoothedFileNumber) - { - smoothedFileNumber = num + 1; - } - } - - string smoothedFilePath = resultsFolderPath + "\\" + smoothedFileNumber.ToString("000") + "-CLEAN-OSRTT.csv"; - StringBuilder smoothedCsvString = new StringBuilder(); - foreach (var res in smoothedDataTable) - { - smoothedCsvString.AppendLine(string.Join(strSeparator, res)); - } - File.WriteAllText(smoothedFilePath, smoothedCsvString.ToString()); - } - } - else - { - showMessageBox("Error: The program doesn't have a full list of results available to process. " + - "Please check the RAW files and analyse the results again.","Incomplete Results List",MessageBoxButtons.OK,MessageBoxIcon.Error); - } - } - catch (Exception procEx) - { - Console.WriteLine(procEx.Message + procEx.StackTrace); - processingFailed = true; - if (port != null) - { - if (port.IsOpen) - { - port.Write("X"); - showMessageBox("One or more set of results failed to process and won't be included in the multi-run averaging. \n " + - "Brightness may be too high or monitor may be strobing it's backlight. \n" + - "Try calibrating the brightness again, or use the Graph View Template to view the raw data.", "Processing Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); - processingFailed = false; - } - } - } - } - - private void setRepeats() - { - decimal runs = getRunCount() - 1; - port.Write("M" + runs.ToString()); - } - - private void processMultipleRuns() - { - if (multipleRunData.Count == 0) - { - showMessageBox("No results are currently stored in the application. " + - "\n \n If you tried importing a folder, please try again ensuring the folder contains \"RAW-OSRTT.csv\" files." + - "\n \n If you ran a test and are seeing this, that means the program was not able to process the raw data. This may be due to too much noise or incorrect monitor settings. " + - "You can try importing any \"RAW-OSRTT.csv\" files it saved, or run the test again.", "No Results Found", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - try - { - // Fill processed data with the first set of results then average from there - int resultCount = multipleRunData[0].Count(); - - List averageData = new List(); - for (int p = 0; p < resultCount; p++) - { - double[] row = { multipleRunData[0][p][0], multipleRunData[0][p][1], 0, 0, 0, 0, 0, 0 }; - averageData.Add(row); - } - - // Average the data, excluding outliers - for (int k = 0 ; k < resultCount; k++) - { - List rTLine = new List(); - List initRTLine = new List(); - List perRTLine = new List(); - List oSLine = new List(); - List vrrLine = new List(); - List iLLine = new List(); - foreach (var list in multipleRunData) - { - rTLine.Add(list[k][2]); - initRTLine.Add(list[k][3]); - perRTLine.Add(list[k][4]); - oSLine.Add(list[k][5]); - vrrLine.Add(list[k][6]); - iLLine.Add(list[k][7]); - } - double rtMedian = GetMedian(rTLine.ToArray()); - double initRtMedian = GetMedian(initRTLine.ToArray()); - double perRtMedian = GetMedian(perRTLine.ToArray()); - double osMedian = GetMedian(oSLine.ToArray()); - double vrrMedian = GetMedian(vrrLine.ToArray()); - double ilMedian = GetMedian(iLLine.ToArray()); - int validTimeResults = 0; - int validInitialTimeResults = 0; - int validPerceivedTimeResults = 0; - int validOvershootResults = 0; - int validVRRResults = 0; - int validILResults = 0; - foreach (var o in multipleRunData) - { - if (o[k][2] < (rtMedian * 1.2) && o[k][2] > (rtMedian * 0.8)) - { - averageData[k][2] += o[k][2]; - validTimeResults++; - } - if (o[k][3] < (initRtMedian * 1.2) && o[k][3] > (initRtMedian * 0.8)) - { - averageData[k][3] += o[k][3]; - validInitialTimeResults++; - } - if (o[k][4] < (perRtMedian * 1.2) && o[k][4] > (perRtMedian * 0.8)) - { - averageData[k][4] += o[k][4]; - validPerceivedTimeResults++; - } - if (o[k][5] < (osMedian * 1.2) && o[k][5] > (osMedian * 0.8) && o[k][5] != 0) - { - averageData[k][5] += o[k][5]; - validOvershootResults++; - } - if (o[k][6] < (vrrMedian * 1.2) && o[k][6] > (vrrMedian * 0.8)) - { - averageData[k][6] += o[k][6]; - validVRRResults++; - } - if (o[k][7] < (ilMedian * 1.2) && o[k][7] > (ilMedian * 0.8)) - { - averageData[k][7] += o[k][7]; - validILResults++; - } - } - averageData[k][2] = averageData[k][2] / validTimeResults; - averageData[k][2] = Math.Round(averageData[k][2], 1); - averageData[k][3] = averageData[k][3] / validInitialTimeResults; - averageData[k][3] = Math.Round(averageData[k][3], 1); - averageData[k][4] = averageData[k][4] / validPerceivedTimeResults; - averageData[k][4] = Math.Round(averageData[k][4], 1); - if (averageData[k][5] != 0) - { - averageData[k][5] = averageData[k][5] / validOvershootResults; - if (gammaCorrectedToolStripMenuItem.Checked && !percentageToolStripMenuItem.Checked) - { - averageData[k][5] = Math.Round(averageData[k][5], 0); - } - else - { - averageData[k][5] = Math.Round(averageData[k][5], 1); - } - } - averageData[k][6] = averageData[k][6] / validVRRResults; - averageData[k][6] = Math.Round(averageData[k][6], 1); - averageData[k][7] = averageData[k][7] / validILResults; - averageData[k][7] = Math.Round(averageData[k][7], 1); - } - - // Output averaged results to file using folder name/monitor info - string[] folders = resultsFolderPath.Split('\\'); - string monitorInfo = folders.Last(); - //monitorInfo = monitorInfo.Remove(0, 4); - string filePath = resultsFolderPath + "\\" + monitorInfo + "-FINAL-DATA-OSRTT.csv"; - string excelFilePath = resultsFolderPath + "\\" + monitorInfo + "-FINAL-DATA-OSRTT.xlsx"; - string strSeparator = ","; - StringBuilder csvString = new StringBuilder(); - string rtType = "Initial Response Time - 3% (ms)"; - string osType = "Overshoot"; - string osSign = "(%)"; - string perType = "Perceived Response Time - 3% (ms)"; - if (tenPercentMenuItem.Checked) - { - rtType = "Initial Response Time - 10% (ms)"; - perType = "Perceived Response Time - 10% (ms)"; - } - else if (fixedRGB10OffsetToolStripMenuItem.Checked) - { - rtType = "Initial Response Time - RGB10 (ms)"; - perType = "Perceived Response Time - RGB10 (ms)"; - } - else if (fixedRGB5OffsetToolStripMenuItem.Checked) - { - rtType = "Initial Response Time - RGB5 (ms)"; - perType = "Perceived Response Time - RGB5 (ms)"; - } - if (gammaCorrectedToolStripMenuItem.Checked) - { - osSign = "(RGB)"; - } - if (gammaCorrectedToolStripMenuItem.Checked && percentageToolStripMenuItem.Checked) - { - osSign = "(RGB %)"; - } - string[] headers = { "Starting RGB","End RGB","Complete Response Time (ms)", rtType , perType , osType + " " + osSign ,"Visual Response Rating","Input Lag (ms)" }; - csvString.AppendLine(string.Join(strSeparator, headers)); - foreach (var res in averageData) - { - csvString.AppendLine(string.Join(strSeparator, res)); - } - bool failed = false; - if (Properties.Settings.Default.saveXLSX) - { - try - { - File.Copy(path + "\\Results Template.xlsx", excelFilePath); - } - catch (IOException ioe) - { - if (ioe.StackTrace.Contains("exists")) - { - Console.WriteLine("File exists, skipping writing."); - } - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - resultsTemplate = new Excel.Application(); - try - { - resultsTemplateWorkbook = resultsTemplate.Workbooks.Open(excelFilePath); - } - catch - { - DialogResult d = showMessageBox("Error writing data to XLSX results file, file may be open already. Would you like to try again?", "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - if (d == DialogResult.Yes) - { - try - { - resultsTemplateWorkbook = resultsTemplate.Workbooks.Open(excelFilePath); - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.OK, MessageBoxIcon.Error); - failed = true; - } - } - else - { - failed = true; - } - } - if (!failed) - { - Excel._Worksheet resTempSheet = resultsTemplateWorkbook.Sheets[1]; - Excel._Worksheet resTempSheet2 = resultsTemplateWorkbook.Sheets[2]; - Excel._Worksheet resTempSheet3 = resultsTemplateWorkbook.Sheets[3]; - try - { - for (int h = 0; h < headers.Length; h++) - { - resTempSheet.Cells[1, h + 1] = headers[h]; - } - //Console.WriteLine("AverageData Count: " + averageData.Count); - for (int p = 0; p < averageData.Count ; p++) - { - for (int m = 0; m < averageData[0].Length ; m++) - { - //Console.WriteLine("M: " + m + " P: " + p); - resTempSheet.Cells[p + 2, m + 1] = averageData[p][m]; - } - } - resultsTemplateWorkbook.Save(); - } - catch (Exception ex) - { - showMessageBox( ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - failed = true; - } - GC.Collect(); - GC.WaitForPendingFinalizers(); - Marshal.ReleaseComObject(resTempSheet); - try - { - int monitor = getSelectedMonitor(); - resTempSheet2.Cells[4, 12] = displayList[monitor].Freq.ToString(); - - resTempSheet3.Activate(); - - resultsTemplateWorkbook.Save(); - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - failed = true; - } - GC.Collect(); - GC.WaitForPendingFinalizers(); - Marshal.ReleaseComObject(resTempSheet2); - GC.Collect(); - GC.WaitForPendingFinalizers(); - Marshal.ReleaseComObject(resTempSheet3); - } - resultsTemplateWorkbook.Close(); - Marshal.ReleaseComObject(resultsTemplateWorkbook); - resultsTemplate.Quit(); - Marshal.ReleaseComObject(resultsTemplate); - if (failed) - { - File.Delete(excelFilePath); - } - } - if (!Properties.Settings.Default.saveXLSX || failed) - { - try - { - File.WriteAllText(filePath, csvString.ToString()); - } - catch (IOException) - { - DialogResult d = MessageBox.Show("Unable to write final results file as the file is open in another program. Please close it then hit retry.", "Unable to write file", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); - if (d == DialogResult.Retry) - { - try - { - File.WriteAllText(filePath, csvString.ToString()); - } - catch - { - MessageBox.Show("Still can't write to the file. Please importing the folder or running the test again", "Write Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - } - } - catch (Exception ex) - { - showMessageBox(ex.Message + " " + ex.StackTrace, "Error Processing Multiple Runs", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - public static double GetMedian(double[] sourceNumbers) - { - //Framework 2.0 version of this method. there is an easier way in F4 - if (sourceNumbers == null || sourceNumbers.Length == 0) - throw new System.Exception("Median of empty array not defined."); - - //make sure the list is sorted, but use a new array - double[] sortedPNumbers = (double[])sourceNumbers.Clone(); - Array.Sort(sortedPNumbers); + //make sure the list is sorted, but use a new array + double[] sortedPNumbers = (double[])sourceNumbers.Clone(); + Array.Sort(sortedPNumbers); //get the median int size = sortedPNumbers.Length; @@ -3682,7 +2040,6 @@ private void makeResultsFolder() { foreach (var s in existingFiles) { - var name = new DirectoryInfo(s).Name; decimal num = decimal.Parse(name.Remove(3)); if (num >= fileNumber) @@ -3691,231 +2048,37 @@ private void makeResultsFolder() } } } - string filePath = path + "\\" + fileNumber.ToString("000") + "-" + monitorInfo; Directory.CreateDirectory(filePath); resultsFolderPath = filePath; + initRunSettingsFile(filePath, monitor); } - - private void importRawFolder_Click(object sender, EventArgs e) + private void initRunSettingsFile(string filePath, int monitor) { - // Open folder picker dialogue - var filePath = string.Empty; - - using (FolderBrowserDialog folderDiag = new FolderBrowserDialog()) - { - folderDiag.SelectedPath = path; - - if (folderDiag.ShowDialog() == DialogResult.OK) - { - //Get the path of specified file - filePath = folderDiag.SelectedPath; - resultsFolderPath = folderDiag.SelectedPath; - - if (filePath != path) - { - multipleRunData.Clear(); - gamma.Clear(); - //results.Clear(); - string[] files = Directory.GetFiles(filePath); - bool valid = false; - bool inputLag = false; - setProgressBar(true); - foreach (var f in files) - { - if (f.Contains("-GAMMA-RAW-OSRTT")) - { - valid = true; - try - { - using (System.Windows.Forms.OpenFileDialog OFD = new System.Windows.Forms.OpenFileDialog()) - { - OFD.FileName = f; - //Read the contents of the file into a stream - - var fileStream = OFD.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - gamma.Clear(); - while (!reader.EndOfStream) - { - - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - gamma.Add(intLine); - } - } - } - processGammaTable(); - } - catch (IOException iex) - { - MessageBox.Show("Unable to open file - it may be in use in another program. Please close it out and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else if (f.Contains("-RAW-OSRTT")) - { - valid = true; - results.Clear(); - gamma.Clear(); - try - { - List tempRes = new List(); - List tempGamma = new List(); - using (System.Windows.Forms.OpenFileDialog OFD = new System.Windows.Forms.OpenFileDialog()) - { - OFD.FileName = f; - //Read the contents of the file into a stream - - var fileStream = OFD.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - if (intLine[0] == 1000) - { - testLatency.AddRange(intLine); - } - else if (intLine[0] == intLine[1]) - { - tempGamma.Add(intLine); - } - else - { - tempRes.Add(intLine); - } - } - } - } - results.AddRange(new List> { tempRes }); - gamma.AddRange(tempGamma); - //processGammaTable(); - //processThread = new Thread(new ThreadStart(processResponseTimeData)); - //processThread.Start(); - //while (processThread.IsAlive) - //{ - //Thread.Sleep(100); - //} - processResponseTimeData(); - } - catch (IOException iex) - { - if (!iex.Message.Contains(".xlsx")) - { - MessageBox.Show("Unable to open file - it may be in use in another program. Please close it out and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - Console.WriteLine(iex.Message + iex.StackTrace); - } - } - } - else if (filePath.Contains("LAG-RAW")) - { - //Read the contents of the file into a stream - try - { - using (System.Windows.Forms.OpenFileDialog OFD = new System.Windows.Forms.OpenFileDialog()) - { - OFD.FileName = f; - //Read the contents of the file into a stream - - var fileStream = OFD.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - inputLagRawData.Add(intLine); - } - } - resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); - - processInputLagData(); - inputLag = true; - } - } - catch - { - DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - if (valid) - { - processMultipleRuns(); - Process.Start("explorer.exe", resultsFolderPath); - } - else if (inputLag) - { - Process.Start("explorer.exe", resultsFolderPath); - } - else - { - MessageBox.Show("Please select a results folder with one or more raw data files", "Unable to load files", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - setProgressBar(false); - } - else - { - MessageBox.Show("Please select a results folder with one or more raw data files", "Unable to load files", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + string fileName = filePath.Substring(filePath.LastIndexOf('\\')); + runSettings = new ProcessData.runSettings + { + RunName = fileName, + DateAndTime = DateTime.Now.ToString(), + MonitorName = displayList[monitor].ManufacturerCode + " " + displayList[monitor].Name, + RefreshRate = displayList[monitor].Freq, + FPSLimit = Convert.ToInt32(getSelectedFps()), + Vsync = getVsyncState(), + rtMethod = new ProcessData.rtMethods + { + Name = Properties.Settings.Default.rtName, + Tolerance = Properties.Settings.Default.rtTolerance, + gammaCorrected = Properties.Settings.Default.rtGammaCorrected, + percentage = Properties.Settings.Default.rtPercentage + }, + osMethod = new ProcessData.osMethods + { + Name = Properties.Settings.Default.osName, + gammaCorrected = Properties.Settings.Default.osGammaCorrected, + endPercent = Properties.Settings.Default.osEndPercent, + rangePercent = Properties.Settings.Default.osRangePercent } - } + }; } private void Main_Load(object sender, EventArgs e) @@ -4075,18 +2238,10 @@ private void changeSizeAndState(string state) case "standard": if (progressBarActive) { - progressBar1.Location = new Point(0, 435); - Size = new Size(628, 498); - } - else { Size = new Size(628, 480); } - break; - case "analyse": - if (progressBarActive) - { - progressBar1.Location = new Point(0, 580); - Size = new Size(628, 643); + progressBar1.Location = new Point(0, 389); + Size = new Size(679, 451); } - else { Size = new Size(628, 625); } + else { Size = new Size(679, 429); } break; case "brightness": if (progressBarActive) @@ -4095,28 +2250,31 @@ private void changeSizeAndState(string state) } mainPanel.Location = new Point(1500, 26); brightnessPanel.Location = new Point(0, 0); + aboutPanel.Location = new Point(1500, 402); Size = new Size(1000, 800); debugPanel.Location = new Point(1500, 30); menuStrip1.Visible = false; break; case "close brightness": - mainPanel.Location = new Point(2, 26); + mainPanel.Location = new Point(2, 29); brightnessPanel.Location = new Point(1100, 36); - Size = new Size(628, 480); + aboutPanel.Location = new Point(10, 412); + Size = new Size(679, 429); debugPanel.Location = new Point(619, 30); break; case "about": + aboutPanel.Location = new Point(10, 395); if (progressBarActive) { - progressBar1.Location = new Point(0, 701); - Size = new Size(628, 764); + progressBar1.Location = new Point(0, 508); + Size = new Size(679, 569); } else - { Size = new Size(628, 746); } + { Size = new Size(679, 547); } break; case "debug": - Size = new Size(1120, 850); - debugPanel.Location = new Point(619, 30); + Size = new Size(1089, 436); + debugPanel.Location = new Point(673, 32); break; case "show progress bar": Size s = Size; @@ -4134,7 +2292,7 @@ private void changeSizeAndState(string state) Size = s2; break; default: - Size = new Size(628, 480); + Size = new Size(679, 429); break; } } @@ -4183,192 +2341,6 @@ static void IFailedYou(object sender, UnhandledExceptionEventArgs args) } } - private void verboseOutputToolStripMenuItem_Click(object sender, EventArgs e) - { - Properties.Settings.Default.Verbose = verboseOutputToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } - - private void threePercentMenuItem_Click(object sender, EventArgs e) - { - if (!Properties.Settings.Default.threePercentSetting) - { - Properties.Settings.Default.threePercentSetting = threePercentMenuItem.Checked; - Properties.Settings.Default.tenPercentSetting = false; - tenPercentMenuItem.Checked = false; - Properties.Settings.Default.RGB10Offset = false; - fixedRGB10OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.RGB5Offset = false; - fixedRGB5OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.Save(); - } - else - { - threePercentMenuItem.Checked = true; - } - } - - private void tenPercentMenuItem_Click(object sender, EventArgs e) - { - if (!Properties.Settings.Default.tenPercentSetting) - { - Properties.Settings.Default.tenPercentSetting = tenPercentMenuItem.Checked; - Properties.Settings.Default.threePercentSetting = false; - threePercentMenuItem.Checked = false; - Properties.Settings.Default.RGB10Offset = false; - fixedRGB10OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.RGB5Offset = false; - fixedRGB5OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.Save(); - } - else - { - tenPercentMenuItem.Checked = true; - } - } - - private void fixedRGB10OffsetToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!Properties.Settings.Default.RGB10Offset) - { - Properties.Settings.Default.RGB10Offset = fixedRGB10OffsetToolStripMenuItem.Checked; - Properties.Settings.Default.threePercentSetting = false; - threePercentMenuItem.Checked = false; - Properties.Settings.Default.tenPercentSetting = false; - tenPercentMenuItem.Checked = false; - Properties.Settings.Default.RGB5Offset = false; - fixedRGB5OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.gammaCorrRT = true; - gamCorMenuItem.Checked = true; - Properties.Settings.Default.Save(); - } - else - { - fixedRGB10OffsetToolStripMenuItem.Checked = true; - } - } - - private void fixedRGB5OffsetToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!Properties.Settings.Default.RGB5Offset) - { - Properties.Settings.Default.RGB5Offset = fixedRGB5OffsetToolStripMenuItem.Checked; - Properties.Settings.Default.threePercentSetting = false; - threePercentMenuItem.Checked = false; - Properties.Settings.Default.tenPercentSetting = false; - tenPercentMenuItem.Checked = false; - Properties.Settings.Default.RGB10Offset = false; - fixedRGB10OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.gammaCorrRT = true; - gamCorMenuItem.Checked = true; - Properties.Settings.Default.Save(); - } - else - { - fixedRGB10OffsetToolStripMenuItem.Checked = true; - } - } - - private void gammaCorrectedToolStripMenuItem_Click(object sender, EventArgs e) - { - if ((Properties.Settings.Default.gammaPercentSetting || Properties.Settings.Default.gammaPercentDiff) && Properties.Settings.Default.gammaCorrectedSetting) - { - Properties.Settings.Default.gammaCorrectedSetting = gammaCorrectedToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } - else if (Properties.Settings.Default.gammaPercentSetting || Properties.Settings.Default.gammaPercentDiff) - { - Properties.Settings.Default.gammaCorrectedSetting = gammaCorrectedToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } - else if (Properties.Settings.Default.gammaCorrectedSetting) - { - gammaCorrectedToolStripMenuItem.Checked = true; - } - else - { - Properties.Settings.Default.gammaCorrectedSetting = true; - gammaCorrectedToolStripMenuItem.Checked = true; - Properties.Settings.Default.Save(); - } - } - - private void percentageToolStripMenuItem_Click(object sender, EventArgs e) - { - if ((Properties.Settings.Default.gammaPercentSetting || Properties.Settings.Default.gammaPercentDiff) && Properties.Settings.Default.gammaCorrectedSetting) - { - Properties.Settings.Default.gammaPercentSetting = percentageToolStripMenuItem.Checked; - if (!percentageToolStripMenuItem.Checked) - { - Properties.Settings.Default.gammaPercentDiff = percentageToolStripMenuItem.Checked; - endValueToolStripMenuItem.Checked = percentageToolStripMenuItem.Checked; - differenceToolStripMenuItem.Checked = percentageToolStripMenuItem.Checked; - } - Properties.Settings.Default.Save(); - } - else if (Properties.Settings.Default.gammaCorrectedSetting) - { - Properties.Settings.Default.gammaPercentSetting = percentageToolStripMenuItem.Checked; - endValueToolStripMenuItem.Checked = percentageToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } - else if (Properties.Settings.Default.gammaPercentSetting || Properties.Settings.Default.gammaPercentDiff) - { - percentageToolStripMenuItem.Checked = true; - } - else - { - Properties.Settings.Default.gammaPercentSetting = true; - percentageToolStripMenuItem.Checked = true; - endValueToolStripMenuItem.Checked = true; - Properties.Settings.Default.Save(); - } - } - - private void gamCorMenuItem_Click(object sender, EventArgs e) - { - Properties.Settings.Default.gammaCorrRT = gamCorMenuItem.Checked; - Properties.Settings.Default.Save(); - } - - private void testRun() - { - string ue4Path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase; - ue4Path = new Uri(System.IO.Path.GetDirectoryName(ue4Path)).LocalPath; - ue4Path += @"\OSRTT UE4\ResponseTimeTest.exe"; - Console.WriteLine(ue4Path); - // Move UE4 window to selected monitor if that isn't the primary (will open by default there). - int selectedDisplay = getSelectedMonitor(); - var display = Screen.AllScreens[selectedDisplay]; - int WinX = 0; - int WinY = 0; - if (display.Primary == false) - { - // Force UE4 window to selected display if selected is not primary - Console.WriteLine(display.Bounds.Location.X); - WinX = display.Bounds.Location.X; - WinY = display.Bounds.Location.Y; - Console.WriteLine(display.Bounds.Location.Y); - } - //System.Diagnostics.Process process = new System.Diagnostics.Process(); - Process ue4 = new Process(); - try - { - //ue4.StartInfo.UseShellExecute = true; - ue4.StartInfo.FileName = ue4Path; - ue4.StartInfo.Arguments = ue4Path + " WinX=" + WinX + " WinY=" + WinY; - ue4.Start(); - //Process.Start(ue4Path, "WinX=" + WinX + " WinY=" + WinY); - //Process.Start(ue4Path); - ue4.WaitForExit(); - } - catch (Exception strE) - { - Console.WriteLine(strE); - SetText(strE.Message + strE.StackTrace); - } - } - private void fpsLimitList_SelectedIndexChanged(object sender, EventArgs e) { Properties.Settings.Default.FPS = fpsLimitList.SelectedIndex; @@ -4394,19 +2366,6 @@ private void testCount_ValueChanged(object sender, EventArgs e) } } } - - private void saveGammaTableToolStripMenuItem_Click(object sender, EventArgs e) - { - Properties.Settings.Default.saveGammaTable = saveGammaTableToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } - - private void saveSmoothedDataToolStripMenuItem_Click(object sender, EventArgs e) - { - Properties.Settings.Default.saveSmoothData = saveSmoothedDataToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } - private void saveUSBOutputToolStripMenuItem_Click(object sender, EventArgs e) { Properties.Settings.Default.USBOutput = saveUSBOutputToolStripMenuItem.Checked; @@ -4438,11 +2397,6 @@ private void opnResultsBtn_Click(object sender, EventArgs e) Process.Start("explorer.exe", path); } - private void suppressDialogBoxesToolStripMenuItem_Click(object sender, EventArgs e) - { - Properties.Settings.Default.SuppressDiagBox = suppressDialogBoxesToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } private DialogResult showMessageBox(string title, string message, MessageBoxButtons buttons, MessageBoxIcon icon) { @@ -4482,345 +2436,111 @@ private void closeBrightnessBtn_Click(object sender, EventArgs e) brightnessCanceled = true; } else - { - showMessageBox(ex.Message + ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Warning); - menuStrip1.Visible = true; - changeSizeAndState("close brightness"); - brightnessWindowOpen = false; - ready = false; - testRunning = false; - brightnessCanceled = true; - } - - } - } - - private void aboutProgramToolStripMenuItem_Click(object sender, EventArgs e) - { - if (aboutProgramToolStripMenuItem.Checked) - { - changeSizeAndState("about"); - } - else - { - changeSizeAndState("standard"); - } - } - - private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - Process.Start("https://github.com/andymanic/OSRTT/releases"); - } - - private void serialSendBtn_Click(object sender, EventArgs e) - { - if (port != null) - { - if (port.IsOpen) - { - port.Write(serialSendBox.Text); - serialSendBox.Clear(); - } - } - } - - private void richTextBox1_TextChanged(object sender, EventArgs e) - { - // set the current caret position to the end - richTextBox1.SelectionStart = richTextBox1.Text.Length; - // scroll it automatically - richTextBox1.ScrollToCaret(); - } - - private void saveXLSXMenuItem_Click(object sender, EventArgs e) - { - if (excelInstalled) - { - Properties.Settings.Default.saveXLSX = saveXLSXMenuItem.Checked; - } - else - { - Properties.Settings.Default.saveXLSX = false; - } - Properties.Settings.Default.Save(); - } + { + showMessageBox(ex.Message + ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Warning); + menuStrip1.Visible = true; + changeSizeAndState("close brightness"); + brightnessWindowOpen = false; + ready = false; + testRunning = false; + brightnessCanceled = true; + } - private void recommendedSettingsToolStripMenuItem_Click(object sender, EventArgs e) - { - if (Properties.Settings.Default.advancedSettings) - { - advancedSettingsToolStripMenuItem.Checked = false; - recommendedSettingsToolStripMenuItem.Checked = true; - Properties.Settings.Default.advancedSettings = false; - measurementsToolStripMenuItem.Visible = false; - overshootSettingsMenuItem.Visible = false; - extendedGammaTestToolStripMenuItem.Visible = false; - Properties.Settings.Default.gammaCorrectedSetting = true; - gammaCorrectedToolStripMenuItem.Checked = true; - Properties.Settings.Default.gammaCorrRT = true; - gamCorMenuItem.Checked = true; - Properties.Settings.Default.gammaPercentSetting = false; - percentageToolStripMenuItem.Checked = false; - endValueToolStripMenuItem.Checked = false; - differenceToolStripMenuItem.Checked = false; - Properties.Settings.Default.gammaPercentDiff = false; - Properties.Settings.Default.RGB10Offset = false; - fixedRGB10OffsetToolStripMenuItem.Checked = false; - Properties.Settings.Default.RGB5Offset = true; - fixedRGB5OffsetToolStripMenuItem.Checked = true; - Properties.Settings.Default.threePercentSetting = false; - threePercentMenuItem.Checked = false; - Properties.Settings.Default.tenPercentSetting = false; - tenPercentMenuItem.Checked = false; - Properties.Settings.Default.extendedGammaTest = true; - extendedGammaTestToolStripMenuItem.Checked = true; - Properties.Settings.Default.Save(); - } - else - { - recommendedSettingsToolStripMenuItem.Checked = true; } } - private void advancedSettingsToolStripMenuItem_Click(object sender, EventArgs e) + private void aboutProgramToolStripMenuItem_Click(object sender, EventArgs e) { - if (Properties.Settings.Default.advancedSettings) + if (aboutProgramToolStripMenuItem.Checked) { - advancedSettingsToolStripMenuItem.Checked = true; - recommendedSettingsToolStripMenuItem.Checked = false; - measurementsToolStripMenuItem.Visible = true; - overshootSettingsMenuItem.Visible = true; - extendedGammaTestToolStripMenuItem.Visible = true; + changeSizeAndState("about"); } else { - Properties.Settings.Default.advancedSettings = advancedSettingsToolStripMenuItem.Checked; - recommendedSettingsToolStripMenuItem.Checked = false; - measurementsToolStripMenuItem.Visible = true; - overshootSettingsMenuItem.Visible = true; - extendedGammaTestToolStripMenuItem.Visible = true; - Properties.Settings.Default.Save(); + changeSizeAndState("standard"); } } - private void differenceToolStripMenuItem_Click(object sender, EventArgs e) - { - if (Properties.Settings.Default.gammaPercentSetting) - { - Properties.Settings.Default.gammaPercentDiff = differenceToolStripMenuItem.Checked; - Properties.Settings.Default.gammaPercentSetting = false; - percentageToolStripMenuItem.Checked = true; - endValueToolStripMenuItem.Checked = false; - Properties.Settings.Default.Save(); - } - else - { - differenceToolStripMenuItem.Checked = true; - percentageToolStripMenuItem.Checked = true; - Properties.Settings.Default.gammaPercentDiff = differenceToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - } + private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start("https://github.com/andymanic/OSRTT/releases"); } - private void endValueToolStripMenuItem_Click(object sender, EventArgs e) + private void serialSendBtn_Click(object sender, EventArgs e) { - if (Properties.Settings.Default.gammaPercentDiff) - { - Properties.Settings.Default.gammaPercentSetting = endValueToolStripMenuItem.Checked; - Properties.Settings.Default.gammaPercentDiff = false; - percentageToolStripMenuItem.Checked = true; - differenceToolStripMenuItem.Checked = false; - Properties.Settings.Default.Save(); - } - else + if (port != null) { - endValueToolStripMenuItem.Checked = true; - percentageToolStripMenuItem.Checked = true; - Properties.Settings.Default.gammaPercentSetting = endValueToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); + if (port.IsOpen) + { + port.Write(serialSendBox.Text); + serialSendBox.Clear(); + } } } - private void saveGraphsMenuItem_Click(object sender, EventArgs e) + private void richTextBox1_TextChanged(object sender, EventArgs e) { - if (saveGraphsMenuItem.Checked && excelInstalled) - { - DialogResult d = MessageBox.Show("Warning: This option is incredibly slow and may break the test. " + - "It's much better to copy the raw data to the graph view template manually. Are you sure you want to enable this?", - "WARNING - UNSTABLE", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (d == DialogResult.Yes) - { - Properties.Settings.Default.saveGraphs = saveGraphsMenuItem.Checked; - } - else - { - saveGraphsMenuItem.Checked = false; - Properties.Settings.Default.saveGraphs = false; - } - } - else - { - Properties.Settings.Default.saveGraphs = false; - } - Properties.Settings.Default.Save(); + // set the current caret position to the end + richTextBox1.SelectionStart = richTextBox1.Text.Length; + // scroll it automatically + richTextBox1.ScrollToCaret(); } // very unfinished private void processInputLagData() { - //This is a long one. This is the code that builds the gamma curve, finds the start/end points and calculates response times and overshoot % (gamma corrected) - List processedData = new List(); - - // First, create gamma array from the data - List smoothedDataTable = new List(); + inputLagProcessed.Clear(); try //Wrapped whole thing in try just in case { // Then process the lines - int shotNumber = 1; - foreach (int[] item in this.inputLagRawData) + ProcessData pd = new ProcessData(); + inputLagProcessed.AddRange(pd.processInputLagData(inputLagRawData)); + if (inputLagProcessed.Count == 0) { - // Save start, end, time and sample count then clear the values from the array - int ClickTime = item[0]; - Console.WriteLine("ClickTime: " + ClickTime); - int TimeTaken = item[1]; - int SampleCount = item[2]; - int[] samples = item.Skip(3).ToArray(); - - double SampleTime = ((double)TimeTaken / (double)SampleCount); // Get the time taken between samples + throw new Exception("Processing Failed"); + } - // Clean up noisy data using moving average function - int period = 20; - int[] buffer = new int[period]; - int[] averagedSamples = new int[samples.Length]; - int current_index = 0; - for (int a = 0; a < samples.Length; a++) + // convert to double array for each type of average + ProcessData.inputLagResult averageInputLag = new ProcessData.inputLagResult{ clickTimeMs = 0, inputLag = 0, totalInputLag = 0 }; + ProcessData.inputLagResult minInputLag = new ProcessData.inputLagResult { clickTimeMs = 1000, inputLag = 1000, totalInputLag = 1000 }; + ProcessData.inputLagResult maxInputLag = new ProcessData.inputLagResult { clickTimeMs = 0, inputLag = 0, totalInputLag = 0 }; + for (int i = 0; i < inputLagProcessed.Count; i++) + { + averageInputLag.clickTimeMs += inputLagProcessed[i].clickTimeMs; + averageInputLag.inputLag += inputLagProcessed[i].inputLag; + averageInputLag.totalInputLag += inputLagProcessed[i].totalInputLag; + if (inputLagProcessed[i].clickTimeMs < minInputLag.clickTimeMs) { - buffer[current_index] = samples[a] / period; - int movAvg = 0; - for (int b = 0; b < period; b++) - { - movAvg += buffer[b]; - } - averagedSamples[a] = movAvg; - current_index = (current_index + 1) % period; + minInputLag.clickTimeMs = inputLagProcessed[i].clickTimeMs; } - - samples = averagedSamples.Skip(period).ToArray(); //Moving average spoils the first 10 samples so currently removing them. - - List fullSmoothedLine = new List { ClickTime, TimeTaken, SampleCount }; - fullSmoothedLine.AddRange(samples); - smoothedDataTable.Add(fullSmoothedLine.ToArray()); - - // Initialise in-use variables - int transStart = 0; - int transEnd = 0; - - int startMax = samples[5]; // Initialise these variables with a real value - int startMin = samples[5]; // Initialise these variables with a real value - int endMax = samples[samples.Length - 10]; // Initialise these variables with a real value - int endMin = samples[samples.Length - 10]; // Initialise these variables with a real value - - // Build start min/max to compare against - for (int l = 0; l < 250; l++) //CHANGE TO 180 FOR RUN 2 DATA + else if (inputLagProcessed[i].clickTimeMs > maxInputLag.clickTimeMs) { - if (samples[l] < startMin) - { - startMin = samples[l]; - } - else if (samples[l] > startMax) - { - startMax = samples[l]; - } + maxInputLag.clickTimeMs = inputLagProcessed[i].clickTimeMs; } - - // Build end min/max to compare against - for (int m = samples.Length - 5; m > samples.Length - 450; m--) + if (inputLagProcessed[i].inputLag < minInputLag.inputLag) { - if (samples[m] < endMin) - { - endMin = samples[m]; - } - else if (samples[m] > endMax) - { - endMax = samples[m]; - } + minInputLag.inputLag = inputLagProcessed[i].inputLag; } - - // Search for where the result starts transitioning - start is almost always less sensitive - for (int j = 0; j < samples.Length; j++) + else if (inputLagProcessed[i].inputLag > maxInputLag.inputLag) { - if (samples[j] > (startMax)) - { - if ((samples[j + 50] > (samples[j] + 50) || samples[j + 56] > (samples[j] + 50)) - && (samples[j + 100] > (samples[j] + 100) || samples[j + 106] > (samples[j] + 100)) - && (samples[j + 125] > (samples[j] + 100) || samples[j + 131] > (samples[j] + 100)) - && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] > startMax) - { - startMax = samples[j]; - } - } - } + maxInputLag.inputLag = inputLagProcessed[i].inputLag; } - - Console.WriteLine("ClickTime: " + ClickTime); - double clickTimeMs = ClickTime; - clickTimeMs /= 1000; - Console.WriteLine("ClickTimems: " + clickTimeMs); - double transTime = (transStart * SampleTime) / 1000; - double inputLag = Math.Round(transTime, 3); - - double totalInputLag = (ClickTime + (transStart * SampleTime)) / 1000; - totalInputLag = Math.Round(totalInputLag, 3); - /*if (verboseOutputToolStripMenuItem.Checked) + if (inputLagProcessed[i].totalInputLag < minInputLag.totalInputLag) { - // Verbose output with ALLLL the data - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootPercent, visualResponseRating, transStart, transEnd, SampleTime, endAverage, peakValue, overUnderRGB }; - processedData.Add(completeResult); - }*/ - - - double[] completeResult = new double[] { shotNumber, clickTimeMs, inputLag, totalInputLag }; - processedData.Add(completeResult); - shotNumber++; - - } - List temp = new List(); //probably not needed now processedData is a local variable - temp.AddRange(processedData); - inputLagProcessed.AddRange(temp); - - // convert to double array for each type of average - double[] averageInputLag = { 0, 0, 0 }; - double[] minInputLag = { 1000, 1000, 1000 }; - double[] maxInputLag = { 0, 0, 0 }; - for (int i = 0; i < processedData.Count; i++) - { - for (int j = 0; j < averageInputLag.Length; j++) + minInputLag.totalInputLag = inputLagProcessed[i].totalInputLag; + } + else if (inputLagProcessed[i].totalInputLag > maxInputLag.totalInputLag) { - averageInputLag[j] += processedData[i][j + 1]; - if (processedData[i][j + 1] < minInputLag[j]) - { - minInputLag[j] = processedData[i][j + 1]; - } - else if (processedData[i][j + 1] > maxInputLag[j]) - { - maxInputLag[j] = processedData[i][j + 1]; - } + maxInputLag.totalInputLag = inputLagProcessed[i].totalInputLag; } } - averageInputLag[0] /= processedData.Count; - averageInputLag[0] = Math.Round(averageInputLag[0], 3); - averageInputLag[1] /= processedData.Count; - averageInputLag[1] = Math.Round(averageInputLag[1], 3); - averageInputLag[2] /= processedData.Count; - averageInputLag[2] = Math.Round(averageInputLag[2], 3); + averageInputLag.clickTimeMs /= inputLagProcessed.Count; + averageInputLag.clickTimeMs = Math.Round(averageInputLag.clickTimeMs, 3); + averageInputLag.inputLag /= inputLagProcessed.Count; + averageInputLag.inputLag = Math.Round(averageInputLag.inputLag, 3); + averageInputLag.totalInputLag /= inputLagProcessed.Count; + averageInputLag.totalInputLag = Math.Round(averageInputLag.totalInputLag, 3); // Write results to csv using new name decimal fileNumber = 001; @@ -4848,13 +2568,18 @@ private void processInputLagData() StringBuilder csvString = new StringBuilder(); csvString.AppendLine("Shot Number,Click Time (ms),Processing & Display Latency(ms),Total System Input Lag (ms)"); - foreach (var res in processedData) - { - csvString.AppendLine(string.Join(strSeparator, res)); - } - csvString.AppendLine("AVERAGE," + averageInputLag[0].ToString() + "," + averageInputLag[1].ToString() + "," + averageInputLag[2].ToString()); - csvString.AppendLine("MINIMUM," + minInputLag[0].ToString() + "," + minInputLag[1].ToString() + "," + minInputLag[2].ToString()); - csvString.AppendLine("MAXIMUM," + maxInputLag[0].ToString() + "," + maxInputLag[1].ToString() + "," + maxInputLag[2].ToString()); + foreach (var res in inputLagProcessed) + { + csvString.AppendLine( + res.shotNumber.ToString() + "," + + res.clickTimeMs.ToString() + "," + + res.inputLag.ToString() + "," + + res.totalInputLag.ToString() + ); + } + csvString.AppendLine("AVERAGE," + averageInputLag.clickTimeMs.ToString() + "," + averageInputLag.inputLag.ToString() + "," + averageInputLag.totalInputLag.ToString()); + csvString.AppendLine("MINIMUM," + minInputLag.clickTimeMs.ToString() + "," + minInputLag.inputLag.ToString() + "," + minInputLag.totalInputLag.ToString()); + csvString.AppendLine("MAXIMUM," + maxInputLag.clickTimeMs.ToString() + "," + maxInputLag.inputLag.ToString() + "," + maxInputLag.totalInputLag.ToString()); Console.WriteLine(filePath); File.WriteAllText(filePath, csvString.ToString()); Process[] p = Process.GetProcessesByName("ResponseTimeTest-Win64-Shipping"); @@ -4942,7 +2667,7 @@ private void launchInputLagTest() { ControlDeviceButtons(false); ue4.StartInfo.FileName = ue4Path; - ue4.StartInfo.Arguments = ue4Path + " WinX=" + WinX + " WinY=" + WinY; + ue4.StartInfo.Arguments = ue4Path + " WinX=" + WinX + " WinY=" + WinY + " NoVSync"; ue4.Start(); // Process.Start(ue4Path); ue4.WaitForExit(); @@ -4970,36 +2695,10 @@ private void captureTimeBox_SelectedIndexChanged(object sender, EventArgs e) } } - private void helpFramerateBtn_Click(object sender, EventArgs e) - { - MessageBox.Show("The framerate limit is the in-engine FPS limit the test will run at." + - "\n \nYou should set this to 1000 FPS to get a 'best case' test run." + - "\n \nYou should set this to below the monitor's refresh rate if you want to test how it performs with Adaptive Sync / Variable Refresh Rate.", "Framerate Limit Help", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void helpCyclesBtn_Click(object sender, EventArgs e) - { - MessageBox.Show("This is how many times the test will run before averaging the data. Each run will still be processed independently, " + - "but to get the most accurate data you should run the test multiple times. Default is 5, max is 10.", "Number of Cycles Help", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void helpCaptureBtn_Click(object sender, EventArgs e) - { - MessageBox.Show("This is how long the board will spend capturing data for each transition. The longer the period, the more samples it will store per run. " + - "\n \nOnly increase this if the display you are testing has slow input lag and/or slow response times too. Most gaming displays should fit within the 50ms window." + - "\n \nThe default is 50ms, the maximum 250ms. At 50ms each run will save around 450KB of data, 100ms is double at 900KB, and so on.", "Capture Time Help", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void saveRawInputLagDataToolStripMenuItem_Click(object sender, EventArgs e) - { - Properties.Settings.Default.saveInputLagRaw = saveRawInputLagMenuItem.Checked; - Properties.Settings.Default.Save(); - } - - private void IgnoreErrorsMenuItem_Click(object sender, EventArgs e) + private void helpBtn_Click(object sender, EventArgs e) { - Properties.Settings.Default.ignoreErrors = IgnoreErrorsMenuItem.Checked; - Properties.Settings.Default.Save(); + HelpView hv = new HelpView(); + hv.Show(); } private void bugReportMenuItem_Click(object sender, EventArgs e) @@ -5021,182 +2720,19 @@ private void monitorCB_SelectedIndexChanged(object sender, EventArgs e) private void vsyncStateList_SelectedIndexChanged(object sender, EventArgs e) { - Properties.Settings.Default.VSyncState = vsyncStateList.SelectedIndex; - Properties.Settings.Default.Save(); - if (port != null) - { - port.Write("V" + vsyncStateList.SelectedIndex.ToString()); - } - } - - private void vsyncHelpBtn_Click(object sender, EventArgs e) - { - MessageBox.Show("VSync will limit the framerate to the display's refresh rate, regardless of if the FPS cap is set above that. " + - "The FPS cap will still function below the refresh rate. Default state is enabled.", "VSync State Help", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void convertRawGraphMenuItem_Click(object sender, EventArgs e) - { - - if (excelInstalled) + if (vsyncStateList.SelectedIndex == 0) { - // Open file picker dialogue - var filePath = string.Empty; - - using (System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog()) - { - openFileDialog.InitialDirectory = path; - openFileDialog.Filter = "csv files (*.csv)|*.csv"; - openFileDialog.FilterIndex = 2; - openFileDialog.RestoreDirectory = true; - - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - //Get the path of specified file - filePath = openFileDialog.FileName; - results.Clear(); - gamma.Clear(); - setProgressBar(true); - if (filePath.Contains("RAW-OSRTT")) - { - //Read the contents of the file into a stream - try - { - var fileStream = openFileDialog.OpenFile(); - using (StreamReader reader = new StreamReader(fileStream)) - { - while (!reader.EndOfStream) - { - // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) - { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") - { - intLine[i] = int.Parse(line[i]); - } - else - { - continue; - } - } - Array.Resize(ref intLine, intLine.Length - 1); - importedFile.Add(intLine); - } - } - Thread convertThread = new Thread(this.convertCSVtoGraph); - convertThread.Start(filePath); - } - catch - { - DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else - { - MessageBox.Show("Sorry, only 'RAW' files can be imported. Please select a RAW-OSRTT.csv' file instead.", "Importer Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - setProgressBar(false); - } - } + Properties.Settings.Default.VSyncState = false; } else { - MessageBox.Show("Excel doesn't appear to be installed, so this operation can't continue.", "Excel Not Installed", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - private void convertCSVtoGraph(object data) - { - string filePath = data.ToString(); - resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); - string fileName = filePath.Substring(filePath.LastIndexOf('\\')); - //int fileNumber = Int32.Parse(fileName.Split('-')[0]); - string excelFilePath = resultsFolderPath + "\\" + fileName.Split('-')[0] + "-GRAPH-RAW-OSRTT.xlsm"; - Console.WriteLine(excelFilePath); - setProgressBar(true); - bool failed = false; - try - { - File.Copy(path + "\\Graph View Template.xlsm", excelFilePath); - } - catch (IOException ioe) - { - if (ioe.StackTrace.Contains("exists")) - { - Console.WriteLine("File exists, skipping writing."); - } - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - graphTemplate = new Excel.Application(); - try - { - graphTemplateWorkbook = graphTemplate.Workbooks.Open(excelFilePath); - } - catch - { - DialogResult d = showMessageBox("Error writing data to XLSX results file, file may be open already. Would you like to try again?", "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - if (d == DialogResult.Yes) - { - try - { - graphTemplateWorkbook = graphTemplate.Workbooks.Open(excelFilePath); - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - failed = true; - } - } - else - { - failed = true; - } - } - if (!failed) - { - Excel._Worksheet graphTempSheet = graphTemplateWorkbook.Sheets[1]; - try - { - for (int p = 0; p < importedFile.Count; p++) - { - - for (int m = 0; m < importedFile[p].Length; m++) - { - //Console.WriteLine("M: " + m + " P: " + p); - graphTempSheet.Cells[p + 1, m + 1] = importedFile[p][m]; - } - Console.WriteLine(p); - } - graphTemplateWorkbook.Save(); - } - catch (Exception ex) - { - showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.OK, MessageBoxIcon.Error); - failed = true; - } - GC.Collect(); - GC.WaitForPendingFinalizers(); - Marshal.ReleaseComObject(graphTempSheet); - + Properties.Settings.Default.VSyncState = true; } - graphTemplateWorkbook.Close(); - Marshal.ReleaseComObject(graphTemplateWorkbook); - graphTemplate.Quit(); - Marshal.ReleaseComObject(graphTemplate); - if (failed) + Properties.Settings.Default.Save(); + if (port != null) { - File.Delete(excelFilePath); + port.Write("V" + vsyncStateList.SelectedIndex.ToString()); } - setProgressBar(false); - Process.Start("explorer.exe", resultsFolderPath); } private void setProgressBar(bool on) @@ -5232,28 +2768,232 @@ private void setProgressBar(bool on) } private void testButtonToolStripMenuItemToolStripMenuItem_Click(object sender, EventArgs e) + { + DataUpload d = new DataUpload(); + d.systemInfo(); + } + + private void resultsViewBtn_Click(object sender, EventArgs e) { ResultsView resultsView = new ResultsView(); resultsView.Show(); } - private void extendedGammaTestToolStripMenuItem_Click(object sender, EventArgs e) + private void settingsMenuItem_Click(object sender, EventArgs e) { - Properties.Settings.Default.extendedGammaTest = extendedGammaTestToolStripMenuItem.Checked; - Properties.Settings.Default.Save(); - if (port != null) + ResultsSettings rs = new ResultsSettings(); + rs.Show(); + } + + private void testSettingsBtn_Click(object sender, EventArgs e) + { + ResultsSettings rs = new ResultsSettings(); + rs.Show(); + } + + private void ResultsFolderBtn_Click(object sender, EventArgs e) + { + Process.Start("explorer.exe", path); + } + + private void processAllRuns(ProcessData.rtMethods rtMethod, ProcessData.osMethods osMethod) + { + averageData.Clear(); + multipleRunData.Clear(); + CFuncs cf = new CFuncs(); + ProcessData pd = new ProcessData(); + int startDelay = pd.processTestLatency(testLatency); + foreach (var i in results) { - if (Properties.Settings.Default.extendedGammaTest) + processedGamma.Clear(); + processedGamma.AddRange(pd.processGammaTable(gamma, i)); + } + // save gamma data to file + if (Properties.Settings.Default.saveGammaTable) + { + string gammaName = cf.createFileName(resultsFolderPath, "-GAMMA-OSRTT.csv"); + StringBuilder gammaCsv = new StringBuilder(); + gammaCsv.AppendLine("RGB,Light Level"); + foreach (ProcessData.gammaResult g in processedGamma) { - port.Write("Q1"); + gammaCsv.AppendLine(g.RGB.ToString() + "," + g.LightLevel.ToString()); } - else + File.WriteAllText(resultsFolderPath + "\\" + gammaName, gammaCsv.ToString()); + } + List> processedData = new List>(); + processedData.AddRange(pd.ProcessAllResults(results, new ProcessData.resultSelection + { + rtStyle = rtMethod, + osStyle = osMethod + }, startDelay, processedGamma)); + + foreach (var res in processedData) + { + StringBuilder csvString = new StringBuilder(); + string rtType = "Initial Response Time - 3% (ms)"; + string osType = "Overshoot"; + string osSign = "(%)"; + string perType = "Perceived Response Time - 3% (ms)"; + if (rtMethod.Tolerance == 10 && !rtMethod.gammaCorrected) + { + rtType = "Initial Response Time - 10% (ms)"; + perType = "Perceived Response Time - 10% (ms)"; + } + else if (rtMethod.Tolerance == 10 && rtMethod.gammaCorrected) + { + rtType = "Initial Response Time - RGB10 (ms)"; + perType = "Perceived Response Time - RGB10 (ms)"; + } + else if (rtMethod.Tolerance == 5 && rtMethod.gammaCorrected) + { + rtType = "Initial Response Time - RGB5 (ms)"; + perType = "Perceived Response Time - RGB5 (ms)"; + } + if (osMethod.gammaCorrected) + { + osSign = "(RGB)"; + } + if (osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + osSign = "(RGB %)"; + } + string fullFileName = cf.createFileName(resultsFolderPath, "-FULL-OSRTT.csv"); + csvString.AppendLine("Starting RGB,End RGB,Complete Response Time (ms)," + rtType + "," + perType + "," + osType + " " + osSign + ",Visual Response Rating,Input Lag (ms)"); + foreach (ProcessData.processedResult i in res) + { + // save each run to file + csvString.AppendLine( + i.StartingRGB.ToString() + "," + + i.EndRGB.ToString() + "," + + i.compTime.ToString() + "," + + i.initTime.ToString() + "," + + i.perTime.ToString() + "," + + i.Overshoot.ToString() + "," + + i.visualResponseRating.ToString() + "," + + i.inputLag.ToString() + ); + } + if (runSettings != null) { - port.Write("Q0"); + csvString.AppendLine(JsonConvert.SerializeObject(runSettings)); } + string fullFilePath = resultsFolderPath + "\\" + fullFileName; + File.WriteAllText(fullFilePath, csvString.ToString()); + multipleRunData.Add(res); + } + + averageData.AddRange(pd.AverageMultipleRuns(processedData, osMethod)); + // save averaged data to file + string[] folders = resultsFolderPath.Split('\\'); + string monitorInfo = folders.Last(); + StringBuilder avgCsvString = new StringBuilder(); + string avgRtType = "Initial Response Time - 3% (ms)"; + string avgOsType = "Overshoot"; + string avgOsSign = "(%)"; + string avgPerType = "Perceived Response Time - 3% (ms)"; + if (rtMethod.Tolerance == 10 && !rtMethod.gammaCorrected) + { + avgRtType = "Initial Response Time - 10% (ms)"; + avgPerType = "Perceived Response Time - 10% (ms)"; + } + else if (rtMethod.Tolerance == 10 && rtMethod.gammaCorrected) + { + avgRtType = "Initial Response Time - RGB10 (ms)"; + avgPerType = "Perceived Response Time - RGB10 (ms)"; + } + else if (rtMethod.Tolerance == 5 && rtMethod.gammaCorrected) + { + avgRtType = "Initial Response Time - RGB5 (ms)"; + avgPerType = "Perceived Response Time - RGB5 (ms)"; + } + if (osMethod.gammaCorrected) + { + avgOsSign = "(RGB)"; + } + if (osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + avgOsSign = "(RGB %)"; + } + string fileName = monitorInfo + ".csv"; + avgCsvString.AppendLine("Starting RGB,End RGB,Complete Response Time (ms)," + avgRtType + "," + avgPerType + "," + avgOsType + " " + avgOsSign + ",Visual Response Rating,Input Lag (ms)"); + foreach (ProcessData.processedResult i in averageData) + { + // save each run to file + avgCsvString.AppendLine( + i.StartingRGB.ToString() + "," + + i.EndRGB.ToString() + "," + + i.compTime.ToString() + "," + + i.initTime.ToString() + "," + + i.perTime.ToString() + "," + + i.Overshoot.ToString() + "," + + i.visualResponseRating.ToString() + "," + + i.inputLag.ToString() + ); + } + if (runSettings != null) + { + avgCsvString.AppendLine(JsonConvert.SerializeObject(runSettings)); + } + string filePath = resultsFolderPath + "\\" + fileName; + File.WriteAllText(filePath, avgCsvString.ToString()); + if (Properties.Settings.Default.saveXLSX) + { + string[] headers = { "Starting RGB", "End RGB", "Complete Response Time (ms)", avgRtType, avgPerType, avgOsType + " " + avgOsSign, "Visual Response Rating", "Input Lag (ms)" }; + SaveToExcel excel = new SaveToExcel(); + excel.SaveDataToHeatmap(averageData, runSettings, path, resultsFolderPath + "\\" + monitorInfo + ".XLSX", headers); } } + private void runProcessing() + { + ProcessData.rtMethods rt = new ProcessData.rtMethods + { + Name = Properties.Settings.Default.rtName, + Tolerance = Properties.Settings.Default.rtTolerance, + gammaCorrected = Properties.Settings.Default.rtGammaCorrected, + percentage = Properties.Settings.Default.rtPercentage + }; + ProcessData.osMethods os = new ProcessData.osMethods + { + Name = Properties.Settings.Default.osName, + gammaCorrected = Properties.Settings.Default.osGammaCorrected, + endPercent = Properties.Settings.Default.osEndPercent, + rangePercent = Properties.Settings.Default.osRangePercent + }; + int monitor = getSelectedMonitor(); + int fps = Convert.ToInt32(getSelectedFps()); + bool vsync = getVsyncState(); + string runName = resultsFolderPath.Substring(0, resultsFolderPath.LastIndexOf('\\')); + runSettings = new ProcessData.runSettings + { + RunName = runName, + RefreshRate = displayList[monitor].Freq, + FPSLimit = fps, + DateAndTime = DateTime.Now.ToString(), + MonitorName = displayList[monitor].ManufacturerCode + " " + displayList[monitor].Name, + Vsync = vsync, + osMethod = os, + rtMethod = rt + }; + processAllRuns(rt, os); + } + private void initRtOsMethods() + { + rtMethod = new ProcessData.rtMethods + { + Name = Properties.Settings.Default.rtName, + Tolerance = Properties.Settings.Default.rtTolerance, + gammaCorrected = Properties.Settings.Default.rtGammaCorrected, + percentage = Properties.Settings.Default.rtPercentage + }; + osMethod = new ProcessData.osMethods + { + Name = Properties.Settings.Default.osName, + gammaCorrected = Properties.Settings.Default.osGammaCorrected, + endPercent = Properties.Settings.Default.osEndPercent, + rangePercent = Properties.Settings.Default.osRangePercent + }; + } } } diff --git a/OSRTT Launcher/OSRTT Launcher/Main.resx b/OSRTT Launcher/OSRTT Launcher/Main.resx index cb9297c..40ce0da 100644 --- a/OSRTT Launcher/OSRTT Launcher/Main.resx +++ b/OSRTT Launcher/OSRTT Launcher/Main.resx @@ -117,12 +117,18 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 255, 22 + 34, 22 149, 22 + + 255, 22 + 42 diff --git a/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj b/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj index 3b31b5d..e6fc782 100644 --- a/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj +++ b/OSRTT Launcher/OSRTT Launcher/OSRTT Launcher.csproj @@ -85,17 +85,15 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - - ..\packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll - - - ..\packages\ScottPlot.4.1.33\lib\net461\ScottPlot.dll + + ..\packages\ScottPlot.4.1.41\lib\net461\ScottPlot.dll - - ..\packages\ScottPlot.WinForms.4.1.33\lib\net461\ScottPlot.WinForms.dll + + ..\packages\ScottPlot.WinForms.4.1.41\lib\net461\ScottPlot.WinForms.dll + ..\packages\System.Drawing.Common.6.0.0\lib\net461\System.Drawing.Common.dll @@ -126,6 +124,9 @@ + + + @@ -142,13 +143,35 @@ + + Form + + + HelpView.cs + + + Form + + + ResultsSettings.cs + Form ResultsView.cs + + + UserControl + + + Heatmaps.cs + + + Heatmaps.cs + Main.cs @@ -165,6 +188,12 @@ Resources.resx True + + HelpView.cs + + + ResultsSettings.cs + ResultsView.cs @@ -200,6 +229,8 @@ + + @@ -226,6 +257,15 @@ False True + + {50A7E9B0-70EF-11D1-B75A-00A0C90564FE} + 1 + 0 + 0 + tlbimp + False + True + {0002E157-0000-0000-C000-000000000046} 5 diff --git a/OSRTT Launcher/OSRTT Launcher/ProcessData.cs b/OSRTT Launcher/OSRTT Launcher/ProcessData.cs new file mode 100644 index 0000000..3f14df1 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/ProcessData.cs @@ -0,0 +1,1431 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSRTT_Launcher +{ + public class ProcessData + { + // scratch this shit. + // move all the processing code currently in resultsview to here and make resultsview work with that + // then copy the business logic of averaging the data to a function here + // then migrate main.cs processing & averaging functionality to here with just the primary logic. Handle saving etc in-file for now. + public class rtMethods + { + public string Type { get; set; } + public string Name { get; set; } + public int Tolerance { get; set; } + public bool gammaCorrected { get; set; } + public bool percentage { get; set; } + } + public class osMethods + { + public string Type { get; set; } + public string Name { get; set; } + public bool endPercent { get; set; } + public bool rangePercent { get; set; } + public bool gammaCorrected { get; set; } + } + public class resultSelection + { + public int arrayIndex { get; set; } + public int resultIndex { get; set; } + public rtMethods rtStyle { get; set; } + public osMethods osStyle { get; set; } + } + public class graphResult + { + public double Time { get; set; } + public int startIndex { get; set; } + public int endIndex { get; set; } + public double Overshoot { get; set; } + public int offset { get; set; } + } + public class processedResult + { + public int StartingRGB { get; set; } + public int EndRGB { get; set; } + public double SampleTime { get; set; } + public double initTime { get; set; } + public int initStartIndex { get; set; } + public int initEndIndex { get; set; } + public double perTime { get; set; } + public int perStartIndex { get; set; } + public int perEndIndex { get; set; } + public double compTime { get; set; } + public int compStartIndex { get; set; } + public int compEndIndex { get; set; } + public double Overshoot { get; set; } + public double overshootRGB { get; set; } + public double visualResponseRating { get; set; } + public double inputLag { get; set; } + public int offset { get; set; } + } + public class rawResultData + { + public int StartingRGB { get; set; } + public int EndRGB { get; set; } + public int TimeTaken { get; set; } + public int SampleCount { get; set; } + public double SampleTime { get; set; } + public List Samples { get; set; } + public int noiseLevel { get; set; } + } + public class gammaResult + { + public int RGB { get; set; } + public int LightLevel { get; set; } + } + public class runSettings + { + public string RunName { get; set; } + public string DateAndTime { get; set; } + public string MonitorName { get; set; } + public int RefreshRate { get; set; } + public int FPSLimit { get; set; } + public bool Vsync { get; set; } + public string OverdriveMode { get; set; } + public rtMethods rtMethod { get; set; } + public osMethods osMethod { get; set; } + } + + public graphResult processGraphResult(List> data, resultSelection res, int startDelay, List processedGamma, string rtType) + { + try + { + processedResult proc = ProcessResponseTimeData(data, res, startDelay, processedGamma); + graphResult gProc = new graphResult(); + if (rtType == "complete") + { + gProc.Time = proc.compTime; + gProc.startIndex = proc.compStartIndex; + gProc.endIndex = proc.compEndIndex; + } + else if (rtType == "perceived") + { + gProc.Time = proc.perTime; + gProc.startIndex = proc.perStartIndex; + gProc.endIndex = proc.perEndIndex; + } + else if (rtType == "initial") + { + gProc.Time = proc.initTime; + gProc.startIndex = proc.initStartIndex; + gProc.endIndex = proc.initEndIndex; + } + gProc.Overshoot = proc.Overshoot; + gProc.offset = proc.offset; + return gProc; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message + ex.StackTrace); + return null; + } + } + + public List processGammaTable(List gamma, List data) + { + double[] rgbVals = new double[gamma.Count]; + double[] lightLevelVals = new double[gamma.Count]; + for (int i = 0; i < gamma.Count; i++) + { + int[] dataLine = gamma[i].Skip(300).ToArray(); + int lineAverage = 0; + for (int j = 0; j < (dataLine.Length - 100); j++) + { + lineAverage += dataLine[j]; + } + foreach (var result in data) + { + if (result.StartingRGB == gamma[i][0]) + { + result.noiseLevel = (dataLine.Max() - dataLine.Min()); + } + } + lineAverage /= (dataLine.Length - 100); + rgbVals[i] = gamma[i][0]; + lightLevelVals[i] = lineAverage; + } + int pointsBetween = 51; + if (gamma.Count == 16) + { + pointsBetween = 17; + } + var interpPoints = new ScottPlot.Statistics.Interpolation.NaturalSpline(rgbVals, lightLevelVals, pointsBetween); + List x = new List(); + List y = new List(); + foreach (var p in interpPoints.interpolatedXs) + { + x.Add(Convert.ToInt32(p)); + } + foreach (var p in interpPoints.interpolatedYs) + { + y.Add(Convert.ToInt32(p)); + } + List xy = new List(); + for (int k = 0; k < x.Count; k++) + { + xy.Add(new gammaResult { RGB = x[k], LightLevel = y[k] }); + } + return xy; + } + + PointF[] InterpolatePoints(PointF[] original, int numberRequired) + { + // The new array, ready to return. + PointF[] interpolated = new PointF[numberRequired]; + + // The number of interpolated points in between each pair of existing points. + int between = ((numberRequired - original.Length) / (original.Length - 1)) + 1; + + // Loop through the original list. + int index = 0; + for (int i = 0; i < original.Length - 1; i++) + { + // Add each original point to the interpolated points. + interpolated[index++] = original[i]; + + // The step distances in x and y directions between this original point and the next one. + float stepX = (original[i + 1].X - original[i].X) / ((float)between + 1); + float stepY = (original[i + 1].Y - original[i].Y) / ((float)between + 1); + + // Add the interpolated points at the given steps. + for (int j = 0; j < between; j++) + { + float x = original[i].X + stepX * (float)(j + 1); + float y = original[i].Y + stepY * (float)(j + 1); + + if (index < numberRequired) + { + interpolated[index++] = new PointF(x, y); + } + else + { + break; + } + } + } + return interpolated; + } + + public int processTestLatency(List testLatency) + { + int startDelay = 150; + if (testLatency.Count != 0) + { + int[] tl = testLatency.Skip(5).ToArray(); + for (int n = 0; n < tl.Length; n++) + { + if (tl[n] > 8000) + { + if (n <= 150 && n > 30) + { + startDelay = n - 30; + } + else if (n < 30) + { + n /= 2; + startDelay = n; + } + else if (n > 400) + { + startDelay = 250; + } + break; + } + } + } + return startDelay; + } + + public int[] smoothData(int[] samples, int period) + { + int[] buffer = new int[period]; + int[] averagedSamples = new int[samples.Length]; + int current_index = 0; + for (int a = 0; a < samples.Length; a++) + { + buffer[current_index] = samples[a] / period; + int movAvg = 0; + for (int b = 0; b < period; b++) + { + movAvg += buffer[b]; + } + averagedSamples[a] = movAvg; + current_index = (current_index + 1) % period; + } + return averagedSamples.Skip(period).ToArray(); + } + + public processedResult ProcessResponseTimeData(List> data, resultSelection res, int startDelay, List processedGamma) + { + //This is a long one. This is the code that builds the gamma curve, finds the start/end points and calculates response times and overshoot % (gamma corrected) + List processedData = new List(); + + // First, create gamma array from the data + List localGamma = new List(); + List fullGammaTable = new List(); + List smoothedDataTable = new List(); + + + try //Wrapped whole thing in try just in case + { + // Save start, end, time and sample count then clear the values from the array + int StartingRGB = data[res.arrayIndex][res.resultIndex].StartingRGB; + int EndRGB = data[res.arrayIndex][res.resultIndex].EndRGB; + int TimeTaken = data[res.arrayIndex][res.resultIndex].TimeTaken; + int SampleCount = data[res.arrayIndex][res.resultIndex].SampleCount; + int[] samples = data[res.arrayIndex][res.resultIndex].Samples.ToArray(); + + double SampleTime = ((double)TimeTaken / (double)SampleCount); // Get the time taken between samples + + // Clean up noisy data using moving average function + int period = 10; + int noise = data[res.arrayIndex][res.resultIndex].noiseLevel; + if (noise < 250) + { + period = 20; + } + else if (noise < 500) + { + period = 30; + } + else if (noise < 750) + { + period = 40; + } + else + { + period = 50; + } + + samples = smoothData(samples, period); //Moving average spoils the first 10 samples so currently removing them. + + List fullSmoothedLine = new List { StartingRGB, EndRGB, TimeTaken, SampleCount }; + fullSmoothedLine.AddRange(samples); + smoothedDataTable.Add(fullSmoothedLine.ToArray()); + + int maxValue = samples.Max(); // Find the maximum value for overshoot + int minValue = samples.Min(); // Find the minimum value for undershoot + // Initialise in-use variables + int transStart = 0; + int transEnd = 0; + int initialTransStart = 0; + int initialTransEnd = 0; + int perceivedTransStart = 0; + int perceivedTransEnd = 0; + + double overUnderRGB = 0.0; + + int startMax = samples[5]; // Initialise these variables with a real value + int startMin = samples[5]; // Initialise these variables with a real value + int endMax = samples[samples.Length - 10]; // Initialise these variables with a real value + int endMin = samples[samples.Length - 10]; // Initialise these variables with a real value + + // Build start min/max to compare against + for (int l = 0; l < startDelay; l++) //CHANGE TO 180 FOR RUN 2 DATA + { + if (samples[l] < startMin) + { + startMin = samples[l]; + } + else if (samples[l] > startMax) + { + startMax = samples[l]; + } + } + + // Build end min/max to compare against + for (int m = samples.Length - 5; m > samples.Length - 150; m--) + { + if (samples[m] < endMin) + { + endMin = samples[m]; + } + else if (samples[m] > endMax) + { + endMax = samples[m]; + } + } + + // Search for where the result starts transitioning - start is almost always less sensitive + for (int j = 0; j < samples.Length; j++) + { + if (StartingRGB < EndRGB) + { + if (samples[j] > (startMax)) + { + if (StartingRGB == 0 && EndRGB == 26) + { + if ((samples[j + 50] > (samples[j] + 25) || samples[j + 56] > (samples[j] + 25)) + && (samples[j + 100] > (samples[j] + 50) || samples[j + 106] > (samples[j] + 50)) + && (samples[j + 125] > (samples[j] + 75) || samples[j + 131] > (samples[j] + 75)) + && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise + { + transStart = j; + break; + } + else + { + if (samples[j] > startMax) + { + startMax = samples[j]; + } + } + } + else + { + if ((samples[j + 50] > (samples[j] + 50) || samples[j + 56] > (samples[j] + 50)) + && (samples[j + 100] > (samples[j] + 100) || samples[j + 106] > (samples[j] + 100)) + && (samples[j + 125] > (samples[j] + 100) || samples[j + 131] > (samples[j] + 100)) + && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise + { + transStart = j; + break; + } + else + { + if (samples[j] > startMax) + { + startMax = samples[j]; + } + } + } + } + } + else + { + if (samples[j] < (startMin)) + { + if (StartingRGB == 26 && EndRGB == 0) + { + if ((samples[j + 50] < (samples[j] - 25) || samples[j + 56] < (samples[j] - 25)) + && (samples[j + 100] < (samples[j] - 50) || samples[j + 106] < (samples[j] - 50)) + && (samples[j + 125] < (samples[j] - 75) || samples[j + 131] < (samples[j] - 75)) + && (samples[j + 150] < (samples[j] - 100) || samples[j + 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise + { + transStart = j; + break; + } + else + { + if (samples[j] < startMin) + { + startMin = samples[j]; + } + } + } + else + { + if ((samples[j + 50] < (samples[j] - 50) || samples[j + 56] < (samples[j] - 50)) + && (samples[j + 100] < (samples[j] - 100) || samples[j + 106] < (samples[j] - 100)) + && (samples[j + 125] < (samples[j] - 100) || samples[j + 131] < (samples[j] - 100)) + && (samples[j + 150] < (samples[j] - 100) || samples[j + 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise + { + transStart = j; + break; + } + else + { + if (samples[j] < startMin) + { + startMin = samples[j]; + } + } + } + } + } + } + + // Search for where the result stops transitioning (from the end) - end position is almost always more sensitive hence lower values - also must account for over/undershoot + for (int j = samples.Length - 1; j > 0; j--) + { + if (StartingRGB < EndRGB) + { + if (maxValue > (endMax + 100)) //Check for overshoot + { + if (samples[j] > endMax) + { + if (samples[j - 100] > (samples[j] + 50) && samples[j - 125] > (samples[j] + 50)) // check the trigger point is actually the trigger and not noise + { + transEnd = j; + break; + } + else + { + if (samples[j] > endMax) + { + endMax = samples[j]; + } + } + } + } + else + { + if (samples[j] <= (endMin + 20)) //Check for regular finish point + { + if (StartingRGB == 0 && EndRGB == 26) + { + if ((samples[j - 100] < (samples[j] - 25) || samples[j - 106] < (samples[j] - 25)) + && (samples[j - 125] < (samples[j] - 50) || samples[j - 131] < (samples[j] - 50)) + && (samples[j - 150] < (samples[j] - 75) || samples[j - 156] < (samples[j] - 75))) // check the trigger point is actually the trigger and not noise + { + transEnd = j; + break; + } + else + { + if (samples[j] < endMin) + { + endMin = samples[j]; + } + } + } + else + { + if ((samples[j - 100] < (samples[j] - 50) || samples[j - 106] < (samples[j] - 50)) + && (samples[j - 125] < (samples[j] - 75) || samples[j - 131] < (samples[j] - 75)) + && (samples[j - 150] < (samples[j] - 100) || samples[j - 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise + { + transEnd = j; + break; + } + else + { + if (samples[j] < endMin) + { + endMin = samples[j]; + } + } + } + } + } + } + else + { + if (minValue < (endMin - 100)) //Check for undershoot + { + if (samples[j] < endMin) //Check for under-shot finish point + { + if (samples[j - 100] < (samples[j] - 50) && samples[j - 125] < (samples[j] - 50)) // check the trigger point is actually the trigger and not noise + { + transEnd = j; + break; + } + else + { + if (samples[j] < endMin) + { + endMin = samples[j]; + } + } + } + } + else + { + if (samples[j] > endMax) //Check for regular finish point + { + if (StartingRGB == 26 && EndRGB == 0) + { + if ((samples[j - 100] > (samples[j] + 25) || samples[j - 106] > (samples[j] + 25)) + && (samples[j - 125] > (samples[j] + 50) || samples[j - 131] > (samples[j] + 50)) + && (samples[j - 150] > (samples[j] + 75) || samples[j - 156] > (samples[j] + 75))) + { + transEnd = j; + break; + } + else + { + if (samples[j] > endMax) + { + endMax = samples[j]; + } + } + } + else + { + if ((samples[j - 100] > (samples[j] + 50) || samples[j - 106] > (samples[j] + 50)) + && (samples[j - 125] > (samples[j] + 75) || samples[j - 131] > (samples[j] + 75)) + && (samples[j - 150] > (samples[j] + 100) || samples[j - 156] > (samples[j] + 100))) + { + transEnd = j; + break; + } + else + { + if (samples[j] > endMax) + { + endMax = samples[j]; + } + } + } + } + } + } + } + double startAverage = 0; + double endAverage = 0; + int avgStart = transStart - 200; + int avgEnd = transEnd + 400; + if (transStart < 200) + { + int t = transStart / 5; + avgStart = transStart - t; + } + if ((samples.Length - transEnd) < 400) + { + int t = (samples.Length - transEnd) / 5; + avgEnd = transEnd + t; + } + for (int q = 0; q < avgStart; q++) + { + startAverage += samples[q]; + } + startAverage /= avgStart; + startAverage = Math.Round(startAverage, 0); + for (int q = avgEnd; q < samples.Length; q++) + { + endAverage += samples[q]; + } + endAverage /= (samples.Length - avgEnd); + endAverage = Math.Round(endAverage, 0); + int arrSize = (transEnd - transStart + 100); + if (samples.Length < (transEnd + 100)) + { + arrSize = samples.Length - transStart; + } + if (arrSize < 110) + { + arrSize = 200; + } + int[] transitionSamples = new int[arrSize]; + // Getting min/max from INSIDE the transition window + if ((transEnd - transStart) != 0) + { + Array.Copy(samples, transStart, transitionSamples, 0, arrSize); + maxValue = transitionSamples.Max(); + minValue = transitionSamples.Min(); + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Overshoot calculations + double overshootPercent = 0; + double overshootRGBDiff = 0; + double peakValue = 0; + if (StartingRGB < EndRGB) + { + peakValue = maxValue; + // Dark to light transition + if (maxValue > (endAverage + 100) && maxValue > (processedGamma[EndRGB].LightLevel + 100)) + { + // undershoot may have occurred + Console.WriteLine("Overshoot found"); + // convert maxValue to RGB using gamma table + for (int i = 0; i < processedGamma.Count; i++) + { + // Find what RGB value matches or exceeds the peak light reading for this run + if (maxValue <= processedGamma[i].LightLevel) + { + // Check if peak light reading is closer to upper or lower bound value + int diff1 = processedGamma[i].LightLevel - maxValue; + int diff2 = maxValue - processedGamma[i - 1].LightLevel; + if (diff1 < diff2) + { + overUnderRGB = processedGamma[i].RGB; + } + else + { + overUnderRGB = processedGamma[i - 1].RGB; + } + break; + } + else if (maxValue > processedGamma.Last().LightLevel) + { + if (maxValue > 65500) + { + overUnderRGB = 260; + break; + } + else + { + overUnderRGB = 256; + break; + } + } + } + if (overUnderRGB == -1) + { + //overshootPercent = 100; + } + else + { + overshootRGBDiff = overUnderRGB - EndRGB; + double os = 0; + if (res.osStyle.endPercent) + { + os = (overUnderRGB - EndRGB) / EndRGB; + } + else + { + double range = EndRGB - StartingRGB; + os = overshootRGBDiff / range; + } + os *= 100; + overshootPercent = Math.Round(os, 1); + } + } + } + else + { + peakValue = minValue; + // Light to dark transistion + if (minValue < (endAverage - 100) && minValue < (processedGamma[EndRGB].LightLevel - 100)) + { + // overshoot may have occurred + // convert minValue to RGB using gamma table + Console.WriteLine("Undershoot found"); + for (int i = 0; i < processedGamma.Count; i++) + { + // Find what RGB value matches or exceeds the peak light reading for this run + if (minValue <= processedGamma[i].LightLevel) + { + if (i == 0) + { + overUnderRGB = 0; + break; + } + else + { + // Check if peak light reading is closer to upper or lower bound value + int diff1 = processedGamma[i].LightLevel - minValue; + int diff2 = minValue - processedGamma[i - 1].LightLevel; + if (diff1 < diff2) + { + overUnderRGB = processedGamma[i].RGB; + } + else + { + overUnderRGB = processedGamma[i - 1].RGB; + } + break; + } + } + } + overshootRGBDiff = EndRGB - overUnderRGB; + double os = 0; + if (res.osStyle.endPercent) + { + os = (EndRGB - overUnderRGB) / EndRGB; + } + else + { + double range = StartingRGB - EndRGB; + os = overshootRGBDiff / range; + } + // os *= -1; + os *= 100; + overshootPercent = Math.Round(os, 1); + if (overshootPercent != 0 && overshootPercent < 1) + { + overshootPercent = 0; + } + } + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // INITIAL AND PERCEIVED RESPONSE TIME MEASUREMENTS + if (StartingRGB < EndRGB) + { + // Setup variables for start/end trigger points + double start3 = 0; + double endOffsetRGB = 0; + double end3 = 0; + double endPer3 = 0; + double RGBTolerance = res.rtStyle.Tolerance; + double tol = (RGBTolerance / 100); + if (!res.rtStyle.gammaCorrected) + { + double range3 = (endAverage - startAverage) * tol; // Subtract low value from high value to get light level range + start3 = startAverage + range3; // Start trigger value + end3 = endAverage - range3; + if (peakValue > (endAverage + range3)) + { endPer3 = endAverage + range3; } // End trigger value + else + { endPer3 = endAverage - range3; } // End trigger value + } + else + { + if (res.rtStyle.percentage) + { + RGBTolerance = (EndRGB - StartingRGB) * tol; + RGBTolerance = Math.Round(RGBTolerance, 0); + } + endOffsetRGB = EndRGB - RGBTolerance; + start3 = processedGamma[Convert.ToInt32(StartingRGB + RGBTolerance)].LightLevel; + end3 = processedGamma[Convert.ToInt32(EndRGB - RGBTolerance)].LightLevel; + if (overUnderRGB > (EndRGB + RGBTolerance) && overUnderRGB != 0) + { endOffsetRGB = EndRGB + RGBTolerance; } + else if (overUnderRGB == -1) + { endOffsetRGB = EndRGB; } + endPer3 = processedGamma[Convert.ToInt32(endOffsetRGB)].LightLevel; + if (overUnderRGB == -1) + { endPer3 *= 1.02; } + + } + if (endPer3 >= 65520) + { endPer3 = 65500; } + + // Actually find the start/end points + for (int j = (transStart - 20); j < (transEnd + 20); j++) // search samples for start & end trigger points + { + if (samples[j] >= start3 && initialTransStart == 0) // save the FIRST time value exceeds start trigger + { + if ((samples[j + 50] > (start3 + 25) || samples[j + 60] > (start3 + 25)) + && (samples[j + 100] > (start3 + 50) || samples[j + 110] > (start3 + 50)) + && (samples[j + 150] > (start3 + 75) || samples[j + 160] > (start3 + 75))) + { + initialTransStart = j; + perceivedTransStart = j; + } + else if (j == transEnd) + { + initialTransStart = transStart; + perceivedTransStart = transStart; + } + } + else if (samples[j] >= end3) // Save when value exceeds end trigger then break. + { + if ((samples[j + 20] > (end3 + 25) || samples[j + 25] > (end3 + 25)) + && (samples[j + 30] > (end3 + 50) || samples[j + 35] > (end3 + 50)) + && (samples[j + 50] > (end3 + 75) || samples[j + 55] > (end3 + 75))) + { + initialTransEnd = j; + break; + } + else if (j == transEnd) + { + initialTransEnd = transEnd; + break; + } + } + else if (j == transEnd) + { + initialTransEnd = transEnd; + break; + } + } + for (int j = (transEnd + 20); j > (transStart - 20); j--) // search samples for end point + { + if (endOffsetRGB > EndRGB || overUnderRGB == -1 || (endOffsetRGB == 0 && endPer3 > endAverage && overshootPercent > 1)) // Including overshoot in the curve + { + if (samples[j] >= endPer3) // add the same sort of more detailed check like complete for finding this + { + if ((samples[j - 25] > (endPer3 + 25) || samples[j - 30] > (endPer3 + 25)) + && (samples[j - 35] > (endPer3 + 50) || samples[j - 40] > (endPer3 + 50))) + { + perceivedTransEnd = j; + break; + } + } + else if (j == transStart) + { + perceivedTransEnd = j; + break; + } + } + else // No overshoot found within RGB tolerance + { + if (samples[j] <= endPer3) + { + if ((samples[j - 50] < (endPer3 - 25) || samples[j - 60] < (endPer3 - 25)) + && (samples[j - 100] < (endPer3 - 50) || samples[j - 110] < (endPer3 - 50)) + && (samples[j - 150] < (endPer3 - 75) || samples[j - 160] < (endPer3 - 75))) + { + perceivedTransEnd = j; + break; + } + } + else if (j == transStart) + { + perceivedTransEnd = j; + break; + } + } + } + if (perceivedTransEnd < initialTransEnd) + { // just in case the two methods differ slightly and perceived would come out as shorter. + perceivedTransEnd = initialTransEnd; + } + } + else + { + // Setup variables for start/end trigger points + double start3 = 0; + double endOffsetRGB = 0; + double end3 = 0; + double endPer3 = 0; + double RGBTolerance = res.rtStyle.Tolerance; + double tol = (RGBTolerance / 100); + if (!res.rtStyle.gammaCorrected) + { + double range3 = (startAverage - endAverage) * tol; // Subtract low value from high value to get light level range + start3 = startAverage - range3; // Start trigger value + end3 = endAverage + range3; + if (peakValue < (endAverage - range3)) + { endPer3 = endAverage - range3; } // End trigger value + else + { endPer3 = endAverage + range3; } // End trigger value + } + else + { + if (res.rtStyle.percentage) + { + RGBTolerance = (StartingRGB - EndRGB) * tol; + RGBTolerance = Math.Round(RGBTolerance, 0); + } + endOffsetRGB = EndRGB + RGBTolerance; + start3 = processedGamma[Convert.ToInt32(StartingRGB - RGBTolerance)].LightLevel; + end3 = processedGamma[Convert.ToInt32(EndRGB + RGBTolerance)].LightLevel; + if (overUnderRGB < (EndRGB - RGBTolerance) && overUnderRGB != 0) + { + endOffsetRGB = EndRGB - RGBTolerance; + } + endPer3 = processedGamma[Convert.ToInt32(endOffsetRGB)].LightLevel; + } + + for (int j = (transStart - 20); j < (transEnd + 20); j++) // search samples for start point + { + if (samples[j] <= start3 && initialTransStart == 0) // save the FIRST time value exceeds start trigger + { + if ((samples[j + 50] < (start3 - 25) || samples[j + 60] < (start3 - 25)) + && (samples[j + 100] < (start3 - 50) || samples[j + 110] < (start3 - 50)) + && (samples[j + 150] < (start3 - 75) || samples[j + 160] < (start3 - 75))) + { + initialTransStart = j; + perceivedTransStart = j; + } + else if (j == transEnd) + { + initialTransStart = transStart; + perceivedTransStart = transStart; + } + } + else if (samples[j] <= end3) // Save when value exceeds end trigger then break. + { + if ((samples[j + 50] < (end3 - 25) || samples[j + 60] < (end3 - 25)) + && (samples[j + 100] < (end3 - 50) || samples[j + 110] < (end3 - 50)) + && (samples[j + 150] < (end3 - 75) || samples[j + 160] < (end3 - 75))) + { + initialTransEnd = j; + break; + } + else if (j == transEnd) + { + initialTransEnd = transEnd; + break; + } + } + else if (j == transEnd) + { + initialTransEnd = transEnd; + break; + } + } + for (int j = (transEnd + 20); j > (transStart - 20); j--) // search samples for end point + { + if ((endOffsetRGB < EndRGB && endOffsetRGB != 0) || (endPer3 < endAverage && endOffsetRGB == 0 && overshootPercent > 1)) // Including undershoot in the curve + { + if (samples[j] <= endPer3) + { + if ((samples[j - 20] < (endPer3 - 25) || samples[j - 25] < (endPer3 - 25)) + && (samples[j - 30] < (endPer3 - 50) || samples[j - 35] < (endPer3 - 50))) + { + perceivedTransEnd = j; + break; + } + } + else if (j == transStart) + { + perceivedTransEnd = j; + break; + } + } + else // No overshoot found within RGB tolerance + { + if (samples[j] >= endPer3) + { + + if ((samples[j - 50] > (endPer3 + 25) || samples[j - 60] > (endPer3 + 25)) + && (samples[j - 100] > (endPer3 + 50) || samples[j - 110] > (endPer3 + 50)) + && (samples[j - 150] > (endPer3 + 75) || samples[j - 160] > (endPer3 + 75))) + { + perceivedTransEnd = j; + break; + } + } + else if (j == transStart) + { + perceivedTransEnd = j; + break; + } + } + } + if (perceivedTransEnd < initialTransEnd) + { // just in case the two methods differ slightly and perceived would come out as shorter. + perceivedTransEnd = initialTransEnd; + } + } + + double transCount = transEnd - transStart; + double transTime = (transCount * SampleTime) / 1000; + + double initialTransCount = initialTransEnd - initialTransStart; + double initialTransTime = (initialTransCount * SampleTime) / 1000; + + double perceivedTransCount = perceivedTransEnd - perceivedTransStart; + double perceivedTransTime = (perceivedTransCount * SampleTime) / 1000; + + double inputLagTime = (transStart * SampleTime) / 1000; + + double responseTime = Math.Round(transTime, 1); + double initialResponseTime = Math.Round(initialTransTime, 1); + double perceivedResponseTime = Math.Round(perceivedTransTime, 1); + + double visualResponseRating = 100 - (initialResponseTime + perceivedResponseTime); + + double inputLag = Math.Round(inputLagTime, 1); + + + if (res.osStyle.gammaCorrected && !res.osStyle.endPercent && !res.osStyle.rangePercent) + { + // Standard output with total transition time & gamma corrected overshoot value + if (overUnderRGB == -1) + { + overshootRGBDiff = 100; + } + double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootRGBDiff, visualResponseRating, inputLag }; + processedData.Add(completeResult); + + return new processedResult { + StartingRGB = StartingRGB, + EndRGB = EndRGB, + SampleTime = SampleTime, + perTime = perceivedResponseTime, + perStartIndex = perceivedTransStart, + perEndIndex = perceivedTransEnd, + compTime = responseTime, + compStartIndex = transStart, + compEndIndex = transEnd, + initTime = initialResponseTime, + initStartIndex = initialTransStart, + initEndIndex = initialTransEnd, + Overshoot = overshootRGBDiff, + overshootRGB = overshootRGBDiff, + visualResponseRating = visualResponseRating, + inputLag = inputLag, + offset = period + }; + } + else if (res.osStyle.endPercent || res.osStyle.rangePercent) + { + // Standard output with total transition time & overshoot light level percentage + double os = 0; + if (res.osStyle.gammaCorrected) + { + peakValue = overUnderRGB; + endAverage = EndRGB; + startAverage = StartingRGB; + } + if (res.osStyle.endPercent) + { + if (StartingRGB < EndRGB) + { + if (peakValue > (endAverage + 100) || (res.osStyle.gammaCorrected && peakValue > endAverage)) + { + os = (peakValue - endAverage) / endAverage; + os *= 100; + os = Math.Round(os, 1); + } + } + else + { + if (peakValue < (endAverage - 100) || (res.osStyle.gammaCorrected && peakValue < endAverage)) + { + os = (endAverage - peakValue) / endAverage; + // os *= -1; + os *= 100; + os = Math.Round(os, 1); + } + } + } + else + { + if (StartingRGB < EndRGB) + { + if (peakValue > (endAverage + 100) || (res.osStyle.gammaCorrected && peakValue > endAverage)) + { + double range = endAverage - startAverage; + double peakRange = peakValue - endAverage; + os = peakRange / range; + os *= 100; + os = Math.Round(os, 1); + } + } + else + { + if (peakValue < (endAverage - 100) || (res.osStyle.gammaCorrected && peakValue < endAverage)) + { + double range = startAverage - endAverage; + double peakRange = endAverage - peakValue; + os = peakRange / range; + // os *= -1; + os *= 100; + os = Math.Round(os, 1); + } + } + } + double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, os, visualResponseRating, inputLag }; + processedData.Add(completeResult); + return new processedResult + { + StartingRGB = StartingRGB, + EndRGB = EndRGB, + SampleTime = SampleTime, + perTime = perceivedResponseTime, + perStartIndex = perceivedTransStart, + perEndIndex = perceivedTransEnd, + compTime = responseTime, + compStartIndex = transStart, + compEndIndex = transEnd, + initTime = initialResponseTime, + initStartIndex = initialTransStart, + initEndIndex = initialTransEnd, + Overshoot = os, + overshootRGB = overshootRGBDiff, + visualResponseRating = visualResponseRating, + inputLag = inputLag, + offset = period + }; + } + else + { + // Standard output with total transition time & gamma corrected overshoot percentage + double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootPercent, visualResponseRating, inputLag }; + processedData.Add(completeResult); + + return new processedResult + { + StartingRGB = StartingRGB, + EndRGB = EndRGB, + SampleTime = SampleTime, + perTime = perceivedResponseTime, + perStartIndex = perceivedTransStart, + perEndIndex = perceivedTransEnd, + compTime = responseTime, + compStartIndex = transStart, + compEndIndex = transEnd, + initTime = initialResponseTime, + initStartIndex = initialTransStart, + initEndIndex = initialTransEnd, + Overshoot = overshootPercent, + overshootRGB = overshootRGBDiff, + visualResponseRating = visualResponseRating, + inputLag = inputLag, + offset = period + }; + } + } + catch (Exception procEx) + { + Console.WriteLine(procEx.Message + procEx.StackTrace); + return null; + } + } + + public List ProcessFullResults(List> data, resultSelection res, int startDelay, List processedGamma) + { + List processedResults = new List(); + for (int i = 0; i < data[res.arrayIndex].Count; i++) + { + resultSelection resSel = new resultSelection + { + arrayIndex = res.arrayIndex, + resultIndex = i, + rtStyle = res.rtStyle, + osStyle = res.osStyle, + }; + processedResults.Add(ProcessResponseTimeData(data, resSel, startDelay, processedGamma)); + } + return processedResults; + } + public List> ProcessAllResults(List> data, resultSelection res, int startDelay, List processedGamma) + { + List> multipleProcessedResults = new List>(); + for (int k = 0; k < data.Count; k++) + { + List processedResults = new List(); + for (int i = 0; i < data[k].Count; i++) + { + resultSelection resSel = new resultSelection + { + arrayIndex = k, + resultIndex = i, + rtStyle = res.rtStyle, + osStyle = res.osStyle, + }; + processedResults.Add(ProcessResponseTimeData(data, resSel, startDelay, processedGamma)); + } + multipleProcessedResults.Add(processedResults); + } + return multipleProcessedResults; + } + + public static double GetMedian(double[] sourceNumbers) + { + //Framework 2.0 version of this method. there is an easier way in F4 + if (sourceNumbers == null || sourceNumbers.Length == 0) + throw new System.Exception("Median of empty array not defined."); + + //make sure the list is sorted, but use a new array + double[] sortedPNumbers = (double[])sourceNumbers.Clone(); + Array.Sort(sortedPNumbers); + + //get the median + int size = sortedPNumbers.Length; + int mid = size / 2; + double median = (size % 2 != 0) ? (double)sortedPNumbers[mid] : ((double)sortedPNumbers[mid] + (double)sortedPNumbers[mid - 1]) / 2; + return median; + } + public List AverageMultipleRuns(List> multipleRunData, osMethods os) + { + int resultCount = multipleRunData[0].Count(); + List averageData = new List(); + + // Average the data, excluding outliers + for (int k = 0; k < resultCount; k++) + { + processedResult res = new processedResult(); + List rTLine = new List(); + List initRTLine = new List(); + List perRTLine = new List(); + List oSLine = new List(); + List vrrLine = new List(); + List iLLine = new List(); + foreach (var list in multipleRunData) + { + rTLine.Add(list[k].compTime); + initRTLine.Add(list[k].initTime); + perRTLine.Add(list[k].perTime); + oSLine.Add(list[k].Overshoot); + vrrLine.Add(list[k].visualResponseRating); + iLLine.Add(list[k].inputLag); + } + double rtMedian = GetMedian(rTLine.ToArray()); + double initRtMedian = GetMedian(initRTLine.ToArray()); + double perRtMedian = GetMedian(perRTLine.ToArray()); + double osMedian = GetMedian(oSLine.ToArray()); + double vrrMedian = GetMedian(vrrLine.ToArray()); + double ilMedian = GetMedian(iLLine.ToArray()); + int validTimeResults = 0; + int validInitialTimeResults = 0; + int validPerceivedTimeResults = 0; + int validOvershootResults = 0; + int validVRRResults = 0; + int validILResults = 0; + foreach (var o in multipleRunData) + { + if (o[k].compTime < (rtMedian * 1.2) && o[k].compTime > (rtMedian * 0.8)) + { + res.compTime += o[k].compTime; + validTimeResults++; + } + if (o[k].initTime < (initRtMedian * 1.2) && o[k].initTime > (initRtMedian * 0.8)) + { + res.initTime += o[k].initTime; + validInitialTimeResults++; + } + if (o[k].perTime < (perRtMedian * 1.2) && o[k].perTime > (perRtMedian * 0.8)) + { + res.perTime += o[k].perTime; + validPerceivedTimeResults++; + } + if (o[k].Overshoot < (osMedian * 1.2) && o[k].Overshoot > (osMedian * 0.8) && o[k].Overshoot != 0) + { + res.Overshoot += o[k].Overshoot; + validOvershootResults++; + } + if (o[k].visualResponseRating < (vrrMedian * 1.2) && o[k].visualResponseRating > (vrrMedian * 0.8)) + { + res.visualResponseRating += o[k].visualResponseRating; + validVRRResults++; + } + if (o[k].inputLag < (ilMedian * 1.2) && o[k].inputLag > (ilMedian * 0.8)) + { + res.inputLag += o[k].inputLag; + validILResults++; + } + } + res.StartingRGB = multipleRunData[0][k].StartingRGB; + res.EndRGB = multipleRunData[0][k].EndRGB; + res.compTime = res.compTime / validTimeResults; + res.compTime = Math.Round(res.compTime, 1); + res.initTime = res.initTime / validInitialTimeResults; + res.initTime = Math.Round(res.initTime, 1); + res.perTime = res.perTime / validPerceivedTimeResults; + res.perTime = Math.Round(res.perTime, 1); + if (res.Overshoot != 0) + { + res.Overshoot = res.Overshoot / validOvershootResults; + if (os.gammaCorrected && (!os.endPercent || !os.rangePercent)) + { + res.Overshoot = Math.Round(res.Overshoot, 0); + } + else + { + res.Overshoot = Math.Round(res.Overshoot, 1); + } + } + res.visualResponseRating = res.visualResponseRating / validVRRResults; + res.visualResponseRating = Math.Round(res.visualResponseRating, 1); + res.inputLag = res.inputLag / validILResults; + res.inputLag = Math.Round(res.inputLag, 1); + averageData.Add(res); + } + return averageData; + } + + ///////////////////////////////////////////////////////////////////////////// + // Input Lag + //////////////////////////////////////////////////////////////////////////// + + + public class rawInputLagResult + { + public double ClickTime { get; set; } + public int TimeTaken { get; set; } + public int SampleCount { get; set; } + public double SampleTime { get; set; } + public List Samples { get; set; } + } + public class inputLagResult + { + public int shotNumber { get; set; } + public double clickTimeMs { get; set; } + public double inputLag { get; set; } + public double totalInputLag { get; set; } + } + + public List processInputLagData(List inputLagRawData) + { + List inputLagProcessed = new List(); + + int shotNumber = 1; + foreach (rawInputLagResult item in inputLagRawData) + { + // Save start, end, time and sample count then clear the values from the array + double ClickTime = item.ClickTime; + int TimeTaken = item.TimeTaken; + int SampleCount = item.SampleCount; + int[] samples = item.Samples.ToArray(); + + double SampleTime = ((double)TimeTaken / (double)SampleCount); // Get the time taken between samples + + // Clean up noisy data using moving average function + int period = 20; + int[] buffer = new int[period]; + int[] averagedSamples = new int[samples.Length]; + int current_index = 0; + for (int a = 0; a < samples.Length; a++) + { + buffer[current_index] = samples[a] / period; + int movAvg = 0; + for (int b = 0; b < period; b++) + { + movAvg += buffer[b]; + } + averagedSamples[a] = movAvg; + current_index = (current_index + 1) % period; + } + + samples = averagedSamples.Skip(period).ToArray(); //Moving average spoils the first 10 samples so currently removing them. + + // Initialise in-use variables + int transStart = 0; + + int startMax = samples[5]; // Initialise these variables with a real value + int startMin = samples[5]; // Initialise these variables with a real value + int endMax = samples[samples.Length - 10]; // Initialise these variables with a real value + int endMin = samples[samples.Length - 10]; // Initialise these variables with a real value + + // Build start min/max to compare against + for (int l = 0; l < 250; l++) //CHANGE TO 180 FOR RUN 2 DATA + { + if (samples[l] < startMin) + { + startMin = samples[l]; + } + else if (samples[l] > startMax) + { + startMax = samples[l]; + } + } + + // Build end min/max to compare against + for (int m = samples.Length - 5; m > samples.Length - 450; m--) + { + if (samples[m] < endMin) + { + endMin = samples[m]; + } + else if (samples[m] > endMax) + { + endMax = samples[m]; + } + } + + // Search for where the result starts transitioning - start is almost always less sensitive + for (int j = 0; j < samples.Length; j++) + { + if (samples[j] > (startMax)) + { + if ((samples[j + 50] > (samples[j] + 50) || samples[j + 56] > (samples[j] + 50)) + && (samples[j + 100] > (samples[j] + 100) || samples[j + 106] > (samples[j] + 100)) + && (samples[j + 125] > (samples[j] + 100) || samples[j + 131] > (samples[j] + 100)) + && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise + { + transStart = j; + break; + } + else + { + if (samples[j] > startMax) + { + startMax = samples[j]; + } + } + } + } + + Console.WriteLine("ClickTime: " + ClickTime); + double clickTimeMs = ClickTime; + clickTimeMs /= 1000; + Console.WriteLine("ClickTimems: " + clickTimeMs); + double transTime = (transStart * SampleTime) / 1000; + double inputLag = Math.Round(transTime, 3); + + double totalInputLag = (ClickTime + (transStart * SampleTime)) / 1000; + totalInputLag = Math.Round(totalInputLag, 3); + + inputLagResult completeResult = new inputLagResult { shotNumber = shotNumber, clickTimeMs = clickTimeMs, inputLag = inputLag, totalInputLag = totalInputLag }; + inputLagProcessed.Add(completeResult); + shotNumber++; + } + return inputLagProcessed; + } + + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/Properties/Resources.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Properties/Resources.Designer.cs index e3132b8..875fe2a 100644 --- a/OSRTT Launcher/OSRTT Launcher/Properties/Resources.Designer.cs +++ b/OSRTT Launcher/OSRTT Launcher/Properties/Resources.Designer.cs @@ -60,6 +60,26 @@ internal Resources() { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_rotate_right { + get { + object obj = ResourceManager.GetObject("arrow_rotate_right", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap check { + get { + object obj = ResourceManager.GetObject("check", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/OSRTT Launcher/OSRTT Launcher/Properties/Resources.resx b/OSRTT Launcher/OSRTT Launcher/Properties/Resources.resx index b118d1c..3af2a00 100644 --- a/OSRTT Launcher/OSRTT Launcher/Properties/Resources.resx +++ b/OSRTT Launcher/OSRTT Launcher/Properties/Resources.resx @@ -118,6 +118,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\arrow-rotate-right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\check.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icon_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/OSRTT Launcher/OSRTT Launcher/Properties/Settings.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Properties/Settings.Designer.cs index ae544fc..dcbfd83 100644 --- a/OSRTT Launcher/OSRTT Launcher/Properties/Settings.Designer.cs +++ b/OSRTT Launcher/OSRTT Launcher/Properties/Settings.Designer.cs @@ -59,66 +59,6 @@ public bool Verbose { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool threePercentSetting { - get { - return ((bool)(this["threePercentSetting"])); - } - set { - this["threePercentSetting"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool tenPercentSetting { - get { - return ((bool)(this["tenPercentSetting"])); - } - set { - this["tenPercentSetting"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool gammaCorrectedSetting { - get { - return ((bool)(this["gammaCorrectedSetting"])); - } - set { - this["gammaCorrectedSetting"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool gammaPercentSetting { - get { - return ((bool)(this["gammaPercentSetting"])); - } - set { - this["gammaPercentSetting"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool gammaCorrRT { - get { - return ((bool)(this["gammaCorrRT"])); - } - set { - this["gammaCorrRT"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -155,30 +95,6 @@ public bool USBOutput { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool RGB10Offset { - get { - return ((bool)(this["RGB10Offset"])); - } - set { - this["RGB10Offset"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool RGB5Offset { - get { - return ((bool)(this["RGB5Offset"])); - } - set { - this["RGB5Offset"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -205,7 +121,7 @@ public bool SuppressDiagBox { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] + [global::System.Configuration.DefaultSettingValueAttribute("False")] public bool saveXLSX { get { return ((bool)(this["saveXLSX"])); @@ -325,10 +241,10 @@ public bool ignoreErrors { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int VSyncState { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool VSyncState { get { - return ((int)(this["VSyncState"])); + return ((bool)(this["VSyncState"])); } set { this["VSyncState"] = value; @@ -373,7 +289,7 @@ public string osKey { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("95, 85, 75")] + [global::System.Configuration.DefaultSettingValueAttribute("75, 85, 95")] public string vrrKey { get { return ((string)(this["vrrKey"])); @@ -382,5 +298,125 @@ public string vrrKey { this["vrrKey"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("RGB 5 Tolerance")] + public string rtName { + get { + return ((string)(this["rtName"])); + } + set { + this["rtName"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("5")] + public int rtTolerance { + get { + return ((int)(this["rtTolerance"])); + } + set { + this["rtTolerance"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool rtGammaCorrected { + get { + return ((bool)(this["rtGammaCorrected"])); + } + set { + this["rtGammaCorrected"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool rtPercentage { + get { + return ((bool)(this["rtPercentage"])); + } + set { + this["rtPercentage"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("RGB Values")] + public string osName { + get { + return ((string)(this["osName"])); + } + set { + this["osName"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool osEndPercent { + get { + return ((bool)(this["osEndPercent"])); + } + set { + this["osEndPercent"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool osRangePercent { + get { + return ((bool)(this["osRangePercent"])); + } + set { + this["osRangePercent"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool osGammaCorrected { + get { + return ((bool)(this["osGammaCorrected"])); + } + set { + this["osGammaCorrected"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool shareResults { + get { + return ((bool)(this["shareResults"])); + } + set { + this["shareResults"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string serialNumber { + get { + return ((string)(this["serialNumber"])); + } + set { + this["serialNumber"] = value; + } + } } } diff --git a/OSRTT Launcher/OSRTT Launcher/Properties/Settings.settings b/OSRTT Launcher/OSRTT Launcher/Properties/Settings.settings index 8f43aee..f192748 100644 --- a/OSRTT Launcher/OSRTT Launcher/Properties/Settings.settings +++ b/OSRTT Launcher/OSRTT Launcher/Properties/Settings.settings @@ -11,21 +11,6 @@ False - - False - - - False - - - True - - - False - - - True - False @@ -35,12 +20,6 @@ False - - False - - - True - False @@ -48,7 +27,7 @@ False - True + False False @@ -77,8 +56,8 @@ True - - 0 + + True True @@ -90,7 +69,37 @@ 5,15,20 - 95, 85, 75 + 75, 85, 95 + + + RGB 5 Tolerance + + + 5 + + + True + + + False + + + RGB Values + + + False + + + False + + + True + + + True + + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/Resources/arrow-rotate-right.png b/OSRTT Launcher/OSRTT Launcher/Resources/arrow-rotate-right.png new file mode 100644 index 0000000..b563f54 Binary files /dev/null and b/OSRTT Launcher/OSRTT Launcher/Resources/arrow-rotate-right.png differ diff --git a/OSRTT Launcher/OSRTT Launcher/Resources/check.png b/OSRTT Launcher/OSRTT Launcher/Resources/check.png new file mode 100644 index 0000000..9e3cdcd Binary files /dev/null and b/OSRTT Launcher/OSRTT Launcher/Resources/check.png differ diff --git a/OSRTT Launcher/OSRTT Launcher/Results.Designer.cs b/OSRTT Launcher/OSRTT Launcher/Results.Designer.cs new file mode 100644 index 0000000..3776cf4 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Results.Designer.cs @@ -0,0 +1,61 @@ +namespace OSRTT_Launcher +{ + partial class Results + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.importBtn = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // importBtn + // + this.importBtn.Font = new System.Drawing.Font("Arial Black", 16F, System.Drawing.FontStyle.Bold); + this.importBtn.Location = new System.Drawing.Point(12, 12); + this.importBtn.Name = "importBtn"; + this.importBtn.Size = new System.Drawing.Size(237, 75); + this.importBtn.TabIndex = 1; + this.importBtn.Text = "Import CSV"; + this.importBtn.UseVisualStyleBackColor = true; + this.importBtn.Click += new System.EventHandler(this.importBtn_Click); + // + // Results + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.importBtn); + this.Name = "Results"; + this.Text = "Results"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button importBtn; + } +} \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/Results.cs b/OSRTT Launcher/OSRTT Launcher/Results.cs new file mode 100644 index 0000000..2f6e5e5 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Results.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OSRTT_Launcher +{ + public partial class Results : Form + { + public Results() + { + InitializeComponent(); + } + + private void importBtn_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/Results.resx b/OSRTT Launcher/OSRTT Launcher/Results.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/Results.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsSettings.Designer.cs b/OSRTT Launcher/OSRTT Launcher/ResultsSettings.Designer.cs new file mode 100644 index 0000000..7e19cc1 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/ResultsSettings.Designer.cs @@ -0,0 +1,681 @@ + +namespace OSRTT_Launcher +{ + partial class ResultsSettings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel2 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.toleranceStyleSelect = new System.Windows.Forms.ComboBox(); + this.tolerancePanel = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.testSettingsPanel = new System.Windows.Forms.Panel(); + this.label6 = new System.Windows.Forms.Label(); + this.settingsPresetSelect = new System.Windows.Forms.ComboBox(); + this.overshootStylePanel = new System.Windows.Forms.Panel(); + this.label10 = new System.Windows.Forms.Label(); + this.osPercentSelect = new System.Windows.Forms.ComboBox(); + this.overshootSourcePanel = new System.Windows.Forms.Panel(); + this.label9 = new System.Windows.Forms.Label(); + this.osGammaSelect = new System.Windows.Forms.ComboBox(); + this.toleranceLevelPanel = new System.Windows.Forms.Panel(); + this.Per10Btn = new OSRTT_Launcher.RoundButton(); + this.Per3Btn = new OSRTT_Launcher.RoundButton(); + this.RGB10Btn = new OSRTT_Launcher.RoundButton(); + this.RGB5Btn = new OSRTT_Launcher.RoundButton(); + this.label5 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label8 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.gammaPanel = new System.Windows.Forms.Panel(); + this.label11 = new System.Windows.Forms.Label(); + this.saveGammaTableSelect = new System.Windows.Forms.ComboBox(); + this.errorsPanel = new System.Windows.Forms.Panel(); + this.label12 = new System.Windows.Forms.Label(); + this.ignoreErrorsSelect = new System.Windows.Forms.ComboBox(); + this.label13 = new System.Windows.Forms.Label(); + this.panel10 = new System.Windows.Forms.Panel(); + this.label14 = new System.Windows.Forms.Label(); + this.suppressMessageBoxPanel = new System.Windows.Forms.Panel(); + this.label15 = new System.Windows.Forms.Label(); + this.suppressMsgBoxSelect = new System.Windows.Forms.ComboBox(); + this.saveToExcelPanel = new System.Windows.Forms.Panel(); + this.label16 = new System.Windows.Forms.Label(); + this.saveToExcelSelect = new System.Windows.Forms.ComboBox(); + this.saveLabel = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.label17 = new System.Windows.Forms.Label(); + this.shareDataSelect = new System.Windows.Forms.ComboBox(); + this.panel2.SuspendLayout(); + this.tolerancePanel.SuspendLayout(); + this.testSettingsPanel.SuspendLayout(); + this.overshootStylePanel.SuspendLayout(); + this.overshootSourcePanel.SuspendLayout(); + this.toleranceLevelPanel.SuspendLayout(); + this.panel1.SuspendLayout(); + this.gammaPanel.SuspendLayout(); + this.errorsPanel.SuspendLayout(); + this.panel10.SuspendLayout(); + this.suppressMessageBoxPanel.SuspendLayout(); + this.saveToExcelPanel.SuspendLayout(); + this.panel3.SuspendLayout(); + this.SuspendLayout(); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Khaki; + this.panel2.Controls.Add(this.label1); + this.panel2.Location = new System.Drawing.Point(12, 340); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(356, 54); + this.panel2.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.Black; + this.label1.Location = new System.Drawing.Point(4, 11); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(337, 32); + this.label1.TabIndex = 11; + this.label1.Text = "Response Time Settings"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label3.Location = new System.Drawing.Point(16, 403); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(348, 130); + this.label3.TabIndex = 11; + this.label3.Text = "Adjust how you would like data\r\nfrom the Response Time Test to\r\nbe processed. Gam" + + "ma Correction\r\nis required for measurements to\r\nuse RGB values as their toleranc" + + "e."; + // + // toleranceStyleSelect + // + this.toleranceStyleSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.toleranceStyleSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.toleranceStyleSelect.FormattingEnabled = true; + this.toleranceStyleSelect.Location = new System.Drawing.Point(198, 8); + this.toleranceStyleSelect.Name = "toleranceStyleSelect"; + this.toleranceStyleSelect.Size = new System.Drawing.Size(402, 33); + this.toleranceStyleSelect.TabIndex = 21; + this.toleranceStyleSelect.SelectedIndexChanged += new System.EventHandler(this.toleranceStyleSelect_SelectedIndexChanged); + // + // tolerancePanel + // + this.tolerancePanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.tolerancePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.tolerancePanel.Controls.Add(this.label4); + this.tolerancePanel.Controls.Add(this.toleranceStyleSelect); + this.tolerancePanel.Location = new System.Drawing.Point(386, 340); + this.tolerancePanel.Name = "tolerancePanel"; + this.tolerancePanel.Size = new System.Drawing.Size(615, 50); + this.tolerancePanel.TabIndex = 22; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Arial", 18F); + this.label4.Location = new System.Drawing.Point(9, 11); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(183, 27); + this.label4.TabIndex = 22; + this.label4.Text = "Tolerance Style:"; + // + // testSettingsPanel + // + this.testSettingsPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.testSettingsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.testSettingsPanel.Controls.Add(this.label6); + this.testSettingsPanel.Controls.Add(this.settingsPresetSelect); + this.testSettingsPanel.Location = new System.Drawing.Point(386, 57); + this.testSettingsPanel.Name = "testSettingsPanel"; + this.testSettingsPanel.Size = new System.Drawing.Size(615, 54); + this.testSettingsPanel.TabIndex = 23; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("Arial", 18F); + this.label6.Location = new System.Drawing.Point(10, 12); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(233, 27); + this.label6.TabIndex = 23; + this.label6.Text = "Test Settings Preset:"; + // + // settingsPresetSelect + // + this.settingsPresetSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.settingsPresetSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.settingsPresetSelect.FormattingEnabled = true; + this.settingsPresetSelect.Location = new System.Drawing.Point(249, 9); + this.settingsPresetSelect.Name = "settingsPresetSelect"; + this.settingsPresetSelect.Size = new System.Drawing.Size(351, 33); + this.settingsPresetSelect.TabIndex = 21; + this.settingsPresetSelect.SelectedIndexChanged += new System.EventHandler(this.settingsPresetSelect_SelectedIndexChanged); + // + // overshootStylePanel + // + this.overshootStylePanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.overshootStylePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.overshootStylePanel.Controls.Add(this.label10); + this.overshootStylePanel.Controls.Add(this.osPercentSelect); + this.overshootStylePanel.Location = new System.Drawing.Point(386, 616); + this.overshootStylePanel.Name = "overshootStylePanel"; + this.overshootStylePanel.Size = new System.Drawing.Size(615, 50); + this.overshootStylePanel.TabIndex = 24; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("Arial", 18F); + this.label10.Location = new System.Drawing.Point(10, 11); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(190, 27); + this.label10.TabIndex = 24; + this.label10.Text = "Overshoot Style:"; + // + // osPercentSelect + // + this.osPercentSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.osPercentSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osPercentSelect.FormattingEnabled = true; + this.osPercentSelect.Location = new System.Drawing.Point(206, 8); + this.osPercentSelect.Name = "osPercentSelect"; + this.osPercentSelect.Size = new System.Drawing.Size(394, 32); + this.osPercentSelect.TabIndex = 21; + this.osPercentSelect.SelectedIndexChanged += new System.EventHandler(this.osPercentSelect_SelectedIndexChanged); + // + // overshootSourcePanel + // + this.overshootSourcePanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.overshootSourcePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.overshootSourcePanel.Controls.Add(this.label9); + this.overshootSourcePanel.Controls.Add(this.osGammaSelect); + this.overshootSourcePanel.Location = new System.Drawing.Point(386, 567); + this.overshootSourcePanel.Name = "overshootSourcePanel"; + this.overshootSourcePanel.Size = new System.Drawing.Size(615, 50); + this.overshootSourcePanel.TabIndex = 25; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Arial", 18F); + this.label9.Location = new System.Drawing.Point(10, 11); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(212, 27); + this.label9.TabIndex = 23; + this.label9.Text = "Overshoot Source:"; + // + // osGammaSelect + // + this.osGammaSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.osGammaSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.osGammaSelect.FormattingEnabled = true; + this.osGammaSelect.Location = new System.Drawing.Point(228, 8); + this.osGammaSelect.Name = "osGammaSelect"; + this.osGammaSelect.Size = new System.Drawing.Size(372, 32); + this.osGammaSelect.TabIndex = 21; + this.osGammaSelect.SelectedIndexChanged += new System.EventHandler(this.osGammaSelect_SelectedIndexChanged); + // + // toleranceLevelPanel + // + this.toleranceLevelPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.toleranceLevelPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.toleranceLevelPanel.Controls.Add(this.Per10Btn); + this.toleranceLevelPanel.Controls.Add(this.Per3Btn); + this.toleranceLevelPanel.Controls.Add(this.RGB10Btn); + this.toleranceLevelPanel.Controls.Add(this.RGB5Btn); + this.toleranceLevelPanel.Controls.Add(this.label5); + this.toleranceLevelPanel.Location = new System.Drawing.Point(386, 389); + this.toleranceLevelPanel.Name = "toleranceLevelPanel"; + this.toleranceLevelPanel.Size = new System.Drawing.Size(615, 100); + this.toleranceLevelPanel.TabIndex = 25; + // + // Per10Btn + // + this.Per10Btn.BackColor = System.Drawing.Color.SteelBlue; + this.Per10Btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Per10Btn.ForeColor = System.Drawing.Color.White; + this.Per10Btn.Location = new System.Drawing.Point(465, 43); + this.Per10Btn.Name = "Per10Btn"; + this.Per10Btn.Size = new System.Drawing.Size(135, 45); + this.Per10Btn.TabIndex = 34; + this.Per10Btn.Text = "10% Light Level"; + this.Per10Btn.UseVisualStyleBackColor = false; + this.Per10Btn.Click += new System.EventHandler(this.Per10Btn_Click); + // + // Per3Btn + // + this.Per3Btn.BackColor = System.Drawing.Color.SteelBlue; + this.Per3Btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Per3Btn.ForeColor = System.Drawing.Color.White; + this.Per3Btn.Location = new System.Drawing.Point(315, 43); + this.Per3Btn.Name = "Per3Btn"; + this.Per3Btn.Size = new System.Drawing.Size(135, 45); + this.Per3Btn.TabIndex = 33; + this.Per3Btn.Text = "3% RGB Value"; + this.Per3Btn.UseVisualStyleBackColor = false; + this.Per3Btn.Click += new System.EventHandler(this.Per3Btn_Click); + // + // RGB10Btn + // + this.RGB10Btn.BackColor = System.Drawing.Color.SteelBlue; + this.RGB10Btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.RGB10Btn.ForeColor = System.Drawing.Color.White; + this.RGB10Btn.Location = new System.Drawing.Point(165, 43); + this.RGB10Btn.Name = "RGB10Btn"; + this.RGB10Btn.Size = new System.Drawing.Size(135, 45); + this.RGB10Btn.TabIndex = 32; + this.RGB10Btn.Text = "Fixed RGB 10"; + this.RGB10Btn.UseVisualStyleBackColor = false; + this.RGB10Btn.Click += new System.EventHandler(this.RGB10Btn_Click); + // + // RGB5Btn + // + this.RGB5Btn.BackColor = System.Drawing.Color.LimeGreen; + this.RGB5Btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.RGB5Btn.ForeColor = System.Drawing.Color.White; + this.RGB5Btn.Location = new System.Drawing.Point(15, 43); + this.RGB5Btn.Name = "RGB5Btn"; + this.RGB5Btn.Size = new System.Drawing.Size(135, 45); + this.RGB5Btn.TabIndex = 31; + this.RGB5Btn.Text = "Fixed RGB 5"; + this.RGB5Btn.UseVisualStyleBackColor = false; + this.RGB5Btn.Click += new System.EventHandler(this.RGB5Btn_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Arial", 18F); + this.label5.Location = new System.Drawing.Point(9, 9); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(185, 27); + this.label5.TabIndex = 23; + this.label5.Text = "Tolerance Level:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label7.Location = new System.Drawing.Point(16, 630); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(335, 130); + this.label7.TabIndex = 13; + this.label7.Text = "Adjust how you would like the\r\nOvershoot data to be calculated\r\nand reported. Gam" + + "ma corrected\r\nmeans using RGB values instead\r\nof raw light level."; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Khaki; + this.panel1.Controls.Add(this.label8); + this.panel1.Location = new System.Drawing.Point(12, 567); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(356, 54); + this.panel1.TabIndex = 12; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label8.ForeColor = System.Drawing.Color.Black; + this.label8.Location = new System.Drawing.Point(4, 10); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(268, 32); + this.label8.TabIndex = 11; + this.label8.Text = "Overshoot Settings"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label2.Location = new System.Drawing.Point(12, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(121, 31); + this.label2.TabIndex = 10; + this.label2.Text = "Settings"; + // + // gammaPanel + // + this.gammaPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.gammaPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.gammaPanel.Controls.Add(this.label11); + this.gammaPanel.Controls.Add(this.saveGammaTableSelect); + this.gammaPanel.Location = new System.Drawing.Point(386, 488); + this.gammaPanel.Name = "gammaPanel"; + this.gammaPanel.Size = new System.Drawing.Size(615, 50); + this.gammaPanel.TabIndex = 26; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("Arial", 18F); + this.label11.Location = new System.Drawing.Point(9, 10); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(228, 27); + this.label11.TabIndex = 22; + this.label11.Text = "Save Gamma Table:"; + // + // saveGammaTableSelect + // + this.saveGammaTableSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.saveGammaTableSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.saveGammaTableSelect.FormattingEnabled = true; + this.saveGammaTableSelect.Location = new System.Drawing.Point(249, 7); + this.saveGammaTableSelect.Name = "saveGammaTableSelect"; + this.saveGammaTableSelect.Size = new System.Drawing.Size(351, 33); + this.saveGammaTableSelect.TabIndex = 21; + this.saveGammaTableSelect.SelectedIndexChanged += new System.EventHandler(this.saveGammaTableSelect_SelectedIndexChanged); + // + // errorsPanel + // + this.errorsPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.errorsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.errorsPanel.Controls.Add(this.label12); + this.errorsPanel.Controls.Add(this.ignoreErrorsSelect); + this.errorsPanel.Location = new System.Drawing.Point(386, 171); + this.errorsPanel.Name = "errorsPanel"; + this.errorsPanel.Size = new System.Drawing.Size(615, 50); + this.errorsPanel.TabIndex = 27; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("Arial", 18F); + this.label12.Location = new System.Drawing.Point(9, 11); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(256, 27); + this.label12.TabIndex = 22; + this.label12.Text = "Ignore Mid Run Errors:"; + // + // ignoreErrorsSelect + // + this.ignoreErrorsSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.ignoreErrorsSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ignoreErrorsSelect.FormattingEnabled = true; + this.ignoreErrorsSelect.Location = new System.Drawing.Point(271, 8); + this.ignoreErrorsSelect.Name = "ignoreErrorsSelect"; + this.ignoreErrorsSelect.Size = new System.Drawing.Size(329, 33); + this.ignoreErrorsSelect.TabIndex = 21; + this.ignoreErrorsSelect.SelectedIndexChanged += new System.EventHandler(this.ignoreErrorsSelect_SelectedIndexChanged); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.label13.Location = new System.Drawing.Point(14, 114); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(364, 88); + this.label13.TabIndex = 29; + this.label13.Text = "Recommended Settings include a fixed \r\nRGB 5 tolerance and RGB value overshoot. \r" + + "\nRunning into errors? Try enabling the\r\nignore mid run errors setting!"; + // + // panel10 + // + this.panel10.BackColor = System.Drawing.Color.Khaki; + this.panel10.Controls.Add(this.label14); + this.panel10.Location = new System.Drawing.Point(12, 57); + this.panel10.Name = "panel10"; + this.panel10.Size = new System.Drawing.Size(356, 54); + this.panel10.TabIndex = 28; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font("Arial", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label14.ForeColor = System.Drawing.Color.Black; + this.label14.Location = new System.Drawing.Point(4, 11); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(186, 32); + this.label14.TabIndex = 11; + this.label14.Text = "Test Settings"; + // + // suppressMessageBoxPanel + // + this.suppressMessageBoxPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.suppressMessageBoxPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.suppressMessageBoxPanel.Controls.Add(this.label15); + this.suppressMessageBoxPanel.Controls.Add(this.suppressMsgBoxSelect); + this.suppressMessageBoxPanel.Location = new System.Drawing.Point(386, 220); + this.suppressMessageBoxPanel.Name = "suppressMessageBoxPanel"; + this.suppressMessageBoxPanel.Size = new System.Drawing.Size(615, 50); + this.suppressMessageBoxPanel.TabIndex = 30; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Font = new System.Drawing.Font("Arial", 18F); + this.label15.Location = new System.Drawing.Point(10, 10); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(297, 27); + this.label15.TabIndex = 22; + this.label15.Text = "Suppress Message Boxes:"; + // + // suppressMsgBoxSelect + // + this.suppressMsgBoxSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.suppressMsgBoxSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.suppressMsgBoxSelect.FormattingEnabled = true; + this.suppressMsgBoxSelect.Location = new System.Drawing.Point(312, 7); + this.suppressMsgBoxSelect.Name = "suppressMsgBoxSelect"; + this.suppressMsgBoxSelect.Size = new System.Drawing.Size(288, 33); + this.suppressMsgBoxSelect.TabIndex = 21; + this.suppressMsgBoxSelect.SelectedIndexChanged += new System.EventHandler(this.suppressMsgBoxSelect_SelectedIndexChanged); + // + // saveToExcelPanel + // + this.saveToExcelPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.saveToExcelPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.saveToExcelPanel.Controls.Add(this.label16); + this.saveToExcelPanel.Controls.Add(this.saveToExcelSelect); + this.saveToExcelPanel.Location = new System.Drawing.Point(386, 269); + this.saveToExcelPanel.Name = "saveToExcelPanel"; + this.saveToExcelPanel.Size = new System.Drawing.Size(615, 50); + this.saveToExcelPanel.TabIndex = 31; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Font = new System.Drawing.Font("Arial", 18F); + this.label16.Location = new System.Drawing.Point(9, 10); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(280, 27); + this.label16.TabIndex = 22; + this.label16.Text = "Save to Excel Heatmaps:"; + // + // saveToExcelSelect + // + this.saveToExcelSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.saveToExcelSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.saveToExcelSelect.FormattingEnabled = true; + this.saveToExcelSelect.Location = new System.Drawing.Point(293, 7); + this.saveToExcelSelect.Name = "saveToExcelSelect"; + this.saveToExcelSelect.Size = new System.Drawing.Size(307, 33); + this.saveToExcelSelect.TabIndex = 21; + this.saveToExcelSelect.SelectedIndexChanged += new System.EventHandler(this.saveToExcelSelect_SelectedIndexChanged); + // + // saveLabel + // + this.saveLabel.AutoSize = true; + this.saveLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.saveLabel.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.saveLabel.Location = new System.Drawing.Point(805, 14); + this.saveLabel.Name = "saveLabel"; + this.saveLabel.Size = new System.Drawing.Size(196, 29); + this.saveLabel.TabIndex = 32; + this.saveLabel.Text = "Changes Saved"; + // + // panel3 + // + this.panel3.BackColor = System.Drawing.SystemColors.ButtonFace; + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel3.Controls.Add(this.label17); + this.panel3.Controls.Add(this.shareDataSelect); + this.panel3.Location = new System.Drawing.Point(386, 122); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(615, 50); + this.panel3.TabIndex = 33; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("Arial", 18F); + this.label17.Location = new System.Drawing.Point(9, 11); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(270, 27); + this.label17.TabIndex = 22; + this.label17.Text = "Share Raw Result Data:"; + // + // shareDataSelect + // + this.shareDataSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.shareDataSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.shareDataSelect.FormattingEnabled = true; + this.shareDataSelect.Location = new System.Drawing.Point(285, 8); + this.shareDataSelect.Name = "shareDataSelect"; + this.shareDataSelect.Size = new System.Drawing.Size(315, 33); + this.shareDataSelect.TabIndex = 21; + this.shareDataSelect.SelectedIndexChanged += new System.EventHandler(this.shareDataSelect_SelectedIndexChanged); + // + // ResultsSettings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlDark; + this.ClientSize = new System.Drawing.Size(1018, 775); + this.Controls.Add(this.panel3); + this.Controls.Add(this.saveLabel); + this.Controls.Add(this.saveToExcelPanel); + this.Controls.Add(this.suppressMessageBoxPanel); + this.Controls.Add(this.label13); + this.Controls.Add(this.panel10); + this.Controls.Add(this.errorsPanel); + this.Controls.Add(this.gammaPanel); + this.Controls.Add(this.label7); + this.Controls.Add(this.panel1); + this.Controls.Add(this.toleranceLevelPanel); + this.Controls.Add(this.tolerancePanel); + this.Controls.Add(this.testSettingsPanel); + this.Controls.Add(this.overshootSourcePanel); + this.Controls.Add(this.overshootStylePanel); + this.Controls.Add(this.label3); + this.Controls.Add(this.panel2); + this.Controls.Add(this.label2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.Name = "ResultsSettings"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Test & Results Settings"; + this.Load += new System.EventHandler(this.ResultsSettings_Load); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.tolerancePanel.ResumeLayout(false); + this.tolerancePanel.PerformLayout(); + this.testSettingsPanel.ResumeLayout(false); + this.testSettingsPanel.PerformLayout(); + this.overshootStylePanel.ResumeLayout(false); + this.overshootStylePanel.PerformLayout(); + this.overshootSourcePanel.ResumeLayout(false); + this.overshootSourcePanel.PerformLayout(); + this.toleranceLevelPanel.ResumeLayout(false); + this.toleranceLevelPanel.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.gammaPanel.ResumeLayout(false); + this.gammaPanel.PerformLayout(); + this.errorsPanel.ResumeLayout(false); + this.errorsPanel.PerformLayout(); + this.panel10.ResumeLayout(false); + this.panel10.PerformLayout(); + this.suppressMessageBoxPanel.ResumeLayout(false); + this.suppressMessageBoxPanel.PerformLayout(); + this.saveToExcelPanel.ResumeLayout(false); + this.saveToExcelPanel.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox toleranceStyleSelect; + private System.Windows.Forms.Panel tolerancePanel; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Panel testSettingsPanel; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.ComboBox settingsPresetSelect; + private System.Windows.Forms.Panel overshootStylePanel; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.ComboBox osPercentSelect; + private System.Windows.Forms.Panel overshootSourcePanel; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.ComboBox osGammaSelect; + private System.Windows.Forms.Panel toleranceLevelPanel; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Panel gammaPanel; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.ComboBox saveGammaTableSelect; + private System.Windows.Forms.Panel errorsPanel; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.ComboBox ignoreErrorsSelect; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Panel panel10; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Panel suppressMessageBoxPanel; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.ComboBox suppressMsgBoxSelect; + private RoundButton RGB5Btn; + private RoundButton Per10Btn; + private RoundButton Per3Btn; + private RoundButton RGB10Btn; + private System.Windows.Forms.Panel saveToExcelPanel; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.ComboBox saveToExcelSelect; + private System.Windows.Forms.Label saveLabel; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.ComboBox shareDataSelect; + } +} \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsSettings.cs b/OSRTT Launcher/OSRTT Launcher/ResultsSettings.cs new file mode 100644 index 0000000..276dc6d --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/ResultsSettings.cs @@ -0,0 +1,659 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Resources; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OSRTT_Launcher +{ + public partial class ResultsSettings : Form + { + private ResourceManager rm = OSRTT_Launcher.Properties.Resources.ResourceManager; + private Thread saveThread; + public ResultsSettings() + { + InitializeComponent(); + this.Icon = (Icon)rm.GetObject("osrttIcon"); + initSettingsPreset(); + initIgnoreErrors(); + initSupressErrors(); + initShareData(); + initToleranceStyle(); + initGammaTable(); + initSavetoExcelTable(); + initOvershootStyle(); + saveLabel.Visible = false; + } + + private void ResultsSettings_Load(object sender, EventArgs e) + { + + } + + private void SavingLabel() + { + this.saveLabel.Invoke((MethodInvoker)(() => this.saveLabel.Visible = true)); + Thread.Sleep(2500); + this.saveLabel.Invoke((MethodInvoker)(() => this.saveLabel.Visible = false)); + saveThread.Abort(); // I probably don't need to do this. Remind me to look up the documentation on this... + } + + private void initSettingsPreset() + { + settingsPresetSelect.Items.Clear(); + settingsPresetSelect.Items.Add("Recommended"); + settingsPresetSelect.Items.Add("Advanced"); + if (Properties.Settings.Default.advancedSettings) + { + settingsPresetSelect.SelectedIndex = 1; + } + else + { + settingsPresetSelect.SelectedIndex = 0; + tolerancePanel.Enabled = false; + toleranceLevelPanel.Enabled = false; + gammaPanel.Enabled = false; + overshootSourcePanel.Enabled = false; + overshootStylePanel.Enabled = false; + RGB5Btn.BackColor = Color.DarkSeaGreen; + RGB10Btn.BackColor = Color.SlateGray; + Per3Btn.BackColor = Color.SlateGray; + Per10Btn.BackColor = Color.SlateGray; + } + } + private void initIgnoreErrors() + { + ignoreErrorsSelect.Items.Clear(); + ignoreErrorsSelect.Items.Add("Yes"); + ignoreErrorsSelect.Items.Add("No"); + if (Properties.Settings.Default.ignoreErrors) + { + ignoreErrorsSelect.SelectedIndex = 0; + } + else + { + ignoreErrorsSelect.SelectedIndex = 1; + } + } + private void initSupressErrors() + { + suppressMsgBoxSelect.Items.Clear(); + suppressMsgBoxSelect.Items.Add("Yes"); + suppressMsgBoxSelect.Items.Add("No"); + if (Properties.Settings.Default.SuppressDiagBox) + { + suppressMsgBoxSelect.SelectedIndex = 0; + } + else + { + suppressMsgBoxSelect.SelectedIndex = 1; + } + } + private void initShareData() + { + shareDataSelect.Items.Clear(); + shareDataSelect.Items.Add("Yes"); + shareDataSelect.Items.Add("No"); + if (Properties.Settings.Default.shareResults) + { + shareDataSelect.SelectedIndex = 0; + } + else + { + shareDataSelect.SelectedIndex = 1; + } + } + private void initToleranceStyle() + { + toleranceStyleSelect.Items.Clear(); + toleranceStyleSelect.Items.Add("RGB Values (Gamma Corrected)"); + toleranceStyleSelect.Items.Add("Light Level"); + Color selected = Color.DarkSeaGreen; + Color notSelected = Color.SlateGray; + if (Properties.Settings.Default.advancedSettings) + { + selected = Color.LimeGreen; + notSelected = Color.SteelBlue; + } + RGB5Btn.BackColor = notSelected; + RGB10Btn.BackColor = notSelected; + Per3Btn.BackColor = notSelected; + Per10Btn.BackColor = notSelected; + if (Properties.Settings.Default.rtGammaCorrected) + { + toleranceStyleSelect.SelectedIndex = 0; + Per3Btn.Text = "3% RGB Value"; + Per10Btn.Text = "10% RGB Value"; + RGB5Btn.Enabled = true; + RGB10Btn.Enabled = true; + if (Properties.Settings.Default.rtTolerance == 5) + { + RGB5Btn.BackColor = selected; + RGB5Btn.ForeColor = Color.White; + } + else if (Properties.Settings.Default.rtTolerance == 10 && Properties.Settings.Default.rtPercentage) + { + Per10Btn.BackColor = selected; + Per10Btn.ForeColor = Color.White; + } + else if (Properties.Settings.Default.rtTolerance == 10 && !Properties.Settings.Default.rtPercentage) + { + RGB10Btn.BackColor = selected; + RGB10Btn.ForeColor = Color.White; + } + else + { + Per3Btn.BackColor = selected; + Per3Btn.ForeColor = Color.White; + } + } + else + { + toleranceStyleSelect.SelectedIndex = 1; + RGB5Btn.Enabled = false; + RGB5Btn.BackColor = Color.LightSlateGray; + RGB10Btn.Enabled = false; + RGB10Btn.BackColor = Color.LightSlateGray; + Per3Btn.Text = "3% Light Level"; + Per10Btn.Text = "10% Light Level"; + if (Properties.Settings.Default.rtTolerance == 3) + { + Per3Btn.BackColor = Color.LimeGreen; + Per3Btn.ForeColor = Color.White; + } + else + { + Per10Btn.BackColor = Color.LimeGreen; + Per10Btn.ForeColor = Color.White; + } + } + } + private void initGammaTable() + { + saveGammaTableSelect.Items.Clear(); + saveGammaTableSelect.Items.Add("Yes"); + saveGammaTableSelect.Items.Add("No"); + if (Properties.Settings.Default.saveGammaTable) + { + saveGammaTableSelect.SelectedIndex = 0; + } + else + { + saveGammaTableSelect.SelectedIndex = 1; + } + } + private void initSavetoExcelTable() + { + saveToExcelSelect.Items.Clear(); + saveToExcelSelect.Items.Add("Yes"); + saveToExcelSelect.Items.Add("No"); + if (Properties.Settings.Default.saveXLSX) + { + saveToExcelSelect.SelectedIndex = 0; + } + else + { + saveToExcelSelect.SelectedIndex = 1; + } + } + private void initOvershootStyle() + { + osPercentSelect.Items.Clear(); + osGammaSelect.Items.Clear(); + osGammaSelect.Items.Add("RGB Values (Gamma Corrected)"); + osGammaSelect.Items.Add("Light Level"); + if (Properties.Settings.Default.osGammaCorrected) + { + osGammaSelect.SelectedIndex = 0; + osPercentSelect.Items.Add("Raw RGB Values"); + osPercentSelect.Items.Add("Percent Over End RGB"); + osPercentSelect.Items.Add("Percent Over Transition Range"); + if (!Properties.Settings.Default.osRangePercent && !Properties.Settings.Default.osEndPercent) + { + osPercentSelect.SelectedIndex = 0; + } + else if (!Properties.Settings.Default.osRangePercent && Properties.Settings.Default.osEndPercent) + { + osPercentSelect.SelectedIndex = 1; + } + else + { + osPercentSelect.SelectedIndex = 2; + } + } + else + { + osGammaSelect.SelectedIndex = 1; + osPercentSelect.Items.Add("Percent Over End Light Level"); + osPercentSelect.Items.Add("Percent Over Transition Range"); + if (!Properties.Settings.Default.osRangePercent && Properties.Settings.Default.osEndPercent) + { + osPercentSelect.SelectedIndex = 0; + } + else + { + osPercentSelect.SelectedIndex = 1; + } + } + + } + private void settingsPresetSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (settingsPresetSelect.SelectedIndex == 0 && Properties.Settings.Default.advancedSettings) + { + Properties.Settings.Default.advancedSettings = false; + Properties.Settings.Default.rtName = "RGB 5 Tolerance"; + Properties.Settings.Default.rtTolerance = 5 ; + Properties.Settings.Default.rtGammaCorrected = true; + Properties.Settings.Default.rtPercentage = false; + Properties.Settings.Default.saveGammaTable = false; + Properties.Settings.Default.osName = "RGB Values"; + Properties.Settings.Default.osGammaCorrected = true; + Properties.Settings.Default.osEndPercent = false; + Properties.Settings.Default.osRangePercent = false; + tolerancePanel.Enabled = false; + toleranceLevelPanel.Enabled = false; + gammaPanel.Enabled = false; + overshootSourcePanel.Enabled = false; + overshootStylePanel.Enabled = false; + initOvershootStyle(); + initGammaTable(); + initSavetoExcelTable(); + } + else + { + Properties.Settings.Default.advancedSettings = true; + tolerancePanel.Enabled = true; + toleranceLevelPanel.Enabled = true; + gammaPanel.Enabled = true; + overshootSourcePanel.Enabled = true; + overshootStylePanel.Enabled = true; + } + Properties.Settings.Default.Save(); + initToleranceStyle(); + } + } + + private void ignoreErrorsSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (ignoreErrorsSelect.SelectedIndex == 0 && !Properties.Settings.Default.ignoreErrors) + { + Properties.Settings.Default.ignoreErrors = true; + } + else + { + Properties.Settings.Default.ignoreErrors = false; + } + Properties.Settings.Default.Save(); + } + } + + private void suppressMsgBoxSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (suppressMsgBoxSelect.SelectedIndex == 0 && !Properties.Settings.Default.SuppressDiagBox) + { + Properties.Settings.Default.SuppressDiagBox = true; + } + else + { + Properties.Settings.Default.SuppressDiagBox = false; + } + Properties.Settings.Default.Save(); + } + } + + + private void toleranceStyleSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (toleranceStyleSelect.SelectedIndex == 0 && !Properties.Settings.Default.rtGammaCorrected) + { + Per3Btn.Text = "3% RGB Value"; + Per10Btn.Text = "10% RGB Value"; + RGB5Btn.Enabled = true; + RGB10Btn.Enabled = true; + RGB5Btn.BackColor = Color.LimeGreen; + RGB10Btn.BackColor = Color.SteelBlue; + Per3Btn.BackColor = Color.SteelBlue; + Per10Btn.BackColor = Color.SteelBlue; + Properties.Settings.Default.rtGammaCorrected = true; + Properties.Settings.Default.rtTolerance = 5; + Properties.Settings.Default.rtPercentage = false; + Properties.Settings.Default.rtName = "RGB 5 Tolerance"; + } + else + { + Per3Btn.Text = "3% Light Level"; + Per10Btn.Text = "10% Light Level"; + RGB5Btn.Enabled = false; + RGB10Btn.Enabled = false; + Per3Btn.BackColor = Color.LimeGreen; + RGB5Btn.BackColor = Color.SlateGray; + RGB10Btn.BackColor = Color.SlateGray; + Per10Btn.BackColor = Color.SteelBlue; + Properties.Settings.Default.rtGammaCorrected = false; + Properties.Settings.Default.rtTolerance = 3; + Properties.Settings.Default.rtPercentage = true; + Properties.Settings.Default.rtName = "3% of Light Level Tolerance"; + } + Properties.Settings.Default.Save(); + } + } + private void RGB5Btn_Click(object sender, EventArgs e) + { + if (Properties.Settings.Default.rtTolerance != 5) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + RGB5Btn.BackColor = Color.LimeGreen; + RGB10Btn.BackColor = Color.SteelBlue; + Per3Btn.BackColor = Color.SteelBlue; + Per10Btn.BackColor = Color.SteelBlue; + Properties.Settings.Default.rtGammaCorrected = true; + Properties.Settings.Default.rtTolerance = 5; + Properties.Settings.Default.rtPercentage = false; + Properties.Settings.Default.rtName = "RGB 5 Tolerance"; + Properties.Settings.Default.Save(); + } + } + + private void RGB10Btn_Click(object sender, EventArgs e) + { + if (!Properties.Settings.Default.rtName.Contains("RGB 10")) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + RGB10Btn.BackColor = Color.LimeGreen; + RGB5Btn.BackColor = Color.SteelBlue; + Per3Btn.BackColor = Color.SteelBlue; + Per10Btn.BackColor = Color.SteelBlue; + Properties.Settings.Default.rtGammaCorrected = true; + Properties.Settings.Default.rtTolerance = 10; + Properties.Settings.Default.rtPercentage = false; + Properties.Settings.Default.rtName = "RGB 10 Tolerance"; + Properties.Settings.Default.Save(); + } + } + + private void Per3Btn_Click(object sender, EventArgs e) + { + if (Properties.Settings.Default.rtTolerance != 3) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + Per3Btn.BackColor = Color.LimeGreen; + Per10Btn.BackColor = Color.SteelBlue; + if (Properties.Settings.Default.rtGammaCorrected) + { + RGB5Btn.BackColor = Color.SteelBlue; + RGB10Btn.BackColor = Color.SteelBlue; + } + Properties.Settings.Default.rtTolerance = 3; + Properties.Settings.Default.rtPercentage = true; + Properties.Settings.Default.rtName = "3% of Light Level Tolerance"; + Properties.Settings.Default.Save(); + } + } + + private void Per10Btn_Click(object sender, EventArgs e) + { + if (!Properties.Settings.Default.rtName.Contains("10%")) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + Per3Btn.BackColor = Color.SteelBlue; + Per10Btn.BackColor = Color.LimeGreen; + if (Properties.Settings.Default.rtGammaCorrected) + { + RGB5Btn.BackColor = Color.SteelBlue; + RGB10Btn.BackColor = Color.SteelBlue; + } + Properties.Settings.Default.rtTolerance = 10; + Properties.Settings.Default.rtPercentage = true; + if (Properties.Settings.Default.rtGammaCorrected) + { + Properties.Settings.Default.rtName = "10% of RGB Tolerance"; + } + else + { + Properties.Settings.Default.rtName = "10% of Light Level Tolerance"; + } + Properties.Settings.Default.Save(); + } + } + + private void saveGammaTableSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (saveGammaTableSelect.SelectedIndex == 0 && !Properties.Settings.Default.saveGammaTable) + { + Properties.Settings.Default.saveGammaTable = true; + } + else + { + Properties.Settings.Default.saveGammaTable = false; + } + Properties.Settings.Default.Save(); + } + } + + private void osGammaSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (osGammaSelect.SelectedIndex == 0 && !Properties.Settings.Default.osGammaCorrected) + { + Properties.Settings.Default.osGammaCorrected = true; + osPercentSelect.Items.Clear(); + osPercentSelect.Items.Add("Raw RGB Values"); + osPercentSelect.Items.Add("Percent Over End RGB"); + osPercentSelect.Items.Add("Percent Over Transition Range"); + if (Properties.Settings.Default.osRangePercent ) + { + osPercentSelect.SelectedIndex = 2; + } + else if (Properties.Settings.Default.osRangePercent) + { + osPercentSelect.SelectedIndex = 1; + } + else + { + osPercentSelect.SelectedIndex = 0; + } + } + else + { + Properties.Settings.Default.osGammaCorrected = false; + osPercentSelect.Items.Clear(); + osPercentSelect.Items.Add("Percent Over End Light Level"); + osPercentSelect.Items.Add("Percent Over Transition Range"); + if (Properties.Settings.Default.osRangePercent) + { + osPercentSelect.SelectedIndex = 1; + } + else + { + osPercentSelect.SelectedIndex = 0; + } + } + Properties.Settings.Default.Save(); + } + } + + private void osPercentSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (osPercentSelect.SelectedIndex == 0 && (Properties.Settings.Default.osEndPercent || Properties.Settings.Default.osRangePercent)) + { + Properties.Settings.Default.osEndPercent = false; + Properties.Settings.Default.osRangePercent = false; + } + else if (osPercentSelect.SelectedIndex == 1 && !Properties.Settings.Default.osEndPercent) + { + Properties.Settings.Default.osEndPercent = true; + Properties.Settings.Default.osRangePercent = false; + } + else + { + Properties.Settings.Default.osEndPercent = false; + Properties.Settings.Default.osRangePercent = true; + } + Properties.Settings.Default.Save(); + } + } + + private void saveToExcelSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (saveToExcelSelect.SelectedIndex == 0 && !Properties.Settings.Default.saveXLSX) + { + Properties.Settings.Default.saveXLSX = true; + } + else + { + Properties.Settings.Default.saveXLSX = false; + } + Properties.Settings.Default.Save(); + } + } + + private void shareDataSelect_SelectedIndexChanged(object sender, EventArgs e) + { + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + if (saveThread == null || !saveThread.IsAlive) + { + saveThread = new Thread(new ThreadStart(this.SavingLabel)); + saveThread.Start(); + } + if (shareDataSelect.SelectedIndex == 0 && !Properties.Settings.Default.shareResults) + { + Properties.Settings.Default.shareResults = true; + } + else + { + Properties.Settings.Default.shareResults = false; + } + Properties.Settings.Default.Save(); + } + } + } + + public class RoundButton : Button + { + GraphicsPath GetRoundPath(RectangleF Rect, int radius) + { + float m = 2.75F; + float r2 = radius / 2f; + GraphicsPath GraphPath = new GraphicsPath(); + + GraphPath.AddArc(Rect.X + m, Rect.Y + m, radius, radius, 180, 90); + GraphPath.AddLine(Rect.X + r2 + m, Rect.Y + m, Rect.Width - r2 - m, Rect.Y + m); + GraphPath.AddArc(Rect.X + Rect.Width - radius - m, Rect.Y + m, radius, radius, 270, 90); + GraphPath.AddLine(Rect.Width - m, Rect.Y + r2, Rect.Width - m, Rect.Height - r2 - m); + GraphPath.AddArc(Rect.X + Rect.Width - radius - m, + Rect.Y + Rect.Height - radius - m, radius, radius, 0, 90); + GraphPath.AddLine(Rect.Width - r2 - m, Rect.Height - m, Rect.X + r2 - m, Rect.Height - m); + GraphPath.AddArc(Rect.X + m, Rect.Y + Rect.Height - radius - m, radius, radius, 90, 90); + GraphPath.AddLine(Rect.X + m, Rect.Height - r2 - m, Rect.X + m, Rect.Y + r2 + m); + + GraphPath.CloseFigure(); + return GraphPath; + } + + protected override void OnPaint(PaintEventArgs e) + { + int borderRadius = 25; + float borderThickness = 1.75f; + base.OnPaint(e); + RectangleF Rect = new RectangleF(0, 0, this.Width, this.Height); + GraphicsPath GraphPath = GetRoundPath(Rect, borderRadius); + + this.Region = new Region(GraphPath); + using (Pen pen = new Pen(Color.Silver, borderThickness)) + { + pen.Alignment = PenAlignment.Inset; + e.Graphics.DrawPath(pen, GraphPath); + } + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsSettings.resx b/OSRTT Launcher/OSRTT Launcher/ResultsSettings.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/ResultsSettings.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsView.Designer.cs b/OSRTT Launcher/OSRTT Launcher/ResultsView.Designer.cs index af8b0a3..9e3dcb2 100644 --- a/OSRTT Launcher/OSRTT Launcher/ResultsView.Designer.cs +++ b/OSRTT Launcher/OSRTT Launcher/ResultsView.Designer.cs @@ -29,33 +29,26 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResultsView)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.perceivedResponseTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.initialResponseTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.completeResponseTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.standardResultsPanel = new System.Windows.Forms.Panel(); - this.label12 = new System.Windows.Forms.Label(); - this.from3 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.from2 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.from1 = new System.Windows.Forms.Label(); - this.vrrGridView = new System.Windows.Forms.DataGridView(); - this.osGridView = new System.Windows.Forms.DataGridView(); - this.rtGridView = new System.Windows.Forms.DataGridView(); + this.saveHeatmapsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.asPNGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.asTransparentPNGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.stdResultsMenuBtn = new System.Windows.Forms.ToolStripButton(); + this.runSelectToolStrip = new System.Windows.Forms.ToolStripComboBox(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.allResultsMenuBtn = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.graphViewMenuBtn = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.importViewMenuButton = new System.Windows.Forms.ToolStripButton(); this.graphViewPanel = new System.Windows.Forms.Panel(); + this.saveGraphNoHSpanBtn = new System.Windows.Forms.Button(); + this.saveAsPNGBtn = new System.Windows.Forms.Button(); this.latencyLabel = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); @@ -74,257 +67,118 @@ private void InitializeComponent() this.transSelect1 = new System.Windows.Forms.ComboBox(); this.graphedData = new ScottPlot.FormsPlot(); this.importPanel = new System.Windows.Forms.Panel(); - this.importResultsViewBtn = new System.Windows.Forms.Button(); - this.importRawFolder = new System.Windows.Forms.Button(); + this.panel3 = new System.Windows.Forms.Panel(); + this.label13 = new System.Windows.Forms.Label(); this.importGraphBtn = new System.Windows.Forms.Button(); - this.titleLabel = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.rtStatsGridView = new System.Windows.Forms.DataGridView(); - this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.importRawFolder = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.importRawFolderBtn = new System.Windows.Forms.Button(); + this.label11 = new System.Windows.Forms.Label(); + this.importRawFileBtn = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label5 = new System.Windows.Forms.Label(); + this.importResultsViewBtn = new System.Windows.Forms.Button(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.heatmaps1 = new OSRTT_Launcher.Heatmaps(); this.menuStrip1.SuspendLayout(); - this.standardResultsPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.vrrGridView)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.osGridView)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.rtGridView)).BeginInit(); this.toolStrip1.SuspendLayout(); this.graphViewPanel.SuspendLayout(); this.importPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.rtStatsGridView)).BeginInit(); + this.panel3.SuspendLayout(); + this.panel2.SuspendLayout(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.viewToolStripMenuItem, - this.optionsToolStripMenuItem}); + this.optionsToolStripMenuItem, + this.saveHeatmapsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(2850, 24); + this.menuStrip1.Size = new System.Drawing.Size(1924, 24); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; // // viewToolStripMenuItem // + this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.perceivedResponseTimeToolStripMenuItem, + this.initialResponseTimeToolStripMenuItem, + this.completeResponseTimeToolStripMenuItem}); this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.viewToolStripMenuItem.Text = "View"; // + // perceivedResponseTimeToolStripMenuItem + // + this.perceivedResponseTimeToolStripMenuItem.Checked = true; + this.perceivedResponseTimeToolStripMenuItem.CheckOnClick = true; + this.perceivedResponseTimeToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.perceivedResponseTimeToolStripMenuItem.Name = "perceivedResponseTimeToolStripMenuItem"; + this.perceivedResponseTimeToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.perceivedResponseTimeToolStripMenuItem.Text = "Perceived Response Time"; + this.perceivedResponseTimeToolStripMenuItem.Click += new System.EventHandler(this.perceivedResponseTimeToolStripMenuItem_Click); + // + // initialResponseTimeToolStripMenuItem + // + this.initialResponseTimeToolStripMenuItem.CheckOnClick = true; + this.initialResponseTimeToolStripMenuItem.Name = "initialResponseTimeToolStripMenuItem"; + this.initialResponseTimeToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.initialResponseTimeToolStripMenuItem.Text = "Initial Response Time"; + this.initialResponseTimeToolStripMenuItem.Click += new System.EventHandler(this.initialResponseTimeToolStripMenuItem_Click); + // + // completeResponseTimeToolStripMenuItem + // + this.completeResponseTimeToolStripMenuItem.CheckOnClick = true; + this.completeResponseTimeToolStripMenuItem.Name = "completeResponseTimeToolStripMenuItem"; + this.completeResponseTimeToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.completeResponseTimeToolStripMenuItem.Text = "Complete Response Time"; + this.completeResponseTimeToolStripMenuItem.Click += new System.EventHandler(this.completeResponseTimeToolStripMenuItem_Click); + // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.optionsToolStripMenuItem.Text = "Options"; + this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); + // + // saveHeatmapsToolStripMenuItem + // + this.saveHeatmapsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.asPNGToolStripMenuItem, + this.asTransparentPNGToolStripMenuItem}); + this.saveHeatmapsToolStripMenuItem.Name = "saveHeatmapsToolStripMenuItem"; + this.saveHeatmapsToolStripMenuItem.Size = new System.Drawing.Size(100, 20); + this.saveHeatmapsToolStripMenuItem.Text = "Save Heatmaps"; + // + // asPNGToolStripMenuItem + // + this.asPNGToolStripMenuItem.Name = "asPNGToolStripMenuItem"; + this.asPNGToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.asPNGToolStripMenuItem.Text = "As PNG"; + this.asPNGToolStripMenuItem.Click += new System.EventHandler(this.asPNGToolStripMenuItem_Click); // - // standardResultsPanel - // - this.standardResultsPanel.Controls.Add(this.rtStatsGridView); - this.standardResultsPanel.Controls.Add(this.pictureBox1); - this.standardResultsPanel.Controls.Add(this.titleLabel); - this.standardResultsPanel.Controls.Add(this.vrrGridView); - this.standardResultsPanel.Controls.Add(this.osGridView); - this.standardResultsPanel.Controls.Add(this.rtGridView); - this.standardResultsPanel.Controls.Add(this.from2); - this.standardResultsPanel.Controls.Add(this.from3); - this.standardResultsPanel.Controls.Add(this.from1); - this.standardResultsPanel.Controls.Add(this.label12); - this.standardResultsPanel.Controls.Add(this.label10); - this.standardResultsPanel.Controls.Add(this.label9); - this.standardResultsPanel.Location = new System.Drawing.Point(1439, 52); - this.standardResultsPanel.Name = "standardResultsPanel"; - this.standardResultsPanel.Size = new System.Drawing.Size(1384, 704); - this.standardResultsPanel.TabIndex = 2; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label12.ForeColor = System.Drawing.Color.Black; - this.label12.Location = new System.Drawing.Point(1329, 99); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(38, 26); - this.label12.TabIndex = 27; - this.label12.Text = "To"; - // - // from3 - // - this.from3.AutoSize = true; - this.from3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.from3.ForeColor = System.Drawing.Color.Black; - this.from3.Location = new System.Drawing.Point(933, 352); - this.from3.Name = "from3"; - this.from3.Size = new System.Drawing.Size(67, 26); - this.from3.TabIndex = 26; - this.from3.Text = "From"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label10.ForeColor = System.Drawing.Color.Black; - this.label10.Location = new System.Drawing.Point(885, 99); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(38, 26); - this.label10.TabIndex = 25; - this.label10.Text = "To"; - // - // from2 - // - this.from2.AutoSize = true; - this.from2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.from2.ForeColor = System.Drawing.Color.Black; - this.from2.Location = new System.Drawing.Point(489, 352); - this.from2.Name = "from2"; - this.from2.Size = new System.Drawing.Size(67, 26); - this.from2.TabIndex = 24; - this.from2.Text = "From"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label9.ForeColor = System.Drawing.Color.Black; - this.label9.Location = new System.Drawing.Point(435, 99); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(38, 26); - this.label9.TabIndex = 23; - this.label9.Text = "To"; - // - // from1 - // - this.from1.AutoSize = true; - this.from1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.from1.ForeColor = System.Drawing.Color.Black; - this.from1.Location = new System.Drawing.Point(39, 352); - this.from1.Name = "from1"; - this.from1.Size = new System.Drawing.Size(67, 26); - this.from1.TabIndex = 22; - this.from1.Text = "From"; - // - // vrrGridView - // - this.vrrGridView.AllowUserToAddRows = false; - this.vrrGridView.AllowUserToDeleteRows = false; - this.vrrGridView.AllowUserToResizeColumns = false; - this.vrrGridView.AllowUserToResizeRows = false; - this.vrrGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; - this.vrrGridView.ColumnHeadersHeight = 40; - this.vrrGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.vrrGridView.DefaultCellStyle = dataGridViewCellStyle2; - this.vrrGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.vrrGridView.EnableHeadersVisualStyles = false; - this.vrrGridView.GridColor = System.Drawing.Color.White; - this.vrrGridView.Location = new System.Drawing.Point(939, 103); - this.vrrGridView.MultiSelect = false; - this.vrrGridView.Name = "vrrGridView"; - this.vrrGridView.ReadOnly = true; - this.vrrGridView.RowHeadersWidth = 65; - this.vrrGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - this.vrrGridView.RowTemplate.Height = 35; - this.vrrGridView.RowTemplate.ReadOnly = true; - this.vrrGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.vrrGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.vrrGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; - this.vrrGridView.ShowCellToolTips = false; - this.vrrGridView.ShowEditingIcon = false; - this.vrrGridView.Size = new System.Drawing.Size(392, 250); - this.vrrGridView.TabIndex = 9; - // - // osGridView - // - this.osGridView.AllowUserToAddRows = false; - this.osGridView.AllowUserToDeleteRows = false; - this.osGridView.AllowUserToResizeColumns = false; - this.osGridView.AllowUserToResizeRows = false; - this.osGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; - this.osGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; - this.osGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - this.osGridView.ColumnHeadersHeight = 40; - this.osGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.osGridView.DefaultCellStyle = dataGridViewCellStyle3; - this.osGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.osGridView.EnableHeadersVisualStyles = false; - this.osGridView.GridColor = System.Drawing.Color.White; - this.osGridView.Location = new System.Drawing.Point(494, 103); - this.osGridView.MultiSelect = false; - this.osGridView.Name = "osGridView"; - this.osGridView.ReadOnly = true; - this.osGridView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - this.osGridView.RowHeadersWidth = 65; - this.osGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - this.osGridView.RowTemplate.Height = 35; - this.osGridView.RowTemplate.ReadOnly = true; - this.osGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.osGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.osGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; - this.osGridView.ShowCellToolTips = false; - this.osGridView.ShowEditingIcon = false; - this.osGridView.Size = new System.Drawing.Size(392, 250); - this.osGridView.TabIndex = 8; - // - // rtGridView - // - this.rtGridView.AllowUserToAddRows = false; - this.rtGridView.AllowUserToDeleteRows = false; - this.rtGridView.AllowUserToResizeColumns = false; - this.rtGridView.AllowUserToResizeRows = false; - this.rtGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; - this.rtGridView.ColumnHeadersHeight = 40; - this.rtGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle4.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.rtGridView.DefaultCellStyle = dataGridViewCellStyle4; - this.rtGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.rtGridView.EnableHeadersVisualStyles = false; - this.rtGridView.GridColor = System.Drawing.Color.White; - this.rtGridView.Location = new System.Drawing.Point(45, 103); - this.rtGridView.MultiSelect = false; - this.rtGridView.Name = "rtGridView"; - this.rtGridView.ReadOnly = true; - this.rtGridView.RowHeadersWidth = 65; - this.rtGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - this.rtGridView.RowTemplate.Height = 35; - this.rtGridView.RowTemplate.ReadOnly = true; - this.rtGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.rtGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.rtGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; - this.rtGridView.ShowCellToolTips = false; - this.rtGridView.ShowEditingIcon = false; - this.rtGridView.Size = new System.Drawing.Size(392, 250); - this.rtGridView.TabIndex = 7; + // asTransparentPNGToolStripMenuItem + // + this.asTransparentPNGToolStripMenuItem.Name = "asTransparentPNGToolStripMenuItem"; + this.asTransparentPNGToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.asTransparentPNGToolStripMenuItem.Text = "As Transparent PNG"; + this.asTransparentPNGToolStripMenuItem.Click += new System.EventHandler(this.asTransparentPNGToolStripMenuItem_Click); // // toolStrip1 // this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.stdResultsMenuBtn, + this.runSelectToolStrip, this.toolStripSeparator1, - this.allResultsMenuBtn, - this.toolStripSeparator2, this.graphViewMenuBtn, this.toolStripSeparator3, this.importViewMenuButton}); this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(2850, 25); + this.toolStrip1.Size = new System.Drawing.Size(1924, 25); this.toolStrip1.TabIndex = 3; this.toolStrip1.Text = "toolStrip1"; // @@ -337,31 +191,24 @@ private void InitializeComponent() this.stdResultsMenuBtn.Image = ((System.Drawing.Image)(resources.GetObject("stdResultsMenuBtn.Image"))); this.stdResultsMenuBtn.ImageTransparentColor = System.Drawing.Color.Magenta; this.stdResultsMenuBtn.Name = "stdResultsMenuBtn"; - this.stdResultsMenuBtn.Size = new System.Drawing.Size(98, 22); - this.stdResultsMenuBtn.Text = "Standard Results"; + this.stdResultsMenuBtn.Size = new System.Drawing.Size(65, 22); + this.stdResultsMenuBtn.Text = "Heatmaps"; this.stdResultsMenuBtn.Click += new System.EventHandler(this.stdResultsMenuBtn_Click); // + // runSelectToolStrip + // + this.runSelectToolStrip.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.runSelectToolStrip.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.runSelectToolStrip.Margin = new System.Windows.Forms.Padding(5, 0, 1, 0); + this.runSelectToolStrip.Name = "runSelectToolStrip"; + this.runSelectToolStrip.Size = new System.Drawing.Size(121, 25); + this.runSelectToolStrip.SelectedIndexChanged += new System.EventHandler(this.runSelectToolStrip_SelectedIndexChanged); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); // - // allResultsMenuBtn - // - this.allResultsMenuBtn.CheckOnClick = true; - this.allResultsMenuBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.allResultsMenuBtn.Image = ((System.Drawing.Image)(resources.GetObject("allResultsMenuBtn.Image"))); - this.allResultsMenuBtn.ImageTransparentColor = System.Drawing.Color.Magenta; - this.allResultsMenuBtn.Name = "allResultsMenuBtn"; - this.allResultsMenuBtn.Size = new System.Drawing.Size(65, 22); - this.allResultsMenuBtn.Text = "All Results"; - this.allResultsMenuBtn.Click += new System.EventHandler(this.allResultsMenuBtn_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // // graphViewMenuBtn // this.graphViewMenuBtn.CheckOnClick = true; @@ -369,8 +216,8 @@ private void InitializeComponent() this.graphViewMenuBtn.Image = ((System.Drawing.Image)(resources.GetObject("graphViewMenuBtn.Image"))); this.graphViewMenuBtn.ImageTransparentColor = System.Drawing.Color.Magenta; this.graphViewMenuBtn.Name = "graphViewMenuBtn"; - this.graphViewMenuBtn.Size = new System.Drawing.Size(128, 22); - this.graphViewMenuBtn.Text = "View Raw Data Graphs"; + this.graphViewMenuBtn.Size = new System.Drawing.Size(100, 22); + this.graphViewMenuBtn.Text = "Raw Data Graphs"; this.graphViewMenuBtn.Click += new System.EventHandler(this.graphViewMenuBtn_Click); // // toolStripSeparator3 @@ -391,6 +238,8 @@ private void InitializeComponent() // // graphViewPanel // + this.graphViewPanel.Controls.Add(this.saveGraphNoHSpanBtn); + this.graphViewPanel.Controls.Add(this.saveAsPNGBtn); this.graphViewPanel.Controls.Add(this.latencyLabel); this.graphViewPanel.Controls.Add(this.label8); this.graphViewPanel.Controls.Add(this.label7); @@ -408,11 +257,39 @@ private void InitializeComponent() this.graphViewPanel.Controls.Add(this.label1); this.graphViewPanel.Controls.Add(this.transSelect1); this.graphViewPanel.Controls.Add(this.graphedData); - this.graphViewPanel.Location = new System.Drawing.Point(1439, 762); + this.graphViewPanel.Location = new System.Drawing.Point(5, 442); this.graphViewPanel.Name = "graphViewPanel"; - this.graphViewPanel.Size = new System.Drawing.Size(1384, 704); + this.graphViewPanel.Size = new System.Drawing.Size(1384, 722); this.graphViewPanel.TabIndex = 4; // + // saveGraphNoHSpanBtn + // + this.saveGraphNoHSpanBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.saveGraphNoHSpanBtn.FlatAppearance.BorderSize = 0; + this.saveGraphNoHSpanBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.saveGraphNoHSpanBtn.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold); + this.saveGraphNoHSpanBtn.Location = new System.Drawing.Point(1187, 646); + this.saveGraphNoHSpanBtn.Name = "saveGraphNoHSpanBtn"; + this.saveGraphNoHSpanBtn.Size = new System.Drawing.Size(182, 53); + this.saveGraphNoHSpanBtn.TabIndex = 25; + this.saveGraphNoHSpanBtn.Text = "Save as PNG\r\nWithout Block"; + this.saveGraphNoHSpanBtn.UseVisualStyleBackColor = false; + this.saveGraphNoHSpanBtn.Click += new System.EventHandler(this.saveGraphNoHSpanBtn_Click); + // + // saveAsPNGBtn + // + this.saveAsPNGBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.saveAsPNGBtn.FlatAppearance.BorderSize = 0; + this.saveAsPNGBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.saveAsPNGBtn.Font = new System.Drawing.Font("Consolas", 16F, System.Drawing.FontStyle.Bold); + this.saveAsPNGBtn.Location = new System.Drawing.Point(1187, 606); + this.saveAsPNGBtn.Name = "saveAsPNGBtn"; + this.saveAsPNGBtn.Size = new System.Drawing.Size(182, 34); + this.saveAsPNGBtn.TabIndex = 24; + this.saveAsPNGBtn.Text = "Save as PNG"; + this.saveAsPNGBtn.UseVisualStyleBackColor = false; + this.saveAsPNGBtn.Click += new System.EventHandler(this.saveAsPNGBtn_Click); + // // latencyLabel // this.latencyLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; @@ -452,7 +329,7 @@ private void InitializeComponent() this.runSelectBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.runSelectBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.runSelectBox.FormattingEnabled = true; - this.runSelectBox.Location = new System.Drawing.Point(180, 10); + this.runSelectBox.Location = new System.Drawing.Point(176, 10); this.runSelectBox.Name = "runSelectBox"; this.runSelectBox.Size = new System.Drawing.Size(140, 33); this.runSelectBox.TabIndex = 20; @@ -508,9 +385,9 @@ private void InitializeComponent() this.overshootStyleListBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.overshootStyleListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.overshootStyleListBox.FormattingEnabled = true; - this.overshootStyleListBox.Location = new System.Drawing.Point(1187, 411); + this.overshootStyleListBox.Location = new System.Drawing.Point(1180, 411); this.overshootStyleListBox.Name = "overshootStyleListBox"; - this.overshootStyleListBox.Size = new System.Drawing.Size(182, 24); + this.overshootStyleListBox.Size = new System.Drawing.Size(193, 24); this.overshootStyleListBox.TabIndex = 15; this.overshootStyleListBox.SelectedIndexChanged += new System.EventHandler(this.overshootStyleListBox_SelectedIndexChanged); // @@ -530,9 +407,9 @@ private void InitializeComponent() this.processTypeListBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.processTypeListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.processTypeListBox.FormattingEnabled = true; - this.processTypeListBox.Location = new System.Drawing.Point(1187, 232); + this.processTypeListBox.Location = new System.Drawing.Point(1180, 232); this.processTypeListBox.Name = "processTypeListBox"; - this.processTypeListBox.Size = new System.Drawing.Size(182, 24); + this.processTypeListBox.Size = new System.Drawing.Size(193, 24); this.processTypeListBox.TabIndex = 13; this.processTypeListBox.SelectedIndexChanged += new System.EventHandler(this.processTypeListBox_SelectedIndexChanged); // @@ -578,7 +455,7 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; - this.label1.Location = new System.Drawing.Point(376, 13); + this.label1.Location = new System.Drawing.Point(376, 14); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(217, 26); this.label1.TabIndex = 2; @@ -589,42 +466,65 @@ private void InitializeComponent() this.transSelect1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.transSelect1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.transSelect1.FormattingEnabled = true; - this.transSelect1.Location = new System.Drawing.Point(599, 10); + this.transSelect1.Location = new System.Drawing.Point(595, 10); this.transSelect1.Name = "transSelect1"; - this.transSelect1.Size = new System.Drawing.Size(306, 33); + this.transSelect1.Size = new System.Drawing.Size(328, 33); this.transSelect1.TabIndex = 1; this.transSelect1.SelectedIndexChanged += new System.EventHandler(this.transSelect1_SelectedIndexChanged); // // graphedData // - this.graphedData.Location = new System.Drawing.Point(7, 51); + this.graphedData.Location = new System.Drawing.Point(6, 51); this.graphedData.Name = "graphedData"; - this.graphedData.Size = new System.Drawing.Size(1183, 650); + this.graphedData.Size = new System.Drawing.Size(1184, 666); this.graphedData.TabIndex = 0; // // importPanel // - this.importPanel.Controls.Add(this.importResultsViewBtn); - this.importPanel.Controls.Add(this.importRawFolder); - this.importPanel.Controls.Add(this.importGraphBtn); + this.importPanel.Controls.Add(this.panel3); + this.importPanel.Controls.Add(this.panel2); + this.importPanel.Controls.Add(this.panel1); this.importPanel.Location = new System.Drawing.Point(5, 52); this.importPanel.Name = "importPanel"; - this.importPanel.Size = new System.Drawing.Size(1384, 704); + this.importPanel.Size = new System.Drawing.Size(1082, 290); this.importPanel.TabIndex = 5; // - // importResultsViewBtn + // panel3 + // + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel3.Controls.Add(this.label13); + this.panel3.Controls.Add(this.importGraphBtn); + this.panel3.Controls.Add(this.importRawFolder); + this.panel3.Location = new System.Drawing.Point(755, 3); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(314, 280); + this.panel3.TabIndex = 25; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.BackColor = System.Drawing.Color.Transparent; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.ForeColor = System.Drawing.Color.Black; + this.label13.Location = new System.Drawing.Point(23, 9); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(270, 37); + this.label13.TabIndex = 23; + this.label13.Text = "Graph Raw Data"; // - this.importResultsViewBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.importResultsViewBtn.FlatAppearance.BorderSize = 0; - this.importResultsViewBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.importResultsViewBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); - this.importResultsViewBtn.Location = new System.Drawing.Point(41, 102); - this.importResultsViewBtn.Name = "importResultsViewBtn"; - this.importResultsViewBtn.Size = new System.Drawing.Size(309, 93); - this.importResultsViewBtn.TabIndex = 9; - this.importResultsViewBtn.Text = "Import Processed Data File for Heatmaps"; - this.importResultsViewBtn.UseVisualStyleBackColor = false; - this.importResultsViewBtn.Click += new System.EventHandler(this.importResultsViewBtn_Click); + // importGraphBtn + // + this.importGraphBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.importGraphBtn.FlatAppearance.BorderSize = 0; + this.importGraphBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.importGraphBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); + this.importGraphBtn.Location = new System.Drawing.Point(43, 59); + this.importGraphBtn.Name = "importGraphBtn"; + this.importGraphBtn.Size = new System.Drawing.Size(231, 93); + this.importGraphBtn.TabIndex = 7; + this.importGraphBtn.Text = "Import Raw Data File to Graph"; + this.importGraphBtn.UseVisualStyleBackColor = false; + this.importGraphBtn.Click += new System.EventHandler(this.importGraphBtn_Click); // // importRawFolder // @@ -632,7 +532,7 @@ private void InitializeComponent() this.importRawFolder.FlatAppearance.BorderSize = 0; this.importRawFolder.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.importRawFolder.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); - this.importRawFolder.Location = new System.Drawing.Point(428, 201); + this.importRawFolder.Location = new System.Drawing.Point(43, 158); this.importRawFolder.Name = "importRawFolder"; this.importRawFolder.Size = new System.Drawing.Size(231, 93); this.importRawFolder.TabIndex = 8; @@ -640,95 +540,123 @@ private void InitializeComponent() this.importRawFolder.UseVisualStyleBackColor = false; this.importRawFolder.Click += new System.EventHandler(this.importRawFolder_Click); // - // importGraphBtn + // panel2 + // + this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel2.Controls.Add(this.importRawFolderBtn); + this.panel2.Controls.Add(this.label11); + this.panel2.Controls.Add(this.importRawFileBtn); + this.panel2.Location = new System.Drawing.Point(7, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(359, 239); + this.panel2.TabIndex = 24; + // + // importRawFolderBtn + // + this.importRawFolderBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.importRawFolderBtn.FlatAppearance.BorderSize = 0; + this.importRawFolderBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.importRawFolderBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); + this.importRawFolderBtn.Location = new System.Drawing.Point(22, 142); + this.importRawFolderBtn.Name = "importRawFolderBtn"; + this.importRawFolderBtn.Size = new System.Drawing.Size(309, 75); + this.importRawFolderBtn.TabIndex = 24; + this.importRawFolderBtn.Text = "Import Raw Data Folder to Process"; + this.importRawFolderBtn.UseVisualStyleBackColor = false; + this.importRawFolderBtn.Click += new System.EventHandler(this.importRawFolderBtn_Click); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.BackColor = System.Drawing.Color.Transparent; + this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label11.ForeColor = System.Drawing.Color.Black; + this.label11.Location = new System.Drawing.Point(29, 9); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(297, 37); + this.label11.TabIndex = 23; + this.label11.Text = "Process Raw Data"; + // + // importRawFileBtn + // + this.importRawFileBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.importRawFileBtn.FlatAppearance.BorderSize = 0; + this.importRawFileBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.importRawFileBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); + this.importRawFileBtn.Location = new System.Drawing.Point(22, 59); + this.importRawFileBtn.Name = "importRawFileBtn"; + this.importRawFileBtn.Size = new System.Drawing.Size(309, 75); + this.importRawFileBtn.TabIndex = 9; + this.importRawFileBtn.Text = "Import Raw Data File to Process"; + this.importRawFileBtn.UseVisualStyleBackColor = false; + this.importRawFileBtn.Click += new System.EventHandler(this.importRawFileBtn_Click); + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.label5); + this.panel1.Controls.Add(this.importResultsViewBtn); + this.panel1.Location = new System.Drawing.Point(381, 3); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(359, 174); + this.panel1.TabIndex = 10; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.Color.Transparent; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.ForeColor = System.Drawing.Color.Black; + this.label5.Location = new System.Drawing.Point(37, 9); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(282, 37); + this.label5.TabIndex = 23; + this.label5.Text = "Create Heatmaps"; // - this.importGraphBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.importGraphBtn.FlatAppearance.BorderSize = 0; - this.importGraphBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.importGraphBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); - this.importGraphBtn.Location = new System.Drawing.Point(428, 102); - this.importGraphBtn.Name = "importGraphBtn"; - this.importGraphBtn.Size = new System.Drawing.Size(231, 93); - this.importGraphBtn.TabIndex = 7; - this.importGraphBtn.Text = "Import Raw Data File to Graph"; - this.importGraphBtn.UseVisualStyleBackColor = false; - this.importGraphBtn.Click += new System.EventHandler(this.importGraphBtn_Click); + // importResultsViewBtn + // + this.importResultsViewBtn.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.importResultsViewBtn.FlatAppearance.BorderSize = 0; + this.importResultsViewBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.importResultsViewBtn.Font = new System.Drawing.Font("Consolas", 18F, System.Drawing.FontStyle.Bold); + this.importResultsViewBtn.Location = new System.Drawing.Point(24, 59); + this.importResultsViewBtn.Name = "importResultsViewBtn"; + this.importResultsViewBtn.Size = new System.Drawing.Size(309, 93); + this.importResultsViewBtn.TabIndex = 9; + this.importResultsViewBtn.Text = "Import Processed Data File for Heatmaps"; + this.importResultsViewBtn.UseVisualStyleBackColor = false; + this.importResultsViewBtn.Click += new System.EventHandler(this.importResultsViewBtn_Click); + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(0, 348); + this.progressBar1.MarqueeAnimationSpeed = 30; + this.progressBar1.Maximum = 50; + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(1087, 23); + this.progressBar1.Step = 50; + this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + this.progressBar1.TabIndex = 34; + this.progressBar1.Visible = false; + // + // heatmaps1 // - // titleLabel - // - this.titleLabel.Font = new System.Drawing.Font("Calibri", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.titleLabel.ForeColor = System.Drawing.Color.Black; - this.titleLabel.Location = new System.Drawing.Point(45, 8); - this.titleLabel.Name = "titleLabel"; - this.titleLabel.Size = new System.Drawing.Size(1295, 52); - this.titleLabel.TabIndex = 28; - this.titleLabel.Text = "Monitor Name - Freqency - FPS Limit"; - this.titleLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pictureBox1 - // - this.pictureBox1.Image = global::OSRTT_Launcher.Properties.Resources.icon_wide; - this.pictureBox1.Location = new System.Drawing.Point(1237, 614); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(118, 66); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 29; - this.pictureBox1.TabStop = false; - // - // rtStatsGridView - // - this.rtStatsGridView.AllowUserToAddRows = false; - this.rtStatsGridView.AllowUserToDeleteRows = false; - this.rtStatsGridView.AllowUserToResizeColumns = false; - this.rtStatsGridView.AllowUserToResizeRows = false; - this.rtStatsGridView.BackgroundColor = System.Drawing.SystemColors.WindowFrame; - this.rtStatsGridView.ColumnHeadersHeight = 40; - this.rtStatsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - this.rtStatsGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Column1}); - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.rtStatsGridView.DefaultCellStyle = dataGridViewCellStyle1; - this.rtStatsGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.rtStatsGridView.EnableHeadersVisualStyles = false; - this.rtStatsGridView.GridColor = System.Drawing.Color.White; - this.rtStatsGridView.Location = new System.Drawing.Point(98, 396); - this.rtStatsGridView.MultiSelect = false; - this.rtStatsGridView.Name = "rtStatsGridView"; - this.rtStatsGridView.ReadOnly = true; - this.rtStatsGridView.RowHeadersWidth = 65; - this.rtStatsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - this.rtStatsGridView.RowTemplate.Height = 35; - this.rtStatsGridView.RowTemplate.ReadOnly = true; - this.rtStatsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.rtStatsGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.rtStatsGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; - this.rtStatsGridView.ShowCellToolTips = false; - this.rtStatsGridView.ShowEditingIcon = false; - this.rtStatsGridView.Size = new System.Drawing.Size(277, 250); - this.rtStatsGridView.TabIndex = 30; - // - // Column1 - // - this.Column1.HeaderText = ""; - this.Column1.Name = "Column1"; - this.Column1.ReadOnly = true; + this.heatmaps1.Location = new System.Drawing.Point(1395, 55); + this.heatmaps1.Name = "heatmaps1"; + this.heatmaps1.Size = new System.Drawing.Size(1775, 950); + this.heatmaps1.TabIndex = 6; // // ResultsView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlDark; - this.ClientSize = new System.Drawing.Size(2850, 1689); + this.ClientSize = new System.Drawing.Size(1924, 1061); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.heatmaps1); this.Controls.Add(this.importPanel); this.Controls.Add(this.graphViewPanel); this.Controls.Add(this.toolStrip1); - this.Controls.Add(this.standardResultsPanel); this.Controls.Add(this.menuStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MainMenuStrip = this.menuStrip1; @@ -738,18 +666,17 @@ private void InitializeComponent() this.Load += new System.EventHandler(this.ResultsView_Load); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); - this.standardResultsPanel.ResumeLayout(false); - this.standardResultsPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.vrrGridView)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.osGridView)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.rtGridView)).EndInit(); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.graphViewPanel.ResumeLayout(false); this.graphViewPanel.PerformLayout(); this.importPanel.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.rtStatsGridView)).EndInit(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -759,12 +686,9 @@ private void InitializeComponent() private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; - private System.Windows.Forms.Panel standardResultsPanel; private System.Windows.Forms.ToolStrip toolStrip1; - private System.Windows.Forms.ToolStripButton allResultsMenuBtn; private System.Windows.Forms.ToolStripButton stdResultsMenuBtn; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripButton graphViewMenuBtn; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripButton importViewMenuButton; @@ -789,19 +713,25 @@ private void InitializeComponent() private System.Windows.Forms.Button importRawFolder; private System.Windows.Forms.Label latencyLabel; private System.Windows.Forms.Label label8; - private System.Windows.Forms.DataGridView rtGridView; - private System.Windows.Forms.DataGridView vrrGridView; - private System.Windows.Forms.DataGridView osGridView; private System.Windows.Forms.Button importResultsViewBtn; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.Label from3; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label from2; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label from1; - private System.Windows.Forms.Label titleLabel; - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.DataGridView rtStatsGridView; - private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.Button saveAsPNGBtn; + private System.Windows.Forms.Button saveGraphNoHSpanBtn; + private System.Windows.Forms.ToolStripMenuItem saveHeatmapsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem asTransparentPNGToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem perceivedResponseTimeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem initialResponseTimeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem completeResponseTimeToolStripMenuItem; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button importRawFileBtn; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button importRawFolderBtn; + private Heatmaps heatmaps1; + private System.Windows.Forms.ToolStripComboBox runSelectToolStrip; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.ToolStripMenuItem asPNGToolStripMenuItem; } } \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsView.cs b/OSRTT Launcher/OSRTT Launcher/ResultsView.cs index 855739c..0ccbb42 100644 --- a/OSRTT Launcher/OSRTT Launcher/ResultsView.cs +++ b/OSRTT Launcher/OSRTT Launcher/ResultsView.cs @@ -9,41 +9,37 @@ using System.Threading.Tasks; using System.Windows.Forms; using ScottPlot; -using BrightIdeasSoftware; using System.Drawing.Drawing2D; using System.Drawing.Text; using System.Resources; +using System.Diagnostics; +using System.Threading; +using System.Drawing.Imaging; +using Newtonsoft.Json; namespace OSRTT_Launcher { // TODO List // // Graph View - // - Make response time options work - // - Fix overshoot gamma corrected percentage options - // - Save graph as PNG - // Results view - // - Style headers - // - Style/colour cells based on type/key (user changable setting?) - // Handle multiple runs (dropdown of Averaged + run 1 + run 2 ...) - // Save graph as (optionally transparent) image - // Save results view as (optionally transparent) image - full page minus headers. - // Make import functions generic (pass expected file name in, return object back) + // - Limit scrolling/zoom to only within the bounds of the data public partial class ResultsView : Form { string path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase; + string resultsFolderPath = ""; + public ProcessData.runSettings runSettings; // Raw sensor data, list of lists to hold multiple runs worth of results at once - public List> rawData = new List>(); + public List> rawData = new List>(); // Moving average smoothed sensor data, list of lists to hold multiple runs worth of results at once - public List> smoothedData = new List>(); + public List smoothedData = new List(); // Processed results, list of lists to hold multiple runs worth of results at once - public List> multipleRunsData = new List>(); + public List> multipleRunsData = new List>(); // Single averaged results list from multiple run data - public List averageData = new List(); + public List averageData = new List(); // Raw gamma sensor data public List gamma = new List(); // Processed gamma results (list of 256 RGB & correlating light values - public List processedGamma = new List(); + public List processedGamma = new List(); // Single 0-255 transition to gauge distance to start point (initial latency) public List testLatency = new List(); // RGB array to use @@ -53,67 +49,29 @@ public partial class ResultsView : Form // How many samples to build the initial min/max from public int startDelay = 150; - private class rtMethods + public List rtMethodologies = new List { - public string Type { get; set; } - public string Name { get; set; } - public int Tolerance { get; set; } - public bool gammaCorrected { get; set; } - public bool percentage { get; set; } - } - - private List rtMethodologies = new List - { - new rtMethods { Type = "RGB5", Name = "RGB 5 Tolerance", Tolerance = 5, gammaCorrected = true, percentage = false }, - new rtMethods { Type = "RGB10", Name = "RGB 10 Tolerance", Tolerance = 10, gammaCorrected = true, percentage = false }, - new rtMethods { Type = "3PerGamCor", Name = "3% of RGB Tolerance", Tolerance = 3, gammaCorrected = true, percentage = true }, - new rtMethods { Type = "10PerGamCor", Name = "10% of RGB Tolerance", Tolerance = 10, gammaCorrected = true, percentage = true }, - new rtMethods { Type = "3Per", Name = "3% of Light Level Tolerance", Tolerance = 3, gammaCorrected = false, percentage = true}, - new rtMethods { Type = "10Per", Name = "10% of Light Level Tolerance", Tolerance = 10, gammaCorrected = false, percentage = true } + new ProcessData.rtMethods { Type = "RGB5", Name = "RGB 5 Tolerance", Tolerance = 5, gammaCorrected = true, percentage = false }, + new ProcessData.rtMethods { Type = "RGB10", Name = "RGB 10 Tolerance", Tolerance = 10, gammaCorrected = true, percentage = false }, + new ProcessData.rtMethods { Type = "3PerGamCor", Name = "3% of RGB Tolerance", Tolerance = 3, gammaCorrected = true, percentage = true }, + new ProcessData.rtMethods { Type = "10PerGamCor", Name = "10% of RGB Tolerance", Tolerance = 10, gammaCorrected = true, percentage = true }, + new ProcessData.rtMethods { Type = "3Per", Name = "3% of Light Level Tolerance", Tolerance = 3, gammaCorrected = false, percentage = true}, + new ProcessData.rtMethods { Type = "10Per", Name = "10% of Light Level Tolerance", Tolerance = 10, gammaCorrected = false, percentage = true } }; - private class osMethods - { - public string Type { get; set; } - public string Name { get; set; } - public bool endPercent { get; set; } - public bool rangePercent { get; set; } - public bool gammaCorrected { get; set; } - } - private List osMethodologies = new List + public List osMethodologies = new List { - new osMethods { Type = "GamCor", Name = "RGB Values", endPercent = false, rangePercent = false, gammaCorrected = true }, - new osMethods { Type = "GamCorrEndPer", Name = "Percent over end RGB Value", endPercent = true, rangePercent = false, gammaCorrected = true }, - new osMethods { Type = "GamCorrRangePer", Name = "Percent above RGB range", endPercent = false, rangePercent = true, gammaCorrected = true }, - new osMethods { Type = "EndPer", Name = "Percent over end light level", endPercent = true, rangePercent = false, gammaCorrected = false }, - new osMethods { Type = "RangePer", Name = "Percent over light level range", endPercent = false, rangePercent = true, gammaCorrected = false } + new ProcessData.osMethods { Type = "GamCor", Name = "RGB Values", endPercent = false, rangePercent = false, gammaCorrected = true }, + new ProcessData.osMethods { Type = "GamCorrEndPer", Name = "Percent over end RGB Value", endPercent = true, rangePercent = false, gammaCorrected = true }, + new ProcessData.osMethods { Type = "GamCorrRangePer", Name = "Percent above RGB range", endPercent = false, rangePercent = true, gammaCorrected = true }, + new ProcessData.osMethods { Type = "EndPer", Name = "Percent over end light level", endPercent = true, rangePercent = false, gammaCorrected = false }, + new ProcessData.osMethods { Type = "RangePer", Name = "Percent over light level range", endPercent = false, rangePercent = true, gammaCorrected = false } }; - private class resultSelection - { - public int arrayIndex { get; set; } - public int resultIndex { get; set; } - public rtMethods rtStyle { get; set; } - public osMethods osStyle { get; set; } - } - private resultSelection selectedResult; - public class processedResult - { - public double Time { get; set; } - public int startIndex { get; set; } - public int endIndex { get; set; } - public double Overshoot { get; set; } - } - public class colourKey - { - public int keyType { get; set; } - public double min { get; set; } - public double middle { get; set; } - public double max { get; set; } - } - List colourKeys = new List(); + public ProcessData.rtMethods rtMethod; + public ProcessData.osMethods osMethod; private ResourceManager rm = OSRTT_Launcher.Properties.Resources.ResourceManager; - public void setRawData (List> rd) + public void setRawData(List> rd) { if (rd != null) { @@ -121,7 +79,7 @@ public void setRawData (List> rd) } } - public void setMultiRunData(List> mrd) + public void setMultiRunData(List> mrd) { if (mrd != null) { @@ -129,7 +87,7 @@ public void setMultiRunData(List> mrd) } } - public void setAverageData(List ad) + public void setAverageData(List ad) { if (ad != null) { @@ -145,36 +103,80 @@ public void setRGBArr(List RGB) } } + public void setResultsFolder(string rfp) + { + resultsFolderPath = rfp; + } + + public void setStandardView() + { + stdResultsMenuBtn_Click(null, null); + } + public void setRtMethod(ProcessData.rtMethods rt) + { + rtMethod = rt; + } + public void setOsMethod(ProcessData.osMethods os) + { + osMethod = os; + } + public void setRunSettings(ProcessData.runSettings run) + { + if (run != null) + { + runSettings = run; + } + } + public ResultsView() { InitializeComponent(); this.Icon = (Icon)rm.GetObject("osrttIcon"); path = new Uri(System.IO.Path.GetDirectoryName(path)).LocalPath; path += @"\Results"; - Size = new Size(1400, 800); + Size = new Size(1100, 460); + this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); + saveHeatmapsToolStripMenuItem.Visible = false; + viewToolStripMenuItem.Visible = false; + runSelectToolStrip.Visible = false; + toolStripSeparator1.Visible = false; + toolStripSeparator3.Visible = false; initResultsMethodList(); initOvershootStyleList(); - string[] rtKey = Properties.Settings.Default.rtKey.Split(','); - if (rtKey.Length == 3) + } + private void ResultsView_Load(object sender, EventArgs e) + { + bool graph = false; + if (multipleRunsData.Count == 0 && averageData.Count == 0) + { + stdResultsMenuBtn.Visible = false; + graph = true; + } + else { - colourKeys.Add( new colourKey { keyType = 0, min = double.Parse(rtKey[0]), middle = double.Parse(rtKey[1]), max = double.Parse(rtKey[2]) }); + stdResultsMenuBtn.Visible = true; + toolStripSeparator1.Visible = true; + stdResultsMenuBtn_Click(null, null); } - string[] osKey = Properties.Settings.Default.osKey.Split(','); - if (osKey.Length == 3) + if (rawData.Count == 0) { - colourKeys.Add(new colourKey { keyType = 1, min = double.Parse(osKey[0]), middle = double.Parse(osKey[1]), max = double.Parse(osKey[2]) }); + graphViewMenuBtn.Visible = false; } - string[] vrrKey = Properties.Settings.Default.vrrKey.Split(','); - if (vrrKey.Length == 3) + else { - colourKeys.Add(new colourKey { keyType = 2, min = double.Parse(vrrKey[0]), middle = double.Parse(vrrKey[1]), max = double.Parse(vrrKey[2]) }); + graphViewMenuBtn.Visible = true; + toolStripSeparator3.Visible = true; + if (graph) + { + graphViewMenuBtn_Click(null, null); + } } } private void initResultsMethodList() { processTypeListBox.Items.Clear(); - foreach(var item in rtMethodologies) + foreach (var item in rtMethodologies) { processTypeListBox.Items.Add(item.Name); } @@ -189,28 +191,10 @@ private void initOvershootStyleList() } overshootStyleListBox.SelectedIndex = 0; } - - private void ResultsView_Load(object sender, EventArgs e) - { - if (rawData.Count == 0 && averageData.Count == 0) - { - graphViewMenuBtn.Visible = false; - // Import View - } - if (multipleRunsData.Count == 0) - { - allResultsMenuBtn.Visible = false; - stdResultsMenuBtn.Visible = true; - // Import View - } - - } - private void importRawData() { // Open file picker dialogue var filePath = string.Empty; - using (System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog()) { openFileDialog.InitialDirectory = path; @@ -223,12 +207,16 @@ private void importRawData() //Get the path of specified file filePath = openFileDialog.FileName; rawData.Clear(); + gamma.Clear(); + //processedGamma.Clear(); + //averageData.Clear(); + //multipleRunsData.Clear(); if (filePath.Contains("RAW-OSRTT")) { //Read the contents of the file into a stream try { - List tempRes = new List(); + List tempRes = new List(); List tempGamma = new List(); var fileStream = openFileDialog.OpenFile(); using (StreamReader reader = new StreamReader(fileStream)) @@ -236,375 +224,151 @@ private void importRawData() while (!reader.EndOfStream) { // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) + string fullLine = reader.ReadLine(); + if (fullLine.Contains("{")) + { + ProcessData.runSettings runs = JsonConvert.DeserializeObject(fullLine); + runSettings = runs; + continue; + } + else { - if (line[i] == "0") + string[] line = fullLine.Split(','); + int[] intLine = new int[line.Length]; + for (int i = 0; i < line.Length; i++) + { + if (line[i] == "0") + { + intLine[i] = 0; + } + else if (line[i] != "") + { + intLine[i] = int.Parse(line[i]); + } + else + { + continue; + } + } + Array.Resize(ref intLine, intLine.Length - 1); + if (intLine[0] == 1000) { - intLine[i] = 0; + testLatency.AddRange(intLine); } - else if (line[i] != "") + else if (intLine[0] == intLine[1]) { - intLine[i] = int.Parse(line[i]); + tempGamma.Add(intLine); } else { - continue; + ProcessData.rawResultData rawResult = new ProcessData.rawResultData + { + StartingRGB = intLine[0], + EndRGB = intLine[1], + TimeTaken = intLine[2], + SampleCount = intLine[3], + SampleTime = ((double)intLine[2] / (double)intLine[3]), + Samples = intLine.Skip(4).ToList() + }; + tempRes.Add(rawResult); } } - Array.Resize(ref intLine, intLine.Length - 1); - if (intLine[0] == 1000) - { - testLatency.AddRange(intLine); - } - else if (intLine[0] == intLine[1]) - { - tempGamma.Add(intLine); - } - else - { - tempRes.Add(intLine); - } } } - rawData.AddRange(new List> { tempRes }); + resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); + rawData.AddRange(new List> { tempRes }); gamma.AddRange(tempGamma); - processedGamma.AddRange(processGammaTable()); - processTestLatency(); + ProcessData pd = new ProcessData(); + processedGamma.AddRange(pd.processGammaTable(gamma, rawData[0])); + // save gamma data to file + if (Properties.Settings.Default.saveGammaTable) + { + CFuncs cf = new CFuncs(); + string gammaName = cf.createFileName(resultsFolderPath, "-GAMMA-OSRTT.csv"); + StringBuilder gammaCsv = new StringBuilder(); + gammaCsv.AppendLine("RGB,Light Level"); + foreach (ProcessData.gammaResult g in processedGamma) + { + gammaCsv.AppendLine(g.RGB.ToString() + "," + g.LightLevel.ToString()); + } + File.WriteAllText(resultsFolderPath + "\\" + gammaName, gammaCsv.ToString()); + } + //processTestLatency(); Console.WriteLine(rawData.Count); // Draw graph - graphViewMenuBtn_Click(null, null); - handleRunsList(); - handleResultsList(runSelectBox.SelectedIndex); + } - catch + catch (Exception ex) { DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); + Console.WriteLine(ex.Message + ex.StackTrace); } } else { MessageBox.Show("Sorry, only 'RAW' files can be imported. Please select a 'RAW-OSRTT.csv' file instead.", "Importer Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + throw new Exception("Importer Error"); } } } } - private void drawTable(DataGridView dgv, string type) + private void standardView() { - // 0 1 2 3 4 5 6 7 - // StartingRGB, EndRGB, Complete, Initial, Perceived, Overshoot, VRR, Latency - int indexToUse = 4; - switch (type) - { - case "perceived": - indexToUse = 4; - break; - case "initial": - indexToUse = 3; - break; - case "complete": - indexToUse = 2; - break; - case "overshoot": - indexToUse = 5; - break; - case "vrr": - indexToUse = 6; - break; - default: - indexToUse = 4; - break; - } - // Create string arrays for rows - List data = new List(); - for (int i = 0; i < RGBArr.Count; i++) - { - // Fill list with sized empty string arrays to address later - string[] line = new string[6]; - data.Add(line); - } - int current = 0; - int next = 1; - for (int k = 0; k < averageData.Count; k++) - { - if (next < RGBArr.Count) - { - if (averageData[k][0] == RGBArr[current]) - { - // current base - data[current][next] = averageData[k][indexToUse].ToString(); - } - else - { - // next - data[next][current] = averageData[k][indexToUse].ToString(); - next++; - } - } - else - { - current++; - next = current + 1; - if (averageData[k][0] == RGBArr[current]) - { - // current base - data[current][next] = averageData[k][indexToUse].ToString(); - } - else - { - // next - data[next][current] = averageData[k][indexToUse].ToString(); - next++; - } - } - Console.WriteLine("Current: " + current + ", Next: " + next + ", StartingRGB: " + averageData[k][0] + ", EndRGB: " + averageData[k][1]); - } - // Add string array to rows - foreach (var item in data) - { - dgv.Rows.Add(item); - } - int colourKeyIndex = 0; - if (indexToUse == 5) - { - colourKeyIndex = 1; - } - else if (indexToUse == 6) + viewToolStripMenuItem.Visible = true; + runSelectToolStrip.Visible = true; + runSelectToolStrip.Items.Clear(); + if (averageData.Count != 0) { - colourKeyIndex = 2; + runSelectToolStrip.Items.Add("Averaged Data"); + heatmaps1.setAverageData(averageData); } - for (int l = 0; l < dgv.Rows.Count; l++) + if (multipleRunsData.Count != 0) { - dgv.Rows[l].HeaderCell.Value = RGBArr[l].ToString(); - for (int p = 0; p < dgv.Columns.Count; p++) + for (int i = 0; i < multipleRunsData.Count; i++) { - if (dgv.Rows[l].Cells[p].Value != null) - { - // ARGB (153, 0, 255, 0) Green -> (153, 255, 255, 0) Yellow -> (153,255,0,0) Red - double cellValue = double.Parse(dgv.Rows[l].Cells[p].Value.ToString()); - Console.WriteLine(cellValue); - if (cellValue < colourKeys[colourKeyIndex].middle) - { - if (cellValue < colourKeys[colourKeyIndex].min) - { - // set min colour - DataGridViewCellStyle dv = dgv.Rows[l].Cells[p].InheritedStyle.Clone(); - dv.BackColor = Color.FromArgb(153, 0, 255, 0); - dgv.Rows[l].Cells[p].Style.ApplyStyle(dv); - } - else - { - // divide time (minus min) by range (average - min) - // times 255 by result of above - double range = colourKeys[colourKeyIndex].middle - colourKeys[colourKeyIndex].min; - double time = cellValue - colourKeys[colourKeyIndex].min; - double result = time / range; - double greenRGB = 255 * result; - greenRGB = Math.Round(greenRGB, 0); - DataGridViewCellStyle dv = dgv.Rows[l].Cells[p].InheritedStyle.Clone(); - dv.BackColor = Color.FromArgb(153, 0, Convert.ToInt32(greenRGB), 0); - dgv.Rows[l].Cells[p].Style.ApplyStyle(dv); - } - } - else - { - if (cellValue > colourKeys[colourKeyIndex].max) - { - // set max colour - DataGridViewCellStyle dv = dgv.Rows[l].Cells[p].InheritedStyle.Clone(); - dv.BackColor = Color.FromArgb(153, 255, 0, 0); - dgv.Rows[l].Cells[p].Style.ApplyStyle(dv); - } - else - { - // divide time (minus max) by range (max - average) - // times 255 by result of above - double range = colourKeys[colourKeyIndex].max - colourKeys[colourKeyIndex].middle; - double time = colourKeys[colourKeyIndex].max - cellValue; - double result = time / range; - double redRGB = 255 * result; - redRGB = Math.Round(redRGB, 0); - dgv.Rows[l].Cells[p].Style.BackColor = Color.FromArgb(153, Convert.ToInt32(redRGB), 0, 0); - DataGridViewCellStyle dv = dgv.Rows[l].Cells[p].InheritedStyle.Clone(); - dv.BackColor = Color.FromArgb(153, Convert.ToInt32(redRGB), 0, 0); - dgv.Rows[l].Cells[p].Style.ApplyStyle(dv); - } - } - } - else - { - Console.WriteLine("Cell value null"); - dgv.Rows[l].Cells[p].Style.BackColor = Color.Gray; - } + runSelectToolStrip.Items.Add("Run " + (i + 1).ToString()); } } - //SubItems.AddRange(data.ToArray()); - // Style cells? Probs not here. - // You can set the ListViewItem.BackColor property - } - - private void initGridViewColumns(DataGridView dgv) - { - if (dgv.Columns.Count != 0) - { - dgv.Columns.Clear(); - } - if (dgv.Rows.Count != 0) - { - dgv.Rows.Clear(); - } - dgv.SelectionChanged += gridView_SelectionChanged; - dgv.ColumnCount = 6; - dgv.BorderStyle = BorderStyle.FixedSingle; - dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(84, 157, 178, 189); - dgv.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(84, 157, 178, 189); - dgv.ColumnHeadersDefaultCellStyle.Font = new Font("Calibri", 14, FontStyle.Bold); - dgv.RowHeadersDefaultCellStyle.Font = new Font("Calibri", 14, FontStyle.Bold); - dgv.AdvancedColumnHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; - dgv.AdvancedRowHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; - dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; - dgv.RowHeadersDefaultCellStyle.ForeColor = Color.White; - dgv.RowsDefaultCellStyle.Font = new Font("Calibri", 14); - dgv.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; - dgv.RowsDefaultCellStyle.ForeColor = Color.White; - - dgv.CellFormatting += dgv_CellFormatting; - //dgv.RowsDefaultCellStyle.BackColor = Color.Gray; - // rtGridView.RowHeadersDefaultCellStyle.Padding = new Padding(rtGridView.RowHeadersWidth / 2 ); - for (int i = 0; i < RGBArr.Count; i++) + runSelectToolStrip.SelectedIndex = 0; + if (averageData.Count == 0 && multipleRunsData.Count != 0) { - dgv.Columns[i].Name = RGBArr[i].ToString(); + heatmaps1.setAverageData(multipleRunsData[0]); } - - for (int k = 0; k < dgv.Columns.Count; k++) + else if (averageData.Count == 0 && multipleRunsData.Count == 0) { - dgv.Columns[k].Width = 55; + throw new Exception("No Data"); } - } - - - private void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) - { - //Compare the value of second Column i.e. Column with Index 1. - DataGridView dgv = sender as DataGridView; - Console.WriteLine("Name: "+ dgv.Name); - if (dgv.Name.Contains("rt") && e.Value != null) + runSelectToolStrip.Visible = true; + if (initialResponseTimeToolStripMenuItem.Checked) { - //Fetch the value of the second Column. - double quantity = Convert.ToDouble(e.Value); - - //Apply Background color based on value. - if (quantity == 0) - { - e.CellStyle.BackColor = Color.Red; - } - if (quantity > 0 && quantity <= 50) - { - e.CellStyle.BackColor = Color.Yellow; - } - if (quantity > 50 && quantity <= 100) - { - e.CellStyle.BackColor = Color.Orange; - } - } - } - - - private void initStatsGridViewColumns(DataGridView dgv) - { - if (dgv.Columns.Count != 0) - { - dgv.Columns.Clear(); - } - if (dgv.Rows.Count != 0) - { - dgv.Rows.Clear(); - } - dgv.SelectionChanged += gridView_SelectionChanged; - dgv.ColumnCount = 2; - dgv.BorderStyle = BorderStyle.FixedSingle; - dgv.ColumnHeadersVisible = false; - dgv.RowHeadersVisible = false; - dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(84, 157, 178, 189); - dgv.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(84, 157, 178, 189); - dgv.ColumnHeadersDefaultCellStyle.Font = new Font("Calibri", 14, FontStyle.Bold); - dgv.RowHeadersDefaultCellStyle.Font = new Font("Calibri", 14, FontStyle.Bold); - dgv.AdvancedColumnHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; - dgv.AdvancedRowHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; - dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; - dgv.RowHeadersDefaultCellStyle.ForeColor = Color.White; - dgv.RowsDefaultCellStyle.Font = new Font("Calibri", 14); - dgv.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None; - dgv.RowsDefaultCellStyle.ForeColor = Color.White; - //dgv.RowsDefaultCellStyle.BackColor = Color.Gray; - // rtGridView.RowHeadersDefaultCellStyle.Padding = new Padding(rtGridView.RowHeadersWidth / 2 ); - for (int i = 0; i < RGBArr.Count; i++) - { - dgv.Columns[i].Name = RGBArr[i].ToString(); + heatmaps1.setRtIndex(3); } - - for (int k = 0; k < dgv.Columns.Count; k++) + else if (completeResponseTimeToolStripMenuItem.Checked) { - dgv.Columns[k].Width = 55; + heatmaps1.setRtIndex(2); } - } - - private void gridView_SelectionChanged(Object sender, EventArgs e) - { - DataGridView dgv = sender as DataGridView; - dgv.ClearSelection(); - Console.WriteLine(dgv.Name); - DataGridViewCellEventArgs cellEv = e as DataGridViewCellEventArgs; - // dgv.Rows[cellEv.RowIndex].Selected = false; - //sender.ClearSelection(); - } - - private void standardView() - { - try + else { - initGridViewColumns(rtGridView); - initGridViewColumns(osGridView); - initGridViewColumns(vrrGridView); + heatmaps1.setRtIndex(4); } - catch (Exception e) + if (runSettings != null) { - Console.WriteLine(e.Message + e.StackTrace); + heatmaps1.setRtMethod(runSettings.rtMethod); + heatmaps1.setOsMethod(runSettings.osMethod); + heatmaps1.setRunSettings(runSettings); } - - try + else { - drawTable(rtGridView, "perceived"); - drawTable(osGridView, "overshoot"); - drawTable(vrrGridView, "vrr"); + heatmaps1.setRtMethod(rtMethodologies[0]); // FALLBACK OPTION FOR NOW + heatmaps1.setOsMethod(osMethodologies[0]); // FALLBACK OPTION FOR NOW } - catch (Exception ex) + if (runSettings != null) { - Console.WriteLine(ex.Message + ex.StackTrace); + heatmaps1.setRunSettings(runSettings); } - // Set location, size, enabled/clickable/editable - // Draw averages - } - - private void completeView() - { - /*ListView perceivedResponseTime = new ListView(); - ListView overshoot = new ListView(); - ListView vrr = new ListView(); - ListView initialResponseTime = new ListView(); - ListView completeResponseTime = new ListView(); - // Set location, size, enabled/clickable/editable - drawTable(perceivedResponseTime, "perceived"); - drawTable(overshoot, "overshoot"); - drawTable(vrr, "vrr"); - drawTable(initialResponseTime, "initial"); - drawTable(completeResponseTime, "complete"); - */ - // Draw averages + heatmaps1.standardView(); } - private void graphView() { // Clear view/import panel @@ -613,9 +377,10 @@ private void graphView() // Draw graph if (rawData.Count != 0) { - Size = new Size(1400, 800); + Size = new Size(Size.Width, (Size.Height + 20)); graphViewPanel.Location = new Point(5, 52); drawGraph(0, 0); + showProcessedData(); } else { @@ -653,12 +418,12 @@ private void drawGraph(int arrayIndex, int resultIndex) { resultIndex = 0; } - int startingRGB = rawData[arrayIndex][resultIndex][0]; - int endRGB = rawData[arrayIndex][resultIndex][1]; - int sampleTime = rawData[arrayIndex][resultIndex][2]; - int sampleCount = rawData[arrayIndex][resultIndex][3]; - double averageTime = sampleTime / sampleCount; - double[] resultData = rawData[arrayIndex][resultIndex].Skip(4).Select(x => (double)x).ToArray(); + int startingRGB = rawData[arrayIndex][resultIndex].StartingRGB; + int endRGB = rawData[arrayIndex][resultIndex].EndRGB; + int sampleTime = rawData[arrayIndex][resultIndex].TimeTaken; + int sampleCount = rawData[arrayIndex][resultIndex].SampleCount; + double averageTime = rawData[arrayIndex][resultIndex].SampleTime; + double[] resultData = rawData[arrayIndex][resultIndex].Samples.Select(x => (double)x).ToArray(); double[] timeData = new double[resultData.Length]; for (int i = 0; i < timeData.Length; i++) { @@ -681,7 +446,15 @@ private void drawGraph(int arrayIndex, int resultIndex) graphedData.Refresh(); //showProcessedData(); } - + private void onSpanDrag(object sender, EventArgs e) + { + var hSpan = sender as ScottPlot.Plottable.HSpan; + double newTime = hSpan.X2 - hSpan.X1; + newTime = Math.Round(newTime, 1); + rtLabel.Text = newTime.ToString() + " ms"; + rtTypeLabel.Text = "Manual"; + Console.WriteLine(hSpan.X1 + "" + hSpan.X2); + } static Coordinate MoveBetweenAdjacent(List xs, List ys, int index, Coordinate requested) { int leftIndex = Math.Max(index - 1, 0); @@ -698,9 +471,10 @@ private void handleResultsList(int arrayIndex) { if (rawData.Count != 0) { + transSelect1.Items.Clear(); foreach (var i in rawData[arrayIndex]) { - transSelect1.Items.Add("RGB " + i[0] + " to RGB " + i[1]); + transSelect1.Items.Add("RGB " + i.StartingRGB + " to RGB " + i.EndRGB); } transSelect1.SelectedIndex = 0; } @@ -714,6 +488,7 @@ private void handleRunsList() { if (rawData.Count != 0) { + runSelectBox.Items.Clear(); for (int i = 0; i < rawData.Count; i++) { runSelectBox.Items.Add("Run " + (i + 1).ToString()); @@ -730,98 +505,110 @@ private void importView() { // Clear view/graph panel // Move import panel in view - Size = new Size(1400, 800); + Size = new Size(1100, 420); importPanel.Location = new Point(5, 52); + importViewMenuButton.Checked = true; } private void stdResultsMenuBtn_Click(object sender, EventArgs e) { - standardView(); BackColor = Color.White; + Size = new Size(1800, 1050); + saveHeatmapsToolStripMenuItem.Visible = true; importPanel.Location = new Point(1500, 52); graphViewPanel.Location = new Point(1439, 762); - standardResultsPanel.Location = new Point(5, 52); - allResultsMenuBtn.Checked = false; + stdResultsMenuBtn.Visible = true; + stdResultsMenuBtn.Checked = true; + heatmaps1.Location = new Point(5, 52); + heatmaps1.Visible = true; + importPanel.Visible = false; + graphViewPanel.Visible = false; + if (rawData.Count != 0) + { + graphViewMenuBtn.Visible = true; + } + else + { + graphViewMenuBtn.Visible = false; + } graphViewMenuBtn.Checked = false; importViewMenuButton.Checked = false; - } - private void allResultsMenuBtn_Click(object sender, EventArgs e) - { - if (allResultsMenuBtn.Checked) + viewToolStripMenuItem.Visible = true; + toolStripSeparator1.Visible = true; + try { - stdResultsMenuBtn.Checked = false; - allResultsMenuBtn.Checked = true; - graphViewMenuBtn.Checked = false; - importViewMenuButton.Checked = false; + standardView(); } - else + catch (Exception ex) { - completeView(); - Size = new Size(1400, 800); - stdResultsMenuBtn.Checked = false; - allResultsMenuBtn.Checked = true; - graphViewMenuBtn.Checked = false; - importViewMenuButton.Checked = false; + MessageBox.Show(ex.Message + ex.StackTrace, "Heatmaps View Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void graphViewMenuBtn_Click(object sender, EventArgs e) { - if (graphViewMenuBtn.Checked) + try { - stdResultsMenuBtn.Checked = false; - allResultsMenuBtn.Checked = false; - graphViewMenuBtn.Checked = true; - graphViewMenuBtn.Visible = true; - importViewMenuButton.Checked = false; + graphView(); } - else + catch (Exception ex) { - graphView(); - importPanel.Location = new Point(1439, 762); - graphViewPanel.Location = new Point(5, 52); - standardResultsPanel.Location = new Point(1439, 52); - BackColor = System.Drawing.ColorTranslator.FromHtml("#2e3440"); - stdResultsMenuBtn.Checked = false; - allResultsMenuBtn.Checked = false; - graphViewMenuBtn.Checked = true; - graphViewMenuBtn.Visible = true; - importViewMenuButton.Checked = false; + MessageBox.Show(ex.Message + ex.StackTrace, "Graph View Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } + importPanel.Location = new Point(1439, 762); + graphViewPanel.Location = new Point(5, 52); + heatmaps1.Location = new Point(1395, 55); + heatmaps1.Visible = false; + graphViewPanel.Visible = true; + importPanel.Visible = false; + saveHeatmapsToolStripMenuItem.Visible = false; + Size = new Size(1400, 800); + //Size = new Size(Size.Width, (Size.Height + 15)); + BackColor = System.Drawing.ColorTranslator.FromHtml("#2e3440"); + stdResultsMenuBtn.Checked = false; + graphViewMenuBtn.Checked = true; + graphViewMenuBtn.Visible = true; + importViewMenuButton.Checked = false; + viewToolStripMenuItem.Visible = true; + runSelectToolStrip.Visible = false; + toolStripSeparator3.Visible = true; } private void importViewMenuButton_Click(object sender, EventArgs e) { - if (importViewMenuButton.Checked) - { - stdResultsMenuBtn.Checked = false; - allResultsMenuBtn.Checked = false; - graphViewMenuBtn.Checked = false; - importViewMenuButton.Checked = true; - } - else - { - importView(); - Size = new Size(1400, 800); - importPanel.Location = new Point(5, 52); - graphViewPanel.Location = new Point(1439, 762); - standardResultsPanel.Location = new Point(1439, 52); - stdResultsMenuBtn.Checked = false; - allResultsMenuBtn.Checked = false; - graphViewMenuBtn.Checked = false; - importViewMenuButton.Checked = true; - } + importView(); + Size = new Size(1100, 420); + BackColor = SystemColors.ControlDark; + importPanel.Location = new Point(5, 52); + importPanel.Visible = true; + graphViewPanel.Location = new Point(1439, 762); + graphViewPanel.Visible = false; + heatmaps1.Location = new Point(1395, 55); + heatmaps1.Visible = false; + saveHeatmapsToolStripMenuItem.Visible = false; + stdResultsMenuBtn.Checked = false; + graphViewMenuBtn.Checked = false; + importViewMenuButton.Checked = true; + viewToolStripMenuItem.Visible = false; + runSelectToolStrip.Visible = false; } private void transSelect1_SelectedIndexChanged(object sender, EventArgs e) { - drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); - showProcessedData(); + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); + showProcessedData(); + } } private void importGraphBtn_Click(object sender, EventArgs e) { importRawData(); + graphViewMenuBtn_Click(null, null); + handleRunsList(); + handleResultsList(runSelectBox.SelectedIndex); } private void resetGraphBtn_Click(object sender, EventArgs e) @@ -829,959 +616,56 @@ private void resetGraphBtn_Click(object sender, EventArgs e) drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); showProcessedData(); } - - private List processGammaTable() + private void showProcessedData() { - if (gamma.Count == 0) - { - if (!Properties.Settings.Default.SuppressDiagBox) - { - MessageBox.Show("No Gamma data is stored in the program.", "Gamma Table Processing Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - return null; - } - else + if (rawData.Count != 0) { - noiseLevel.Clear(); - double[] rgbVals = new double[gamma.Count]; - double[] lightLevelVals = new double[gamma.Count]; - for (int i = 0; i < gamma.Count; i++) + try { - int[] dataLine = gamma[i].Skip(300).ToArray(); - int lineAverage = 0; - for (int j = 0; j < (dataLine.Length - 100); j++) + int resInd = transSelect1.SelectedIndex; + if (resInd < 0) { - lineAverage += dataLine[j]; + resInd = 0; } - noiseLevel.Add(new int[] { gamma[i][0], (dataLine.Max() - dataLine.Min()) }); - lineAverage /= (dataLine.Length - 100); - rgbVals[i] = gamma[i][0]; - lightLevelVals[i] = lineAverage; - } - int pointsBetween = 51; - if (gamma.Count == 16) - { - pointsBetween = 17; - } - var interpPoints = new ScottPlot.Statistics.Interpolation.NaturalSpline(rgbVals, lightLevelVals, pointsBetween); - List x = new List(); - List y = new List(); - foreach (var p in interpPoints.interpolatedXs) - { - x.Add(Convert.ToInt32(p)); - } - foreach (var p in interpPoints.interpolatedYs) - { - y.Add(Convert.ToInt32(p)); - } - List xy = new List(); - for (int k = 0; k < x.Count; k++) - { - xy.Add(new int[] { x[k], y[k] }); - } - return xy; - } - } - - private void processTestLatency() - { - - if (testLatency.Count != 0) - { - int[] tl = testLatency.Skip(5).ToArray(); - for (int n = 0; n < tl.Length; n++) - { - if (tl[n] > 8000) + int arrInd = runSelectBox.SelectedIndex; + if (arrInd < 0) { - if (n <= 150 && n > 30) - { - startDelay = n - 30; - } - else if (n < 30) - { - n /= 2; - startDelay = n; - } - else if (n > 400) - { - startDelay = 250; - } - break; + arrInd = 0; } - } - } - } - - private processedResult ProcessResponseTimeData(resultSelection res) - { - //This is a long one. This is the code that builds the gamma curve, finds the start/end points and calculates response times and overshoot % (gamma corrected) - List processedData = new List(); - - // First, create gamma array from the data - List localGamma = new List(); - List fullGammaTable = new List(); - List smoothedDataTable = new List(); - int noise = 0; - - try //Wrapped whole thing in try just in case - { - // Save start, end, time and sample count then clear the values from the array - int StartingRGB = rawData[res.arrayIndex][res.resultIndex][0]; - int EndRGB = rawData[res.arrayIndex][res.resultIndex][1]; - int TimeTaken = rawData[res.arrayIndex][res.resultIndex][2]; - int SampleCount = rawData[res.arrayIndex][res.resultIndex][3]; - int[] samples = rawData[res.arrayIndex][res.resultIndex].Skip(4).ToArray(); - - double SampleTime = ((double)TimeTaken / (double)SampleCount); // Get the time taken between samples - - // Clean up noisy data using moving average function - int period = 10; - foreach (var n in noiseLevel) - { - if (n[0] == StartingRGB || n[0] == EndRGB) + string rtType = "perceived"; + if (perceivedResponseTimeToolStripMenuItem.Checked) { - noise = n[1]; - break; + rtType = "perceived"; + rtTypeLabel.Text = "Perceived"; } - } - if (noise < 250) - { - period = 20; - } - else if (noise < 500) - { - period = 30; - } - else if (noise < 750) - { - period = 40; - } - else - { - period = 50; - } - int[] buffer = new int[period]; - int[] averagedSamples = new int[samples.Length]; - int current_index = 0; - for (int a = 0; a < samples.Length; a++) - { - buffer[current_index] = samples[a] / period; - int movAvg = 0; - for (int b = 0; b < period; b++) + else if (initialResponseTimeToolStripMenuItem.Checked) { - movAvg += buffer[b]; + rtType = "initial"; + rtTypeLabel.Text = "Initial"; } - averagedSamples[a] = movAvg; - current_index = (current_index + 1) % period; - } - - samples = averagedSamples.Skip(period).ToArray(); //Moving average spoils the first 10 samples so currently removing them. - - List fullSmoothedLine = new List { StartingRGB, EndRGB, TimeTaken, SampleCount }; - fullSmoothedLine.AddRange(samples); - smoothedDataTable.Add(fullSmoothedLine.ToArray()); - - int maxValue = samples.Max(); // Find the maximum value for overshoot - int minValue = samples.Min(); // Find the minimum value for undershoot - // Initialise in-use variables - int transStart = 0; - int transEnd = 0; - int initialTransStart = 0; - int initialTransEnd = 0; - int perceivedTransStart = 0; - int perceivedTransEnd = 0; - - double overUnderRGB = 0.0; - - int startMax = samples[5]; // Initialise these variables with a real value - int startMin = samples[5]; // Initialise these variables with a real value - int endMax = samples[samples.Length - 10]; // Initialise these variables with a real value - int endMin = samples[samples.Length - 10]; // Initialise these variables with a real value - - // Build start min/max to compare against - for (int l = 0; l < startDelay; l++) //CHANGE TO 180 FOR RUN 2 DATA - { - if (samples[l] < startMin) - { - startMin = samples[l]; - } - else if (samples[l] > startMax) - { - startMax = samples[l]; - } - } - - // Build end min/max to compare against - for (int m = samples.Length - 5; m > samples.Length - 150; m--) - { - if (samples[m] < endMin) - { - endMin = samples[m]; - } - else if (samples[m] > endMax) - { - endMax = samples[m]; - } - } - - // Search for where the result starts transitioning - start is almost always less sensitive - for (int j = 0; j < samples.Length; j++) - { - if (StartingRGB < EndRGB) - { - if (samples[j] > (startMax)) - { - if (StartingRGB == 0 && EndRGB == 26) - { - if ((samples[j + 50] > (samples[j] + 25) || samples[j + 56] > (samples[j] + 25)) - && (samples[j + 100] > (samples[j] + 50) || samples[j + 106] > (samples[j] + 50)) - && (samples[j + 125] > (samples[j] + 75) || samples[j + 131] > (samples[j] + 75)) - && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] > startMax) - { - startMax = samples[j]; - } - } - } - else - { - if ((samples[j + 50] > (samples[j] + 50) || samples[j + 56] > (samples[j] + 50)) - && (samples[j + 100] > (samples[j] + 100) || samples[j + 106] > (samples[j] + 100)) - && (samples[j + 125] > (samples[j] + 100) || samples[j + 131] > (samples[j] + 100)) - && (samples[j + 150] > (samples[j] + 100) || samples[j + 156] > (samples[j] + 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] > startMax) - { - startMax = samples[j]; - } - } - } - } - } - else - { - if (samples[j] < (startMin)) - { - if (StartingRGB == 26 && EndRGB == 0) - { - if ((samples[j + 50] < (samples[j] - 25) || samples[j + 56] < (samples[j] - 25)) - && (samples[j + 100] < (samples[j] - 50) || samples[j + 106] < (samples[j] - 50)) - && (samples[j + 125] < (samples[j] - 75) || samples[j + 131] < (samples[j] - 75)) - && (samples[j + 150] < (samples[j] - 100) || samples[j + 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] < startMin) - { - startMin = samples[j]; - } - } - } - else - { - if ((samples[j + 50] < (samples[j] - 50) || samples[j + 56] < (samples[j] - 50)) - && (samples[j + 100] < (samples[j] - 100) || samples[j + 106] < (samples[j] - 100)) - && (samples[j + 125] < (samples[j] - 100) || samples[j + 131] < (samples[j] - 100)) - && (samples[j + 150] < (samples[j] - 100) || samples[j + 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise - { - transStart = j; - break; - } - else - { - if (samples[j] < startMin) - { - startMin = samples[j]; - } - } - } - } - } - } - - // Search for where the result stops transitioning (from the end) - end position is almost always more sensitive hence lower values - also must account for over/undershoot - for (int j = samples.Length - 1; j > 0; j--) - { - if (StartingRGB < EndRGB) + else if (completeResponseTimeToolStripMenuItem.Checked) { - if (maxValue > (endMax + 100)) //Check for overshoot - { - if (samples[j] > endMax) - { - if (samples[j - 100] > (samples[j] + 50) && samples[j - 125] > (samples[j] + 50)) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] > endMax) - { - endMax = samples[j]; - } - } - } - } - else - { - if (samples[j] <= (endMin + 20)) //Check for regular finish point - { - if (StartingRGB == 0 && EndRGB == 26) - { - if ((samples[j - 100] < (samples[j] - 25) || samples[j - 106] < (samples[j] - 25)) - && (samples[j - 125] < (samples[j] - 50) || samples[j - 131] < (samples[j] - 50)) - && (samples[j - 150] < (samples[j] - 75) || samples[j - 156] < (samples[j] - 75))) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] < endMin) - { - endMin = samples[j]; - } - } - } - else - { - if ((samples[j - 100] < (samples[j] - 50) || samples[j - 106] < (samples[j] - 50)) - && (samples[j - 125] < (samples[j] - 75) || samples[j - 131] < (samples[j] - 75)) - && (samples[j - 150] < (samples[j] - 100) || samples[j - 156] < (samples[j] - 100))) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] < endMin) - { - endMin = samples[j]; - } - } - } - } - } + rtType = "complete"; + rtTypeLabel.Text = "Complete"; } - else + // make view button change this + ProcessData pd = new ProcessData(); + int startDelay = pd.processTestLatency(testLatency); + ProcessData.graphResult proc = pd.processGraphResult(rawData, new ProcessData.resultSelection { - if (minValue < (endMin - 100)) //Check for undershoot - { - if (samples[j] < endMin) //Check for under-shot finish point - { - if (samples[j - 100] < (samples[j] - 50) && samples[j - 125] < (samples[j] - 50)) // check the trigger point is actually the trigger and not noise - { - transEnd = j; - break; - } - else - { - if (samples[j] < endMin) - { - endMin = samples[j]; - } - } - } - } - else - { - if (samples[j] > endMax) //Check for regular finish point - { - if (StartingRGB == 26 && EndRGB == 0) - { - if ((samples[j - 100] > (samples[j] + 25) || samples[j - 106] > (samples[j] + 25)) - && (samples[j - 125] > (samples[j] + 50) || samples[j - 131] > (samples[j] + 50)) - && (samples[j - 150] > (samples[j] + 75) || samples[j - 156] > (samples[j] + 75))) - { - transEnd = j; - break; - } - else - { - if (samples[j] > endMax) - { - endMax = samples[j]; - } - } - } - else - { - if ((samples[j - 100] > (samples[j] + 50) || samples[j - 106] > (samples[j] + 50)) - && (samples[j - 125] > (samples[j] + 75) || samples[j - 131] > (samples[j] + 75)) - && (samples[j - 150] > (samples[j] + 100) || samples[j - 156] > (samples[j] + 100))) - { - transEnd = j; - break; - } - else - { - if (samples[j] > endMax) - { - endMax = samples[j]; - } - } - } - } - } - } - } - double startAverage = 0; - double endAverage = 0; - int avgStart = transStart - 200; - int avgEnd = transEnd + 400; - if (transStart < 200) - { - int t = transStart / 5; - avgStart = transStart - t; - } - if ((samples.Length - transEnd) < 400) - { - int t = (samples.Length - transEnd) / 5; - avgEnd = transEnd + t; - } - for (int q = 0; q < avgStart; q++) - { - startAverage += samples[q]; - } - startAverage /= avgStart; - startAverage = Math.Round(startAverage, 0); - for (int q = avgEnd; q < samples.Length; q++) - { - endAverage += samples[q]; - } - endAverage /= (samples.Length - avgEnd); - endAverage = Math.Round(endAverage, 0); - int arrSize = (transEnd - transStart + 100); - if (samples.Length < (transEnd + 100)) - { - arrSize = samples.Length - transStart; - } - if (arrSize < 110) - { - arrSize = 200; - } - int[] transitionSamples = new int[arrSize]; - // Getting min/max from INSIDE the transition window - if ((transEnd - transStart) != 0) - { - Array.Copy(samples, transStart, transitionSamples, 0, arrSize); - maxValue = transitionSamples.Max(); - minValue = transitionSamples.Min(); - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Overshoot calculations - double overshootPercent = 0; - double overshootRGBDiff = 0; - double peakValue = 0; - if (StartingRGB < EndRGB) - { - peakValue = maxValue; - // Dark to light transition - if (maxValue > (endAverage + 100) && maxValue > (processedGamma[EndRGB][1] + 100)) - { - // undershoot may have occurred - Console.WriteLine("Overshoot found"); - // convert maxValue to RGB using gamma table - for (int i = 0; i < processedGamma.Count; i++) - { - // Find what RGB value matches or exceeds the peak light reading for this run - if (maxValue <= processedGamma[i][1]) - { - // Check if peak light reading is closer to upper or lower bound value - int diff1 = processedGamma[i][1] - maxValue; - int diff2 = maxValue - processedGamma[i - 1][1]; - if (diff1 < diff2) - { - overUnderRGB = processedGamma[i][0]; - } - else - { - overUnderRGB = processedGamma[i - 1][0]; - } - break; - } - else if (maxValue > processedGamma.Last()[1]) - { - if (maxValue > 65500) - { - overUnderRGB = 260; - break; - } - else - { - overUnderRGB = 256; - break; - } - } - } - if (overUnderRGB == -1) - { - //overshootPercent = 100; - } - else - { - overshootRGBDiff = overUnderRGB - EndRGB; - double os = 0; - if (res.osStyle.endPercent) - { - os = (overUnderRGB - EndRGB) / EndRGB; - } - else - { - double range = EndRGB - StartingRGB; - os = overshootRGBDiff / range; - } - os *= 100; - overshootPercent = Math.Round(os, 1); - } - } - } - else - { - peakValue = minValue; - // Light to dark transistion - if (minValue < (endAverage - 100) && minValue < (processedGamma[EndRGB][1] - 100)) - { - // overshoot may have occurred - // convert minValue to RGB using gamma table - Console.WriteLine("Undershoot found"); - for (int i = 0; i < processedGamma.Count; i++) - { - // Find what RGB value matches or exceeds the peak light reading for this run - if (minValue <= processedGamma[i][1]) - { - if (i == 0) - { - overUnderRGB = 0; - break; - } - else - { - // Check if peak light reading is closer to upper or lower bound value - int diff1 = processedGamma[i][1] - minValue; - int diff2 = minValue - processedGamma[i - 1][1]; - if (diff1 < diff2) - { - overUnderRGB = processedGamma[i][0]; - } - else - { - overUnderRGB = processedGamma[i - 1][0]; - } - break; - } - } - } - overshootRGBDiff = EndRGB - overUnderRGB; - double os = 0; - if (res.osStyle.endPercent) - { - os = (EndRGB - overUnderRGB) / EndRGB; - } - else - { - double range = StartingRGB - EndRGB; - os = overshootRGBDiff / range; - } - // os *= -1; - os *= 100; - overshootPercent = Math.Round(os, 1); - if (overshootPercent != 0 && overshootPercent < 1) - { - overshootPercent = 0; - } - } - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // INITIAL AND PERCEIVED RESPONSE TIME MEASUREMENTS - if (StartingRGB < EndRGB) - { - // Setup variables for start/end trigger points - double start3 = 0; - double endOffsetRGB = 0; - double end3 = 0; - double endPer3 = 0; - double RGBTolerance = res.rtStyle.Tolerance; - double tol = res.rtStyle.Tolerance / 100; - if (!res.rtStyle.gammaCorrected) - { - double range3 = (endAverage - startAverage) * tol; // Subtract low value from high value to get light level range - start3 = startAverage + range3; // Start trigger value - end3 = endAverage - range3; - if (peakValue > (endAverage + range3)) - { endPer3 = endAverage + range3; } // End trigger value - else - { endPer3 = endAverage - range3; } // End trigger value - } - else - { - if (res.rtStyle.percentage) - { - RGBTolerance = (EndRGB - StartingRGB) * tol; - RGBTolerance = Math.Round(RGBTolerance, 0); - } - endOffsetRGB = EndRGB - RGBTolerance; - start3 = processedGamma[Convert.ToInt32(StartingRGB + RGBTolerance)][1]; - end3 = processedGamma[Convert.ToInt32(EndRGB - RGBTolerance)][1]; - if (overUnderRGB > (EndRGB + RGBTolerance) && overUnderRGB != 0) - { endOffsetRGB = EndRGB + RGBTolerance; } - else if (overUnderRGB == -1) - { endOffsetRGB = EndRGB; } - endPer3 = processedGamma[Convert.ToInt32(endOffsetRGB)][1]; - if (overUnderRGB == -1) - { endPer3 *= 1.02; } - - } - if (endPer3 >= 65520) - { endPer3 = 65500; } - - // Actually find the start/end points - for (int j = (transStart - 20); j < (transEnd + 20); j++) // search samples for start & end trigger points - { - if (samples[j] >= start3 && initialTransStart == 0) // save the FIRST time value exceeds start trigger - { - if ((samples[j + 50] > (start3 + 25) || samples[j + 60] > (start3 + 25)) - && (samples[j + 100] > (start3 + 50) || samples[j + 110] > (start3 + 50)) - && (samples[j + 150] > (start3 + 75) || samples[j + 160] > (start3 + 75))) - { - initialTransStart = j; - perceivedTransStart = j; - } - else if (j == transEnd) - { - initialTransStart = transStart; - perceivedTransStart = transStart; - } - } - else if (samples[j] >= end3) // Save when value exceeds end trigger then break. - { - if ((samples[j + 20] > (end3 + 25) || samples[j + 25] > (end3 + 25)) - && (samples[j + 30] > (end3 + 50) || samples[j + 35] > (end3 + 50)) - && (samples[j + 50] > (end3 + 75) || samples[j + 55] > (end3 + 75))) - { - initialTransEnd = j; - break; - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - for (int j = (transEnd + 20); j > (transStart - 20); j--) // search samples for end point - { - if (endOffsetRGB > EndRGB || overUnderRGB == -1 || (endOffsetRGB == 0 && endPer3 > endAverage && overshootPercent > 1)) // Including overshoot in the curve - { - if (samples[j] >= endPer3) // add the same sort of more detailed check like complete for finding this - { - if ((samples[j - 25] > (endPer3 + 25) || samples[j - 30] > (endPer3 + 25)) - && (samples[j - 35] > (endPer3 + 50) || samples[j - 40] > (endPer3 + 50))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - else // No overshoot found within RGB tolerance - { - if (samples[j] <= endPer3) - { - if ((samples[j - 50] < (endPer3 - 25) || samples[j - 60] < (endPer3 - 25)) - && (samples[j - 100] < (endPer3 - 50) || samples[j - 110] < (endPer3 - 50)) - && (samples[j - 150] < (endPer3 - 75) || samples[j - 160] < (endPer3 - 75))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - } - if (perceivedTransEnd < initialTransEnd) - { // just in case the two methods differ slightly and perceived would come out as shorter. - perceivedTransEnd = initialTransEnd; - } - } - else - { - // Setup variables for start/end trigger points - double start3 = 0; - double endOffsetRGB = 0; - double end3 = 0; - double endPer3 = 0; - double RGBTolerance = res.rtStyle.Tolerance; - double tol = res.rtStyle.Tolerance / 100; - if (!res.rtStyle.gammaCorrected) - { - double range3 = (startAverage - endAverage) * tol; // Subtract low value from high value to get light level range - start3 = startAverage - range3; // Start trigger value - end3 = endAverage + range3; - if (peakValue < (endAverage - range3)) - { endPer3 = endAverage - range3; } // End trigger value - else - { endPer3 = endAverage + range3; } // End trigger value - } - else - { - if (res.rtStyle.percentage) - { - RGBTolerance = (StartingRGB - EndRGB) * tol; - RGBTolerance = Math.Round(RGBTolerance, 0); - } - endOffsetRGB = EndRGB + RGBTolerance; - start3 = processedGamma[Convert.ToInt32(StartingRGB - RGBTolerance)][1]; - end3 = processedGamma[Convert.ToInt32(EndRGB + RGBTolerance)][1]; - if (overUnderRGB < (EndRGB - RGBTolerance) && overUnderRGB != 0) - { - endOffsetRGB = EndRGB - RGBTolerance; - } - endPer3 = processedGamma[Convert.ToInt32(endOffsetRGB)][1]; - } - - for (int j = (transStart - 20); j < (transEnd + 20); j++) // search samples for start point - { - if (samples[j] <= start3 && initialTransStart == 0) // save the FIRST time value exceeds start trigger - { - if ((samples[j + 50] < (start3 - 25) || samples[j + 60] < (start3 - 25)) - && (samples[j + 100] < (start3 - 50) || samples[j + 110] < (start3 - 50)) - && (samples[j + 150] < (start3 - 75) || samples[j + 160] < (start3 - 75))) - { - initialTransStart = j; - perceivedTransStart = j; - } - else if (j == transEnd) - { - initialTransStart = transStart; - perceivedTransStart = transStart; - } - } - else if (samples[j] <= end3) // Save when value exceeds end trigger then break. - { - if ((samples[j + 50] < (end3 - 25) || samples[j + 60] < (end3 - 25)) - && (samples[j + 100] < (end3 - 50) || samples[j + 110] < (end3 - 50)) - && (samples[j + 150] < (end3 - 75) || samples[j + 160] < (end3 - 75))) - { - initialTransEnd = j; - break; - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - else if (j == transEnd) - { - initialTransEnd = transEnd; - break; - } - } - for (int j = (transEnd + 20); j > (transStart - 20); j--) // search samples for end point - { - if ((endOffsetRGB < EndRGB && endOffsetRGB != 0) || (endPer3 < endAverage && endOffsetRGB == 0 && overshootPercent > 1)) // Including undershoot in the curve - { - if (samples[j] <= endPer3) - { - if ((samples[j - 20] < (endPer3 - 25) || samples[j - 25] < (endPer3 - 25)) - && (samples[j - 30] < (endPer3 - 50) || samples[j - 35] < (endPer3 - 50))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - else // No overshoot found within RGB tolerance - { - if (samples[j] >= endPer3) - { - - if ((samples[j - 50] > (endPer3 + 25) || samples[j - 60] > (endPer3 + 25)) - && (samples[j - 100] > (endPer3 + 50) || samples[j - 110] > (endPer3 + 50)) - && (samples[j - 150] > (endPer3 + 75) || samples[j - 160] > (endPer3 + 75))) - { - perceivedTransEnd = j; - break; - } - } - else if (j == transStart) - { - perceivedTransEnd = j; - break; - } - } - } - if (perceivedTransEnd < initialTransEnd) - { // just in case the two methods differ slightly and perceived would come out as shorter. - perceivedTransEnd = initialTransEnd; - } - } - - double transCount = transEnd - transStart; - double transTime = (transCount * SampleTime) / 1000; - - double initialTransCount = initialTransEnd - initialTransStart; - double initialTransTime = (initialTransCount * SampleTime) / 1000; - - double perceivedTransCount = perceivedTransEnd - perceivedTransStart; - double perceivedTransTime = (perceivedTransCount * SampleTime) / 1000; - - double inputLagTime = (transStart * SampleTime) / 1000; - - double responseTime = Math.Round(transTime, 1); - double initialResponseTime = Math.Round(initialTransTime, 1); - double perceivedResponseTime = Math.Round(perceivedTransTime, 1); - - double visualResponseRating = 100 - (initialResponseTime + perceivedResponseTime); - - double inputLag = Math.Round(inputLagTime, 1); - - - if (res.osStyle.gammaCorrected && (!res.osStyle.endPercent || !res.osStyle.rangePercent)) - { - // Standard output with total transition time & gamma corrected overshoot value - if (overUnderRGB == -1) - { - overshootRGBDiff = 100; - } - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootRGBDiff, visualResponseRating, inputLag }; - processedData.Add(completeResult); - - return new processedResult { Time = perceivedResponseTime, startIndex = perceivedTransStart, endIndex = perceivedTransEnd, Overshoot = overshootRGBDiff }; - } - else if (res.osStyle.endPercent || res.osStyle.rangePercent) - { - // Standard output with total transition time & overshoot light level percentage - double os = 0; - if (res.osStyle.gammaCorrected) - { - peakValue = overUnderRGB; - endAverage = EndRGB; - startAverage = StartingRGB; - } - if (res.osStyle.endPercent) + arrayIndex = arrInd, + resultIndex = resInd, + rtStyle = rtMethodologies[processTypeListBox.SelectedIndex], + osStyle = osMethodologies[overshootStyleListBox.SelectedIndex] + }, startDelay, processedGamma, rtType); + try { - if (StartingRGB < EndRGB) - { - if (peakValue > (endAverage + 100)) - { - os = (peakValue - endAverage) / endAverage; - os *= 100; - os = Math.Round(os, 1); - } - } - else - { - if (peakValue < (endAverage - 100)) - { - os = (endAverage - peakValue) / endAverage; - // os *= -1; - os *= 100; - os = Math.Round(os, 1); - } - } + rtLabel.Text = proc.Time.ToString() + " ms"; } - else + catch (Exception err) { - if (StartingRGB < EndRGB) - { - if (peakValue > (endAverage + 100)) - { - double range = endAverage - startAverage; - double peakRange = peakValue - endAverage; - os = peakRange / range; - os *= 100; - os = Math.Round(os, 1); - } - } - else - { - if (peakValue < (endAverage - 100)) - { - double range = startAverage - endAverage; - double peakRange = endAverage - peakValue; - os = peakRange / range; - // os *= -1; - os *= 100; - os = Math.Round(os, 1); - } - } + Console.WriteLine(err.Message + err.StackTrace); } - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, os, visualResponseRating, inputLag }; - processedData.Add(completeResult); - return new processedResult { Time = perceivedResponseTime, startIndex = perceivedTransStart, endIndex = perceivedTransEnd, Overshoot = os }; - } - else - { - // Standard output with total transition time & gamma corrected overshoot percentage - double[] completeResult = new double[] { StartingRGB, EndRGB, responseTime, initialResponseTime, perceivedResponseTime, overshootPercent, visualResponseRating, inputLag }; - processedData.Add(completeResult); - - return new processedResult { Time = perceivedResponseTime, startIndex = perceivedTransStart, endIndex = perceivedTransEnd, Overshoot = overshootPercent }; - } - } - catch (Exception procEx) - { - Console.WriteLine(procEx.Message + procEx.StackTrace); - return null; - } - } - - private void showProcessedData() - { - if (rawData.Count != 0) - { - try - { - int resInd = transSelect1.SelectedIndex; - if (resInd < 0) - { - resInd = 0; - } - processedResult proc = ProcessResponseTimeData(new resultSelection - { - arrayIndex = runSelectBox.SelectedIndex, - resultIndex = resInd, - rtStyle = rtMethodologies[processTypeListBox.SelectedIndex], - osStyle = osMethodologies[overshootStyleListBox.SelectedIndex] - }); - rtLabel.Text = proc.Time.ToString() + " ms"; - rtTypeLabel.Text = "Perceived"; if (osMethodologies[overshootStyleListBox.SelectedIndex].endPercent || osMethodologies[overshootStyleListBox.SelectedIndex].rangePercent) { osLabel.Text = proc.Overshoot.ToString() + "%"; @@ -1795,10 +679,10 @@ private void showProcessedData() double resTime = Convert.ToDouble(testLatency[2]); double sampleCount = Convert.ToDouble(testLatency[3]); double sampleTime = resTime / sampleCount; - double start = proc.startIndex * sampleTime; + double start = ((proc.startIndex + proc.offset) * sampleTime); start /= 1000; start = Math.Round(start, 2); - double end = proc.endIndex * sampleTime; + double end = ((proc.endIndex + proc.offset) * sampleTime); end /= 1000; end = Math.Round(end, 2); var hSpan = graphedData.Plot.AddHorizontalSpan(start, end); @@ -1808,42 +692,44 @@ private void showProcessedData() graphedData.Plot.Render(); graphedData.Refresh(); latencyLabel.Text = start.ToString() + " ms"; - } catch (Exception ex) { + MessageBox.Show(ex.Message + ex.StackTrace, "Failed to Process Data", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message + ex.StackTrace); } } } - private void onSpanDrag(object sender, EventArgs e) - { - var hSpan = sender as ScottPlot.Plottable.HSpan; - double newTime = hSpan.X2 - hSpan.X1; - newTime = Math.Round(newTime, 1); - rtLabel.Text = newTime.ToString() + " ms"; - rtTypeLabel.Text = "Manual"; - Console.WriteLine(hSpan.X1 + "" + hSpan.X2); - } - private void processTypeListBox_SelectedIndexChanged(object sender, EventArgs e) { - showProcessedData(); + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + showProcessedData(); + } } private void overshootStyleListBox_SelectedIndexChanged(object sender, EventArgs e) { - showProcessedData(); + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + showProcessedData(); + } } private void runSelectBox_SelectedIndexChanged(object sender, EventArgs e) { - drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); - showProcessedData(); + var ctrl = sender as ComboBox; + if (ctrl.Focused) + { + drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); + showProcessedData(); + } } - private void importRawFolder_Click(object sender, EventArgs e) + private bool importRawFolderData() { // Open folder picker dialogue var filePath = string.Empty; @@ -1858,17 +744,22 @@ private void importRawFolder_Click(object sender, EventArgs e) { rawData.Clear(); gamma.Clear(); + //processedGamma.Clear(); + //averageData.Clear(); + //multipleRunsData.Clear(); //results.Clear(); string[] files = Directory.GetFiles(filePath); bool valid = false; foreach (var f in files) { - if (f.Contains("-RAW-OSRTT")) + if (f.Contains("-RAW-OSRTT") && !f.Contains("INPUT")) { valid = true; + gamma.Clear(); + testLatency.Clear(); try { - List tempRes = new List(); + List tempRes = new List(); List tempGamma = new List(); using (System.Windows.Forms.OpenFileDialog OFD = new System.Windows.Forms.OpenFileDialog()) { @@ -1881,45 +772,63 @@ private void importRawFolder_Click(object sender, EventArgs e) while (!reader.EndOfStream) { // This can probably be done better - string[] line = reader.ReadLine().Split(','); - int[] intLine = new int[line.Length]; - for (int i = 0; i < line.Length; i++) + string fullLine = reader.ReadLine(); + if (fullLine.Contains("{")) { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") + ProcessData.runSettings runs = JsonConvert.DeserializeObject(fullLine); + runSettings = runs; + continue; + } + else + { + string[] line = fullLine.Split(','); + int[] intLine = new int[line.Length]; + for (int i = 0; i < line.Length; i++) { - intLine[i] = int.Parse(line[i]); + if (line[i] == "0") + { + intLine[i] = 0; + } + else if (line[i] != "" && !line[i].Contains(".")) + { + intLine[i] = int.Parse(line[i]); + } + else + { + continue; + } } - else + Array.Resize(ref intLine, intLine.Length - 1); + if (intLine[0] == 1000) { - continue; + testLatency.AddRange(intLine); + } + else if (intLine[0] == intLine[1]) + { + tempGamma.Add(intLine); + } + else + { + ProcessData.rawResultData rawResult = new ProcessData.rawResultData + { + StartingRGB = intLine[0], + EndRGB = intLine[1], + TimeTaken = intLine[2], + SampleCount = intLine[3], + SampleTime = ((double)intLine[2] / (double)intLine[3]), + Samples = intLine.Skip(4).ToList() + }; + tempRes.Add(rawResult); } - } - Array.Resize(ref intLine, intLine.Length - 1); - if (intLine[0] == 1000) - { - testLatency.AddRange(intLine); - } - else if (intLine[0] == intLine[1]) - { - tempGamma.Add(intLine); - } - else - { - tempRes.Add(intLine); } } } } - rawData.AddRange(new List> { tempRes }); + rawData.AddRange(new List> { tempRes }); gamma.AddRange(tempGamma); - processedGamma.AddRange(processGammaTable()); - processTestLatency(); + + //processTestLatency(); Console.WriteLine(rawData.Count); - } catch (IOException iex) { @@ -1929,22 +838,41 @@ private void importRawFolder_Click(object sender, EventArgs e) } else { - Console.WriteLine(iex.Message + iex.StackTrace); + MessageBox.Show(iex.Message + iex.StackTrace, "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } if (valid) { - // Draw graph - graphViewMenuBtn_Click(null, null); - handleRunsList(); - handleResultsList(runSelectBox.SelectedIndex); + resultsFolderPath = filePath; + Console.WriteLine(filePath); + Console.WriteLine(resultsFolderPath); + ProcessData pd = new ProcessData(); + foreach (var i in rawData) + { + processedGamma.Clear(); + processedGamma.AddRange(pd.processGammaTable(gamma, i)); + } + // save gamma data to file + if (Properties.Settings.Default.saveGammaTable) + { + CFuncs cf = new CFuncs(); + string gammaName = cf.createFileName(resultsFolderPath, "-GAMMA-OSRTT.csv"); + StringBuilder gammaCsv = new StringBuilder(); + gammaCsv.AppendLine("RGB,Light Level"); + foreach (ProcessData.gammaResult g in processedGamma) + { + gammaCsv.AppendLine(g.RGB.ToString() + "," + g.LightLevel.ToString()); + } + File.WriteAllText(resultsFolderPath + "\\" + gammaName, gammaCsv.ToString()); + } } else { MessageBox.Show("Please select a results folder with one or more raw data files", "Unable to load files", MessageBoxButtons.OK, MessageBoxIcon.Error); } + return valid; } else { @@ -1952,6 +880,15 @@ private void importRawFolder_Click(object sender, EventArgs e) } } } + return false; + } + + private void importRawFolder_Click(object sender, EventArgs e) + { + importRawFolderData(); + graphViewMenuBtn_Click(null, null); + handleRunsList(); + handleResultsList(runSelectBox.SelectedIndex); } private void importResultsViewBtn_Click(object sender, EventArgs e) @@ -1970,52 +907,80 @@ private void importResultsViewBtn_Click(object sender, EventArgs e) { //Get the path of specified file filePath = openFileDialog.FileName; + //rawData.Clear(); + //gamma.Clear(); + //processedGamma.Clear(); averageData.Clear(); - if (filePath.Contains("FULL-OSRTT")) + multipleRunsData.Clear(); + if (filePath.Contains("FULL-OSRTT") || (!filePath.Contains("RAW") && !filePath.Contains("GAMMA") && !filePath.Contains("INPUT"))) { //Read the contents of the file into a stream try { - List tempRes = new List(); + List tempRes = new List(); var fileStream = openFileDialog.OpenFile(); using (StreamReader reader = new StreamReader(fileStream)) { while (!reader.EndOfStream) { // This can probably be done better - string[] line = reader.ReadLine().Split(','); - if (line[0].Contains("RGB")) + string fullLine = reader.ReadLine(); + + if (fullLine.Contains("{")) { + ProcessData.runSettings runs = JsonConvert.DeserializeObject(fullLine); + runSettings = runs; continue; } - double[] intLine = new double[line.Length]; - for (int i = 0; i < line.Length; i++) + else if (fullLine.Contains("RGB")) { - if (line[i] == "0") - { - intLine[i] = 0; - } - else if (line[i] != "") + continue; + } + else + { + string[] line = fullLine.Split(','); + double[] intLine = new double[line.Length]; + for (int i = 0; i < line.Length; i++) { - intLine[i] = double.Parse(line[i]); + if (line[i] == "0") + { + intLine[i] = 0; + } + else if (line[i] != "") + { + intLine[i] = double.Parse(line[i]); + } + else + { + continue; + } } - else + Array.Resize(ref intLine, intLine.Length - 1); + ProcessData.processedResult proc = new ProcessData.processedResult { - continue; - } + StartingRGB = (int)intLine[0], + EndRGB = (int)intLine[1], + compTime = intLine[2], + initTime = intLine[3], + perTime = intLine[4], + Overshoot = intLine[5], + visualResponseRating = intLine[6], + }; + tempRes.Add(proc); } - Array.Resize(ref intLine, intLine.Length - 1); - - tempRes.Add(intLine); - } } - averageData.AddRange( tempRes ); + resultsFolderPath = filePath.Substring(0, filePath.LastIndexOf('\\')); + averageData.AddRange(tempRes); stdResultsMenuBtn_Click(null, null); } catch (Exception ex) { - DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again.", "Unable to open file", MessageBoxButtons.OK, MessageBoxIcon.Error); + DialogResult d = MessageBox.Show("File may be in use by another program, please make sure it's not open elsewhere and try again. See more details on the error?", "Unable to open file", MessageBoxButtons.YesNo, MessageBoxIcon.Error); + if (d == DialogResult.Yes) + { + MessageBox.Show(ex.Message + ex.StackTrace, "Full Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } Console.WriteLine(ex.Message + ex.StackTrace); } } @@ -2026,5 +991,608 @@ private void importResultsViewBtn_Click(object sender, EventArgs e) } } } + + private void saveAsPNGBtn_Click(object sender, EventArgs e) + { + string run = "Run 1"; + string result = "RGB 0 to RGB 51"; + if (runSelectBox.SelectedIndex != null) + { + run = runSelectBox.Items[runSelectBox.SelectedIndex].ToString(); + } + if (transSelect1.SelectedIndex != null) + { + result = transSelect1.Items[transSelect1.SelectedIndex].ToString(); + } + Color bnColor = BackColor; + graphedData.Plot.Style(figureBackground: Color.Transparent, dataBackground: Color.Transparent); + graphedData.Plot.SaveFig(path + "\\" + run + "-" + result + ".png", 1920, 1080, false); + graphedData.Plot.Style(figureBackground: bnColor, dataBackground: bnColor); + Process.Start("explorer.exe", path); + } + + private void saveGraphNoHSpanBtn_Click(object sender, EventArgs e) + { + string run = "Run 1"; + string result = "RGB 0 to RGB 51"; + if (runSelectBox.SelectedIndex != null) + { + run = runSelectBox.Items[runSelectBox.SelectedIndex].ToString(); + } + if (transSelect1.SelectedIndex != null) + { + result = transSelect1.Items[transSelect1.SelectedIndex].ToString(); + } + var plots = graphedData.Plot.GetPlottables(); + foreach (var i in plots) + { + if (i.ToString().Contains("span")) + { + i.IsVisible = false; + } + } + Color bnColor = BackColor; + graphedData.Plot.Style(figureBackground: Color.Transparent, dataBackground: Color.Transparent); + graphedData.Plot.SaveFig(path + "\\" + run + "-" + result + ".png", 1920, 1080, false); + graphedData.Plot.Style(figureBackground: bnColor, dataBackground: bnColor); + Process.Start("explorer.exe", path); + + foreach (var i in plots) + { + if (i.ToString().Contains("span")) + { + i.IsVisible = true; + } + } + } + + private void asTransparentPNGToolStripMenuItem_Click(object sender, EventArgs e) + { + string fileName = "OSRTT Heatmaps.png"; + string monitorInfo = ""; + if (resultsFolderPath != "") + { + string[] folders = resultsFolderPath.Split('\\'); + monitorInfo = folders.Last(); + fileName = monitorInfo + ".png"; + } + else + { + resultsFolderPath = path; + } + Bitmap heatmaps = new Bitmap(this.Width, this.Height); + //BackColor = Color.FromArgb(255,240,240,240); + heatmaps1.hideText(false); + this.DrawToBitmap(heatmaps, new Rectangle(0, 0, heatmaps.Width, heatmaps.Height)); + + // crop sides + // 80px top, 8px every other side + // width - 16, height - 88, x = 8, y = 80 + var rect = new Rectangle(new Point(8, 80), new Size((this.Width - 16), (this.Height - 88))); + //Bitmap scaledHeatmap = CropImage(heatmaps, rect); + //Bitmap finalHeatmaps = ScaleImage(scaledHeatmap, 1920, 1080); + Bitmap finalHeatmaps = CropImage(heatmaps, rect); + finalHeatmaps.MakeTransparent(BackColor); + // draw text back... + string rtTitle = "Perceived Response Time"; + string rtSubTitle = runSettings.rtMethod.Name; + string osTitle = "RGB Overshoot"; + string osSubTitle = "RGB values over/under target"; + string vrrTitle = "Visual Response Rating"; + string vrrSubTitle = "Score out of 100 of visible performance"; + if (initialResponseTimeToolStripMenuItem.Checked) + { + rtTitle = "Initial Response Time"; + } + else if (completeResponseTimeToolStripMenuItem.Checked) + { + rtTitle = "Complete Response Time"; + } + if (runSettings.osMethod.gammaCorrected && (!runSettings.osMethod.endPercent || !runSettings.osMethod.rangePercent)) + { + osTitle = "RGB Overshoot"; + osSubTitle = "RGB values over/under target"; + } + else if (osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + osTitle = "Percent RGB Overshoot"; + if (osMethod.rangePercent) + { + osSubTitle = "Percentage of RGB values over/under transition range"; + } + else + { + osSubTitle = "Percentage of RGB values over/under target"; + } + } + else if (!osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + osTitle = "Percent Overshoot"; + if (osMethod.rangePercent) + { + osSubTitle = "Percent of light level over/under transition range"; + } + else + { + osSubTitle = "Percent of light level over/under target"; + } + } + using (Graphics g = Graphics.FromImage(finalHeatmaps)) + { + g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.InterpolationMode = InterpolationMode.HighQualityBicubic; + StringFormat sf = new StringFormat(); + sf.Alignment = StringAlignment.Center; + sf.LineAlignment = StringAlignment.Center; + Rectangle rt = new Rectangle(100, 36, 377, 36); + Rectangle rtSub = new Rectangle(100, 65, 377, 36); + Rectangle os = new Rectangle(676, 36, 377, 36); + Rectangle osSub = new Rectangle(676, 65, 377, 36); + Rectangle vrr = new Rectangle(1264, 36, 377, 36); + Rectangle vrrSub = new Rectangle(1264, 65, 377, 36); + FontFamily ff = new FontFamily("Calibri"); + Font f = new Font(ff, 20f, FontStyle.Bold); + Font fi = new Font(ff, 16f, FontStyle.Italic); + g.DrawString(rtTitle, f, Brushes.Black, rt, sf); + g.DrawString(rtSubTitle, fi, Brushes.Black, rtSub, sf); + g.DrawString(osTitle, f, Brushes.Black, os, sf); + g.DrawString(osSubTitle, fi, Brushes.Black, osSub, sf); + g.DrawString(vrrTitle, f, Brushes.Black, vrr, sf); + g.DrawString(vrrSubTitle, fi, Brushes.Black, vrrSub, sf); + g.DrawString("From", fi, Brushes.Black, new Point(29, 393)); + g.DrawString("From", fi, Brushes.Black, new Point(606, 393)); + g.DrawString("From", fi, Brushes.Black, new Point(1190, 393)); + g.DrawString("To", fi, Brushes.Black, new Point(556, 106)); + g.DrawString("To", fi, Brushes.Black, new Point(1132, 106)); + g.DrawString("To", fi, Brushes.Black, new Point(1717, 106)); + } + + finalHeatmaps.Save(resultsFolderPath + "\\" + fileName); + Process.Start("explorer.exe", resultsFolderPath); + BackColor = Color.White; + heatmaps1.hideText(true); + } + + public Bitmap CropImage(Bitmap source, Rectangle section) + { + var bitmap = new Bitmap(section.Width, section.Height); + using (var g = Graphics.FromImage(bitmap)) + { + g.InterpolationMode = InterpolationMode.HighQualityBicubic; + g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.DrawImage(source, 0, 0, section, GraphicsUnit.Pixel); + return bitmap; + } + } + + public Bitmap ScaleImage(Bitmap source, float width, float height) // Depreciated, resized window instead! + { + float scale = Math.Min(width / source.Width, height / source.Height); + var scaleWidth = (int)(source.Width * scale); + var scaleHeight = (int)(source.Height * scale); + var bitmap = new Bitmap(scaleWidth, scaleHeight); + using (Graphics graph = Graphics.FromImage(bitmap)) + { + var brush = new SolidBrush(Color.Transparent); + graph.InterpolationMode = InterpolationMode.High; + graph.CompositingQuality = CompositingQuality.HighQuality; + graph.SmoothingMode = SmoothingMode.AntiAlias; + graph.FillRectangle(brush, new RectangleF(0, 0, 1920, 1080)); + graph.DrawImage(source, new Rectangle(0, 0, scaleWidth, scaleHeight)); + return bitmap; + } + } + + private void asPNGToolStripMenuItem_Click(object sender, EventArgs e) + { + string fileName = "OSRTT Heatmaps.png"; + string monitorInfo = ""; + if (resultsFolderPath != "") + { + string[] folders = resultsFolderPath.Split('\\'); + monitorInfo = folders.Last(); + fileName = monitorInfo + ".png"; + } + else + { + resultsFolderPath = path; + } + Bitmap heatmaps = new Bitmap(this.Width, this.Height); + this.DrawToBitmap(heatmaps, new Rectangle(0, 0, heatmaps.Width, heatmaps.Height)); + //heatmaps.MakeTransparent(BackColor); + + // crop sides + // 80px top, 8px every other side + // width - 16, height - 88, x = 8, y = 80 + var rect = new Rectangle(new Point(8, 80), new Size((this.Width - 16), (this.Height - 88))); + //Bitmap scaledHeatmap = CropImage(heatmaps, rect); + //Bitmap finalHeatmaps = ScaleImage(scaledHeatmap, 1920, 1080); + Bitmap finalHeatmaps = CropImage(heatmaps, rect); + finalHeatmaps.Save(resultsFolderPath + "\\" + fileName); + Process.Start("explorer.exe", resultsFolderPath); + } + + private void perceivedResponseTimeToolStripMenuItem_Click(object sender, EventArgs e) + { + perceivedResponseTimeToolStripMenuItem.Checked = true; + initialResponseTimeToolStripMenuItem.Checked = false; + completeResponseTimeToolStripMenuItem.Checked = false; + if (stdResultsMenuBtn.Checked) + { + standardView(); + } + else if (graphViewMenuBtn.Checked) + { + drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); + showProcessedData(); + } + } + + private void initialResponseTimeToolStripMenuItem_Click(object sender, EventArgs e) + { + perceivedResponseTimeToolStripMenuItem.Checked = false; + initialResponseTimeToolStripMenuItem.Checked = true; + completeResponseTimeToolStripMenuItem.Checked = false; + if (stdResultsMenuBtn.Checked) + { + standardView(); + } + else if (graphViewMenuBtn.Checked) + { + drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); + showProcessedData(); + } + } + + private void completeResponseTimeToolStripMenuItem_Click(object sender, EventArgs e) + { + perceivedResponseTimeToolStripMenuItem.Checked = false; + initialResponseTimeToolStripMenuItem.Checked = false; + completeResponseTimeToolStripMenuItem.Checked = true; + if (stdResultsMenuBtn.Checked) + { + standardView(); + } + else if (graphViewMenuBtn.Checked) + { + drawGraph(runSelectBox.SelectedIndex, transSelect1.SelectedIndex); + showProcessedData(); + } + } + + private void processAllRuns(ProcessData.rtMethods rtMethod, ProcessData.osMethods osMethod, bool single) + { + averageData.Clear(); + multipleRunsData.Clear(); + ProcessData pd = new ProcessData(); + int startDelay = pd.processTestLatency(testLatency); + List> processedData = new List>(); + processedData.AddRange(pd.ProcessAllResults(rawData, new ProcessData.resultSelection + { + rtStyle = rtMethod, + osStyle = osMethod + }, startDelay, processedGamma)); + CFuncs cf = new CFuncs(); + + foreach (var res in processedData) + { + StringBuilder csvString = new StringBuilder(); + string rtType = "Initial Response Time - 3% (ms)"; + string osType = "Overshoot"; + string osSign = "(%)"; + string perType = "Perceived Response Time - 3% (ms)"; + if (rtMethod.Tolerance == 10 && !rtMethod.gammaCorrected) + { + rtType = "Initial Response Time - 10% (ms)"; + perType = "Perceived Response Time - 10% (ms)"; + } + else if (rtMethod.Tolerance == 10 && rtMethod.gammaCorrected) + { + rtType = "Initial Response Time - RGB10 (ms)"; + perType = "Perceived Response Time - RGB10 (ms)"; + } + else if (rtMethod.Tolerance == 5 && rtMethod.gammaCorrected) + { + rtType = "Initial Response Time - RGB5 (ms)"; + perType = "Perceived Response Time - RGB5 (ms)"; + } + if (osMethod.gammaCorrected) + { + osSign = "(RGB)"; + } + if (osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + osSign = "(RGB %)"; + } + string fullFileName = cf.createFileName(resultsFolderPath, "-FULL-OSRTT.csv"); + csvString.AppendLine("Starting RGB,End RGB,Complete Response Time (ms)," + rtType + "," + perType + "," + osType + " " + osSign + ",Visual Response Rating,Input Lag (ms)"); + foreach (ProcessData.processedResult i in res) + { + // save each run to file + csvString.AppendLine( + i.StartingRGB.ToString() + "," + + i.EndRGB.ToString() + "," + + i.compTime.ToString() + "," + + i.initTime.ToString() + "," + + i.perTime.ToString() + "," + + i.Overshoot.ToString() + "," + + i.visualResponseRating.ToString() + "," + + i.inputLag.ToString() + ); + } + if (runSettings != null) + { + csvString.AppendLine(JsonConvert.SerializeObject(runSettings)); + } + string fullFilePath = resultsFolderPath + "\\" + fullFileName; + File.WriteAllText(fullFilePath, csvString.ToString()); + multipleRunsData.Add(res); + } + if (!single) + { + averageData.AddRange(pd.AverageMultipleRuns(processedData, osMethod)); + // save averaged data to file + string[] folders = resultsFolderPath.Split('\\'); + string monitorInfo = folders.Last(); + StringBuilder avgCsvString = new StringBuilder(); + string avgRtType = "Initial Response Time - 3% (ms)"; + string avgOsType = "Overshoot"; + string avgOsSign = "(%)"; + string avgPerType = "Perceived Response Time - 3% (ms)"; + if (rtMethod.Tolerance == 10 && !rtMethod.gammaCorrected) + { + avgRtType = "Initial Response Time - 10% (ms)"; + avgPerType = "Perceived Response Time - 10% (ms)"; + } + else if (rtMethod.Tolerance == 10 && rtMethod.gammaCorrected) + { + avgRtType = "Initial Response Time - RGB10 (ms)"; + avgPerType = "Perceived Response Time - RGB10 (ms)"; + } + else if (rtMethod.Tolerance == 5 && rtMethod.gammaCorrected) + { + avgRtType = "Initial Response Time - RGB5 (ms)"; + avgPerType = "Perceived Response Time - RGB5 (ms)"; + } + if (osMethod.gammaCorrected) + { + avgOsSign = "(RGB)"; + } + if (osMethod.gammaCorrected && (osMethod.endPercent || osMethod.rangePercent)) + { + avgOsSign = "(RGB %)"; + } + string fileName = monitorInfo + ".csv"; + avgCsvString.AppendLine("Starting RGB,End RGB,Complete Response Time (ms)," + avgRtType + "," + avgPerType + "," + avgOsType + " " + avgOsSign + ",Visual Response Rating,Input Lag (ms)"); + foreach (ProcessData.processedResult i in averageData) + { + // save each run to file + avgCsvString.AppendLine( + i.StartingRGB.ToString() + "," + + i.EndRGB.ToString() + "," + + i.compTime.ToString() + "," + + i.initTime.ToString() + "," + + i.perTime.ToString() + "," + + i.Overshoot.ToString() + "," + + i.visualResponseRating.ToString() + "," + + i.inputLag.ToString() + ); + } + if (runSettings != null) + { + avgCsvString.AppendLine(JsonConvert.SerializeObject(runSettings)); + } + string filePath = resultsFolderPath + "\\" + fileName; + File.WriteAllText(filePath, avgCsvString.ToString()); + if (Properties.Settings.Default.saveXLSX) + { + string[] headers = { "Starting RGB", "End RGB", "Complete Response Time (ms)", avgRtType, avgPerType, avgOsType + " " + avgOsSign, "Visual Response Rating", "Input Lag (ms)" }; + SaveToExcel excel = new SaveToExcel(); + excel.SaveDataToHeatmap(averageData, runSettings, path, resultsFolderPath + "\\" + monitorInfo + ".XLSX", headers); + } + } + } + + private void importRawFileBtn_Click(object sender, EventArgs e) + { + bool success = false; + try + { + importRawData(); + success = true; + setProgressBar(true); + } + catch (Exception er) + { + success = false; + Console.WriteLine(er.Message + er.StackTrace); + } + ProcessData.rtMethods rt = new ProcessData.rtMethods + { + Name = Properties.Settings.Default.rtName, + Tolerance = Properties.Settings.Default.rtTolerance, + gammaCorrected = Properties.Settings.Default.rtGammaCorrected, + percentage = Properties.Settings.Default.rtPercentage + }; + ProcessData.osMethods os = new ProcessData.osMethods + { + Name = Properties.Settings.Default.osName, + gammaCorrected = Properties.Settings.Default.osGammaCorrected, + endPercent = Properties.Settings.Default.osEndPercent, + rangePercent = Properties.Settings.Default.osRangePercent + }; + if (runSettings == null) + { + runSettings = new ProcessData.runSettings // REMOVE THIS + { + RunName = "078-XG270QG-165-DP", + RefreshRate = 165, + FPSLimit = 1000, + DateAndTime = DateTime.Now.ToString(), + MonitorName = "XG270QG", + Vsync = true, + osMethod = os, + rtMethod = rt + }; + } + if (success) + { + try + { + processAllRuns(rt, os, true); + success = true; + } + catch (Exception ex) + { + success = false; + MessageBox.Show(ex.Message + ex.StackTrace, "Error importing files", MessageBoxButtons.OK, MessageBoxIcon.Error); + Console.WriteLine(ex.Message + ex.StackTrace); + } + } + if (success) + { + stdResultsMenuBtn_Click(null, null); + Process.Start("explorer.exe", resultsFolderPath); + } + setProgressBar(false); + } + + private void importRawFolderBtn_Click(object sender, EventArgs e) + { + bool success = false; + try + { + importRawFolderData(); + success = true; + setProgressBar(true); + } + catch (Exception er) + { + success = false; + Console.WriteLine(er.Message + er.StackTrace); + } + ProcessData.rtMethods rt = new ProcessData.rtMethods + { + Name = Properties.Settings.Default.rtName, + Tolerance = Properties.Settings.Default.rtTolerance, + gammaCorrected = Properties.Settings.Default.rtGammaCorrected, + percentage = Properties.Settings.Default.rtPercentage + }; + ProcessData.osMethods os = new ProcessData.osMethods + { + Name = Properties.Settings.Default.osName, + gammaCorrected = Properties.Settings.Default.osGammaCorrected, + endPercent = Properties.Settings.Default.osEndPercent, + rangePercent = Properties.Settings.Default.osRangePercent + }; + if (runSettings == null) + { + runSettings = new ProcessData.runSettings // REMOVE THIS + { + RunName = "078-XG270QG-165-DP", + RefreshRate = 165, + FPSLimit = 1000, + DateAndTime = DateTime.Now.ToString(), + MonitorName = "XG270QG", + Vsync = true, + osMethod = os, + rtMethod = rt + }; + } + if (success) + { + try + { + processAllRuns(rt, os, false); + success = true; + } + catch (Exception ex) + { + success = false; + MessageBox.Show(ex.Message + ex.StackTrace, "Error importing files", MessageBoxButtons.OK, MessageBoxIcon.Error); + Console.WriteLine(ex.Message + ex.StackTrace); + } + } + if (success) + { + stdResultsMenuBtn_Click(null, null); + Process.Start("explorer.exe", resultsFolderPath); + } + setProgressBar(false); + } + + private void optionsToolStripMenuItem_Click(object sender, EventArgs e) + { + ResultsSettings rs = new ResultsSettings(); + rs.Show(); + } + + private void runSelectToolStrip_SelectedIndexChanged(object sender, EventArgs e) + { // draw different run + var ctrl = sender as ToolStripComboBox; + if (ctrl.Focused) + { + if (runSelectToolStrip.Items[0].ToString().Contains("Average")) + { + if (runSelectToolStrip.SelectedIndex == 0) + { + heatmaps1.setAverageData(averageData); + } + else + { + int sel = runSelectToolStrip.SelectedIndex - 1; + heatmaps1.setAverageData(multipleRunsData[sel]); + } + } + else + { + heatmaps1.setAverageData(multipleRunsData[runSelectToolStrip.SelectedIndex]); + } + heatmaps1.standardView(); + } + } + + private void setProgressBar(bool on) + { + if (on) + { + + if (progressBar1.InvokeRequired) + { + this.progressBar1.Invoke((MethodInvoker)(() => { + this.progressBar1.Style = ProgressBarStyle.Marquee; + this.progressBar1.MarqueeAnimationSpeed = 30; + this.progressBar1.Visible = true; + })); + } + else + { + progressBar1.Style = ProgressBarStyle.Marquee; + progressBar1.MarqueeAnimationSpeed = 30; + this.progressBar1.Visible = true; + } + } + else + { + if (progressBar1.InvokeRequired) + { + this.progressBar1.Invoke((MethodInvoker)(() => { + this.progressBar1.Style = ProgressBarStyle.Continuous; + this.progressBar1.MarqueeAnimationSpeed = 0; + this.progressBar1.Visible = false; + })); + } + else + { + progressBar1.Style = ProgressBarStyle.Continuous; + progressBar1.MarqueeAnimationSpeed = 0; + progressBar1.Visible = false; + } + } + } + + } } diff --git a/OSRTT Launcher/OSRTT Launcher/ResultsView.resx b/OSRTT Launcher/OSRTT Launcher/ResultsView.resx index da54fab..b5b49b3 100644 --- a/OSRTT Launcher/OSRTT Launcher/ResultsView.resx +++ b/OSRTT Launcher/OSRTT Launcher/ResultsView.resx @@ -120,9 +120,6 @@ 17, 17 - - True - 132, 17 @@ -140,21 +137,6 @@ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D TgDQASA1MVpwzwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== @@ -187,4 +169,7 @@ TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + 54 + \ No newline at end of file diff --git a/OSRTT Launcher/OSRTT Launcher/SaveToExcel.cs b/OSRTT Launcher/OSRTT Launcher/SaveToExcel.cs new file mode 100644 index 0000000..f017878 --- /dev/null +++ b/OSRTT Launcher/OSRTT Launcher/SaveToExcel.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Excel = Microsoft.Office.Interop.Excel; + +namespace OSRTT_Launcher +{ + class SaveToExcel + { + private Excel.Application resultsTemplate; + private Excel._Workbook resultsTemplateWorkbook; + public bool SaveDataToHeatmap(List averageData, ProcessData.runSettings runSettings, string path, string excelFilePath, string[] headers) + { + CFuncs cf = new CFuncs(); + bool failed = false; + if (Properties.Settings.Default.saveXLSX) + { + try + { + File.Copy(path + "\\Results Template.xlsx", excelFilePath); + Console.WriteLine(path); + Console.WriteLine(excelFilePath); + } + catch (IOException ioe) + { + if (ioe.StackTrace.Contains("exists")) + { + Console.WriteLine("File exists, skipping writing."); + } + } + catch (Exception ex) + { + cf.showMessageBox(ex.Message + ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + resultsTemplate = new Excel.Application(); + try + { + resultsTemplateWorkbook = resultsTemplate.Workbooks.Open(excelFilePath); + } + catch + { + DialogResult d = cf.showMessageBox("Error writing data to XLSX results file, file may be open already. Would you like to try again?", "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); + if (d == DialogResult.Yes) + { + try + { + resultsTemplateWorkbook = resultsTemplate.Workbooks.Open(excelFilePath); + } + catch (Exception ex) + { + cf.showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.OK, MessageBoxIcon.Error); + failed = true; + } + } + else + { + failed = true; + } + } + if (!failed) + { + Excel._Worksheet resTempSheet = resultsTemplateWorkbook.Sheets[1]; + Excel._Worksheet resTempSheet2 = resultsTemplateWorkbook.Sheets[2]; + Excel._Worksheet resTempSheet3 = resultsTemplateWorkbook.Sheets[3]; + try + { + for (int h = 0; h < headers.Length; h++) + { + resTempSheet.Cells[1, h + 1] = headers[h]; + } + //Console.WriteLine("AverageData Count: " + averageData.Count); + for (int p = 0; p < averageData.Count; p++) + { + resTempSheet.Cells[p + 2, 1] = averageData[p].StartingRGB; + resTempSheet.Cells[p + 2, 2] = averageData[p].EndRGB; + resTempSheet.Cells[p + 2, 3] = averageData[p].compTime; + resTempSheet.Cells[p + 2, 4] = averageData[p].initTime; + resTempSheet.Cells[p + 2, 5] = averageData[p].perTime; + resTempSheet.Cells[p + 2, 6] = averageData[p].Overshoot; + resTempSheet.Cells[p + 2, 7] = averageData[p].visualResponseRating; + resTempSheet.Cells[p + 2, 8] = averageData[p].inputLag; + } + resultsTemplateWorkbook.Save(); + } + catch (Exception ex) + { + cf.showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); + failed = true; + } + GC.Collect(); + GC.WaitForPendingFinalizers(); + Marshal.ReleaseComObject(resTempSheet); + try + { + resTempSheet2.Cells[4, 12] = runSettings.RefreshRate; + resTempSheet3.Activate(); + resultsTemplateWorkbook.Save(); + } + catch (Exception ex) + { + cf.showMessageBox(ex.Message + ex.StackTrace, "Unable to Save to XLSX File", MessageBoxButtons.YesNo, MessageBoxIcon.Error); + failed = true; + } + GC.Collect(); + GC.WaitForPendingFinalizers(); + Marshal.ReleaseComObject(resTempSheet2); + GC.Collect(); + GC.WaitForPendingFinalizers(); + Marshal.ReleaseComObject(resTempSheet3); + } + resultsTemplateWorkbook.Close(); + Marshal.ReleaseComObject(resultsTemplateWorkbook); + resultsTemplate.Quit(); + Marshal.ReleaseComObject(resultsTemplate); + + if (failed) + { + File.Delete(excelFilePath); + } + + } + return failed; + } + } +} diff --git a/OSRTT Launcher/OSRTT Launcher/packages.config b/OSRTT Launcher/OSRTT Launcher/packages.config index a0bb817..8aa0ebd 100644 --- a/OSRTT Launcher/OSRTT Launcher/packages.config +++ b/OSRTT Launcher/OSRTT Launcher/packages.config @@ -2,10 +2,9 @@ - - - + +