first commit

This commit is contained in:
Dana Markova
2025-07-28 13:21:36 +03:00
commit 0de214c9a1
547 changed files with 287132 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

1243
Graph/WindowsFormsApp1/MainForm.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,604 @@
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms.DataVisualization.Charting;
using System.Runtime.InteropServices;
using System.Net;
namespace WindowsFormsApp1
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
foreach (var s in chart_Graph.Series) s.XValueType = ChartValueType.DateTime;
chart_Graph.ChartAreas[0].AxisX.LabelStyle.Format = "mm:ss";
chart_Graph.ChartAreas[0].AxisX.Minimum = DateTime.Now.ToOADate();
chart_Graph.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(trackBar_GraphX_Down.Value).ToOADate();
chart_Graph.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.FixedCount;
chart_Graph.ChartAreas[0].AxisX.Interval = (new DateTime(1, 1, 1, 0, 0, 1)).ToOADate();
for (int a = 0; a < checkedListBox_Series.Items.Count; a++) checkedListBox_Series.SetItemChecked(a, true);
PIDs[0] = numericUpDown_PID_Min; PIDs[1] = numericUpDown_PID_Max;
PIDs[2] = numericUpDown_PID_P_Min; PIDs[3] = numericUpDown_PID_P_Max; PIDs[4] = numericUpDown_PID_P_Value;
PIDs[5] = numericUpDown_PID_I_Min; PIDs[6] = numericUpDown_PID_I_Max; PIDs[7] = numericUpDown_PID_I_Value;
PIDs[8] = numericUpDown_PID_D_Min; PIDs[9] = numericUpDown_PID_D_Max; PIDs[10] = numericUpDown_PID_D_Value;
PIDs[11] = numericUpDown_Yaw_P_Min; PIDs[12] = numericUpDown_Yaw_P_Max; PIDs[13] = numericUpDown_Yaw_P_Value;
PIDs[14] = numericUpDown_Yaw_I_Min; PIDs[15] = numericUpDown_Yaw_I_Max; PIDs[16] = numericUpDown_Yaw_I_Value;
PIDs[17] = numericUpDown_Yaw_D_Min; PIDs[18] = numericUpDown_Yaw_D_Max; PIDs[19] = numericUpDown_Yaw_D_Value;
}
private byte[] getStructBytes(RecvHead str)
{
int size = Marshal.SizeOf(str);
byte[] arr = new byte[size];
IntPtr ptr = IntPtr.Zero;
try
{
ptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(str, ptr, true);
Marshal.Copy(ptr, arr, 0, size);
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return arr;
}
private object fromBytestoStruct(byte[] arr)
{
RecvHead str = new RecvHead();
int size = Marshal.SizeOf(str);
IntPtr ptr = IntPtr.Zero;
try
{
ptr = Marshal.AllocHGlobal(size);
Marshal.Copy(arr, 0, ptr, size);
str = (RecvHead)Marshal.PtrToStructure(ptr, str.GetType());
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return str;
}
private bool CheckCRC8(byte crc1, byte crc2)
{
bool ret = crc1 == crc2;
if (ret)
{
RecvCounts++;
textBox_Count.Text = RecvCounts.ToString();
}
else
{
RecvErrors++;
textBox_Error.Text = RecvErrors.ToString();
}
RecvMain.Mode = RecvModeEnum.Begin;
return ret;
}
void OperationResult(bool res)
{
if (res)
{
RecvCounts++;
textBox_Count.Text = RecvCounts.ToString();
}
else
{
RecvErrors++;
textBox_Error.Text = RecvErrors.ToString();
}
RecvMain.Mode = RecvModeEnum.Begin;
}
private byte GetCRC8(byte[] arr, int size)
{
byte crc = 0;
for (int a = 0; a < Math.Min(arr.Length, size); a++) crc ^= arr[a];
return crc;
}
private bool CheckCRC8(byte[] arr, int size, byte crc2)
{
byte crc1 = GetCRC8(arr, size);
return CheckCRC8(crc1, crc2);
}
private void SendData(RecvModeEnum mode, byte[] data)
{
if (data == null) data = new byte[0];
RecvHead head = new RecvHead(mode, data.Length, GetCRC8(data, data.Length));
byte[] h = getStructBytes(head);
byte[] send = new byte[1 + h.Length + data.Length];
send[0] = 0xAA;
Buffer.BlockCopy(h, 0, send, 1, h.Length);
Buffer.BlockCopy(data, 0, send, 1 + h.Length, data.Length);
serialPort_COM.Write(send, 0, send.Length);
}
string RecordsFolder = "";
BinaryWriter RecordWriter = null;
private object[] PIDs = new object[20];
private const int RecvCount = 512;
private byte[] RecvData = new byte[RecvCount];
private int RecvSize = 0;
private enum RecvModeEnum : byte { Begin, Head, Titles, Data, Auto, SetPID, GetPID, Done };
private int TimerStop = 0;
private int RecvErrors = 0;
private int RecvCounts = 0;
private DateTime GraphLast = DateTime.Now;
private struct RecvHead
{
public RecvHead(RecvModeEnum mode, int size, byte crc8)
{
Mode = mode;
DataSize = (byte)size;
DataCRC8 = crc8;
CRC8 = (byte)(((byte)Mode) ^ DataSize ^ DataCRC8);
}
public RecvModeEnum Mode;
public byte DataSize;
public byte DataCRC8;
public byte CRC8;
public bool Check()
{
return CRC8 == (byte)(((byte)Mode) ^ DataSize ^ DataCRC8);
}
}
private RecvHead RecvMain;
private void DrawGraph(byte[] data, int from, int size)
{
if (checkBox_Track.Checked)
{
chart_Graph.ChartAreas[0].AxisX.Minimum = DateTime.Now.AddSeconds(-trackBar_GraphX_Down.Value).ToOADate();
chart_Graph.ChartAreas[0].AxisX.Maximum = DateTime.Now.ToOADate();
}
else
{
TimeSpan shift = DateTime.Now.Subtract(GraphLast);
if (shift.TotalSeconds > trackBar_GraphX_Down.Value)
{
GraphLast = DateTime.Now;
for (int a = 0; a < chart_Graph.Series.Count; a++) chart_Graph.Series[a].Points.Clear();
chart_Graph.ChartAreas[0].AxisX.Minimum = DateTime.Now.ToOADate();
chart_Graph.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(trackBar_GraphX_Down.Value).ToOADate();
}
}
RecordWriter?.Write(Encoding.UTF8.GetBytes(DateTime.Now.ToOADate().ToString()));
short[] lines = new short[size / 2];
Buffer.BlockCopy(data, from, lines, 0, size);
for (int a = 0; a < Math.Min(lines.Length, chart_Graph.Series.Count); a++)
{
chart_Graph.Series[a].Points.AddXY(DateTime.Now, lines[a]);
if (checkBox_Track.Checked)
{
while (true)
{
if ((DateTime.Now - DateTime.FromOADate(chart_Graph.Series[a].Points[0].XValue)).TotalSeconds > trackBar_GraphX_Down.Value + 1)
chart_Graph.Series[a].Points.RemoveAt(0);
else break;
}
}
RecordWriter?.Write(Encoding.UTF8.GetBytes("|" + lines[a].ToString()));
}
RecordWriter?.Write(Encoding.UTF8.GetBytes("\r\n"));
RecordWriter?.Flush();
}
private void RecvPID(byte[] data)
{
for (int a = 0; a < 20; a++)
{
((NumericUpDown)PIDs[a]).Value = (decimal)BitConverter.ToSingle(data, a * 4);
}
}
private byte[] SendPID()
{
byte[] send = new byte[20 * 4];
float[] data = new float[20];
for (int a = 0; a < 20; a++)
{
float v = (float)((NumericUpDown)PIDs[a]).Value;
data[a] = v;
}
Buffer.BlockCopy(data, 0, send, 0, send.Length);
return send;
}
private void button_Connect_Click(object sender, EventArgs e)
{
if (button_Connect.Text == "Connect")
{
try { serialPort_COM.PortName = comboBox_Port.Text; } catch { MessageBox.Show("Error to set port", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
try
{
serialPort_COM.Open();
serialPort_COM.DiscardInBuffer();
SendData(RecvModeEnum.Titles, null);
}
catch { MessageBox.Show("Error to connect", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
RecvErrors = 0;
RecvCounts = 0;
textBox_Error.Text = "0";
textBox_Count.Text = "0";
timer_Tick.Enabled = true;
button_Connect.Text = "Disonnect";
checkBox_Save_CheckedChanged(null, null);
}
else
{
serialPort_COM.Close();
timer_Tick.Enabled = false;
button_Connect.Text = "Connect";
panel_PID.Enabled = false;
RecordWriter?.Close();
RecordWriter = null;
}
}
private void timer_Tick_Tick(object sender, EventArgs e)
{
switch (RecvMain.Mode)
{
case RecvModeEnum.Begin:
{
TimerStop = 20;
byte[] recv = new byte[1];
int len;
try { len = serialPort_COM.Read(recv, 0, 1); } catch { break; }
if (recv[0] == 0xAA) RecvMain.Mode = RecvModeEnum.Head;
break;
}
case RecvModeEnum.Head:
{
int size = Marshal.SizeOf(RecvMain);
int len;
try { len = serialPort_COM.Read(RecvData, RecvSize, size - RecvSize); } catch { break; }
RecvSize += len;
if (RecvSize < size) break;
RecvSize = 0;
RecvHead head = (RecvHead)fromBytestoStruct(RecvData);
if (!head.Check()) { OperationResult(false); break; }
RecvMain = head;
break;
}
case RecvModeEnum.Titles:
{
int len;
try { len = serialPort_COM.Read(RecvData, RecvSize, RecvMain.DataSize - RecvSize); } catch { break; }
RecvSize += len;
if (RecvSize < RecvMain.DataSize) break;
RecvSize = 0;
if (!CheckCRC8(RecvData, RecvMain.DataSize, RecvMain.DataCRC8)) break;
string titles = Encoding.UTF8.GetString(RecvData, 0, len);
string[] tit = titles.Split('|');
chart_Graph.Series.Clear();
checkedListBox_Series.Items.Clear();
foreach (var t in tit)
{
var s = chart_Graph.Series.Add(t);
s.ChartType = SeriesChartType.FastLine;
s.XValueType = ChartValueType.DateTime;
int i = checkedListBox_Series.Items.Add(t);
checkedListBox_Series.SetItemChecked(i, true);
}
break;
}
case RecvModeEnum.Data:
{
int len;
try { len = serialPort_COM.Read(RecvData, RecvSize, RecvMain.DataSize - RecvSize); } catch { break; }
RecvSize += len;
if (RecvSize < RecvMain.DataSize) break;
RecvSize = 0;
if (!CheckCRC8(RecvData, len, RecvMain.DataCRC8)) break;
if (chart_Graph.Series.Count == 0) break;
DrawGraph(RecvData, 0, RecvMain.DataSize);
break;
}
case RecvModeEnum.GetPID:
{
int len;
try { len = serialPort_COM.Read(RecvData, RecvSize, RecvMain.DataSize - RecvSize); } catch { break; }
RecvSize += len;
if (RecvSize < RecvMain.DataSize) break;
RecvSize = 0;
if (!CheckCRC8(RecvData, len, RecvMain.DataCRC8)) break;
RecvPID(RecvData);
label_PID_State.Text = "Done";
for (int a = 0; a < 20; a++) ((NumericUpDown)PIDs[a]).BackColor = Color.White;
panel_PID.Enabled = true;
break;
}
case RecvModeEnum.Done:
{
for (int a = 0; a < 20; a++) ((NumericUpDown)PIDs[a]).BackColor = Color.White;
label_PID_State.Text = "Done";
RecvMain.Mode = RecvModeEnum.Begin;
break;
}
default:
{
RecvMain.Mode = RecvModeEnum.Begin;
break;
}
}
TimerStop--;
if (TimerStop <= 0)
{
RecvErrors++;
textBox_Error.Text = RecvErrors.ToString();
RecvMain.Mode = RecvModeEnum.Begin;
}
}
private void comboBox_Port_DropDown(object sender, EventArgs e)
{
comboBox_Port.Items.Clear();
foreach (string p in SerialPort.GetPortNames()) comboBox_Port.Items.Add(p);
}
private void numericUpDown_Min_ValueChanged(object sender, EventArgs e)
{
trackBar_GraphX_Down.Maximum = (int)numericUpDown_Min.Value;
if (sender == numericUpDown_Min) trackBar_GraphX_Down.Value = trackBar_GraphX_Down.Maximum;
else foreach (var s in chart_Graph.Series) s.Points.Clear();
GraphLast = DateTime.Now;
chart_Graph.ChartAreas[0].AxisX.Minimum = DateTime.Now.ToOADate();
chart_Graph.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(trackBar_GraphX_Down.Value).ToOADate();
chart_Graph.ChartAreas[0].AxisX.Interval = (new DateTime(1, 1, 1, 0, 0, 0).AddSeconds(((double)trackBar_GraphX_Down.Value) / 10)).ToOADate();
if (trackBar_GraphX_Down.Value < 10) chart_Graph.ChartAreas[0].AxisX.LabelStyle.Format = "mm:ss.f";
else chart_Graph.ChartAreas[0].AxisX.LabelStyle.Format = "mm:ss";
}
private void button_PID_Read_Click(object sender, EventArgs e)
{
label_PID_State.Text = "Read";
SendData(RecvModeEnum.GetPID, null);
}
private void button_PID_Write_Click(object sender, EventArgs e)
{
if (!panel_PID.Enabled) return;
label_PID_State.Text = "Write";
byte[] data = SendPID();
SendData(RecvModeEnum.SetPID, data);
}
private void button_Color_Click(object sender, EventArgs e)
{
if (colorDialog_Color.ShowDialog() == DialogResult.Cancel) return;
if (checkedListBox_Series.SelectedIndex == -1) return;
//---
int index = checkedListBox_Series.SelectedIndex;
chart_Graph.Series[index].Color = colorDialog_Color.Color;
button_Color.BackColor = colorDialog_Color.Color;
}
private void label_PID_State_TextChanged(object sender, EventArgs e)
{
if (label_PID_State.Text != "Done") label_PID_State.BackColor = Color.Tomato;
else label_PID_State.BackColor = Color.LightGreen;
}
private void numericUpDown_PID_Min_ValueChanged(object sender, EventArgs e)
{
((NumericUpDown)sender).BackColor = Color.Tomato;
}
private void checkBox_Save_CheckedChanged(object sender, EventArgs e)
{
if (!checkBox_Save.Checked)
{
RecordWriter?.Close();
RecordWriter = null;
return;
}
DateTime dt = DateTime.Now;
string file = Path.Combine(RecordsFolder, "record=" + dt.ToString("yyyy-MM-dd+HH_mm_ss") + ".tel");
try
{
RecordWriter = new BinaryWriter(File.OpenWrite(file));
string head = "Telem v1\r\nTime";
foreach (var s in chart_Graph.Series) head += "|" + s.Name;
head += "\r\n";
RecordWriter.Write(Encoding.UTF8.GetBytes(head));
RecordWriter.Flush();
}
catch
{
MessageBox.Show("Incorrect save file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
checkBox_Save.Checked = false;
}
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string specificFolder = Path.Combine(folder, "Telem");
//---
RecordsFolder = Path.Combine(specificFolder, "Records");
Directory.CreateDirectory(RecordsFolder);
openFileDialog_Open.InitialDirectory = RecordsFolder;
}
catch { }
string[] input = Environment.GetCommandLineArgs();
if (input.Length > 1)
{
string file = input[1];
byte[] record = File.ReadAllBytes(file);
short[] data = new short[record.Length / 2];
Buffer.BlockCopy(record, 0, data, 0, record.Length);
for (int a = 0; a < data.Length; a++)
{
chart_Graph.Series[a % 9].Points.AddXY(a / 9, data[a]);
}
chart_Graph.ChartAreas[0].AxisX.Maximum = double.NaN;
groupBox_Connect.Enabled = false;
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
RecordWriter?.Close();
RecordWriter = null;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog_Open.ShowDialog() != DialogResult.OK) return;
Record w = new Record();
w.RecordFile = openFileDialog_Open.FileName;
w.Show();
}
private void folderToolStripMenuItem_Click(object sender, EventArgs e)
{
try { Process.Start(RecordsFolder); }
catch { MessageBox.Show("No records!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
private void numericUpDown_Graph_MaxY_ValueChanged(object sender, EventArgs e)
{
chart_Graph.ChartAreas[0].AxisY.Minimum = (double)numericUpDown_Graph_MinY.Value;
chart_Graph.ChartAreas[0].AxisY.Maximum = (double)numericUpDown_Graph_MaxY.Value;
trackBar_GraphY_Left.Maximum = (int)numericUpDown_Graph_MaxY.Value;
trackBar_GraphY_Left.Minimum = (int)numericUpDown_Graph_MinY.Value;
trackBar_GraphY_Right.Maximum = (int)numericUpDown_Graph_MaxY.Value;
trackBar_GraphY_Right.Minimum = (int)numericUpDown_Graph_MinY.Value;
}
private void checkBox_AutoY_CheckedChanged(object sender, EventArgs e)
{
if (checkBox_AutoY.Checked)
{
chart_Graph.ChartAreas[0].AxisY.Minimum = double.NaN;
chart_Graph.ChartAreas[0].AxisY.Maximum = double.NaN;
numericUpDown_Graph_MinY.Enabled = false;
numericUpDown_Graph_MaxY.Enabled = false;
panel_GraphY.Enabled = false;
}
else
{
numericUpDown_Graph_MaxY_ValueChanged(null, null);
numericUpDown_Graph_MinY.Enabled = true;
numericUpDown_Graph_MaxY.Enabled = true;
panel_GraphY.Enabled = true;
trackBar_GraphY_Left.Value = trackBar_GraphY_Left.Minimum;
trackBar_GraphY_Right.Value = trackBar_GraphY_Right.Maximum;
}
}
private void trackBar_GraphY_Left_Scroll(object sender, EventArgs e)
{
int min = trackBar_GraphY_Left.Value;
int max = trackBar_GraphY_Right.Value;
if (min > max)
{
int sub = min;
min = max;
max = sub;
}
if (max == min) max += 1;
chart_Graph.ChartAreas[0].AxisY.Minimum = min;
chart_Graph.ChartAreas[0].AxisY.Maximum = max;
}
private void checkedListBox_Series_SelectedIndexChanged(object sender, EventArgs e)
{
if (checkedListBox_Series.SelectedIndex == -1) return;
int index = checkedListBox_Series.SelectedIndex;
button_Color.BackColor = chart_Graph.Series[index].Color;
//---
for (int a = 0; a < checkedListBox_Series.Items.Count; a++)
{
chart_Graph.Series[a].Enabled = checkedListBox_Series.GetItemChecked(a);
}
}
}
}

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serialPort_COM.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timer_Tick.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value>
</metadata>
<metadata name="colorDialog_Color.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>261, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>410, 17</value>
</metadata>
<metadata name="openFileDialog_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>525, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WindowsFormsApp1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsFormsApp1")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a4db35b3-5eff-4b9c-b34b-8271ac3768f8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp1.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApp1.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp1.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

223
Graph/WindowsFormsApp1/Record.Designer.cs generated Normal file
View File

@ -0,0 +1,223 @@
namespace WindowsFormsApp1
{
partial class Record
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
this.chart_Graph = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.panel_GraphY = new System.Windows.Forms.Panel();
this.trackBar_GraphY_Right = new System.Windows.Forms.TrackBar();
this.trackBar_GraphY_Left = new System.Windows.Forms.TrackBar();
this.panel_GraphX = new System.Windows.Forms.Panel();
this.trackBar_GraphX_Up = new System.Windows.Forms.TrackBar();
this.trackBar_GraphX_Down = new System.Windows.Forms.TrackBar();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button_Color = new System.Windows.Forms.Button();
this.checkedListBox_Series = new System.Windows.Forms.CheckedListBox();
this.colorDialog_Color = new System.Windows.Forms.ColorDialog();
this.checkBox_AutoY = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.chart_Graph)).BeginInit();
this.panel_GraphY.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphY_Right)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphY_Left)).BeginInit();
this.panel_GraphX.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphX_Up)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphX_Down)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// chart_Graph
//
chartArea2.AxisX.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount;
chartArea2.Name = "ChartArea1";
this.chart_Graph.ChartAreas.Add(chartArea2);
this.chart_Graph.Dock = System.Windows.Forms.DockStyle.Fill;
legend2.Name = "Legend1";
this.chart_Graph.Legends.Add(legend2);
this.chart_Graph.Location = new System.Drawing.Point(41, 0);
this.chart_Graph.Name = "chart_Graph";
this.chart_Graph.Size = new System.Drawing.Size(626, 413);
this.chart_Graph.TabIndex = 2;
this.chart_Graph.Text = "chart1";
//
// panel_GraphY
//
this.panel_GraphY.Controls.Add(this.trackBar_GraphY_Right);
this.panel_GraphY.Controls.Add(this.trackBar_GraphY_Left);
this.panel_GraphY.Dock = System.Windows.Forms.DockStyle.Left;
this.panel_GraphY.Location = new System.Drawing.Point(0, 0);
this.panel_GraphY.Name = "panel_GraphY";
this.panel_GraphY.Size = new System.Drawing.Size(41, 413);
this.panel_GraphY.TabIndex = 8;
//
// trackBar_GraphY_Right
//
this.trackBar_GraphY_Right.AutoSize = false;
this.trackBar_GraphY_Right.Dock = System.Windows.Forms.DockStyle.Right;
this.trackBar_GraphY_Right.Location = new System.Drawing.Point(19, 0);
this.trackBar_GraphY_Right.Name = "trackBar_GraphY_Right";
this.trackBar_GraphY_Right.Orientation = System.Windows.Forms.Orientation.Vertical;
this.trackBar_GraphY_Right.Size = new System.Drawing.Size(22, 413);
this.trackBar_GraphY_Right.TabIndex = 1;
this.trackBar_GraphY_Right.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
this.trackBar_GraphY_Right.Value = 10;
this.trackBar_GraphY_Right.Scroll += new System.EventHandler(this.trackBar_GraphY_Left_Scroll);
//
// trackBar_GraphY_Left
//
this.trackBar_GraphY_Left.AutoSize = false;
this.trackBar_GraphY_Left.Dock = System.Windows.Forms.DockStyle.Left;
this.trackBar_GraphY_Left.Location = new System.Drawing.Point(0, 0);
this.trackBar_GraphY_Left.Name = "trackBar_GraphY_Left";
this.trackBar_GraphY_Left.Orientation = System.Windows.Forms.Orientation.Vertical;
this.trackBar_GraphY_Left.Size = new System.Drawing.Size(21, 413);
this.trackBar_GraphY_Left.TabIndex = 0;
this.trackBar_GraphY_Left.Scroll += new System.EventHandler(this.trackBar_GraphY_Left_Scroll);
//
// panel_GraphX
//
this.panel_GraphX.Controls.Add(this.trackBar_GraphX_Up);
this.panel_GraphX.Controls.Add(this.trackBar_GraphX_Down);
this.panel_GraphX.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel_GraphX.Location = new System.Drawing.Point(0, 413);
this.panel_GraphX.Name = "panel_GraphX";
this.panel_GraphX.Size = new System.Drawing.Size(667, 37);
this.panel_GraphX.TabIndex = 9;
//
// trackBar_GraphX_Up
//
this.trackBar_GraphX_Up.AutoSize = false;
this.trackBar_GraphX_Up.Dock = System.Windows.Forms.DockStyle.Top;
this.trackBar_GraphX_Up.Location = new System.Drawing.Point(0, 0);
this.trackBar_GraphX_Up.Minimum = 1;
this.trackBar_GraphX_Up.Name = "trackBar_GraphX_Up";
this.trackBar_GraphX_Up.Size = new System.Drawing.Size(667, 21);
this.trackBar_GraphX_Up.TabIndex = 2;
this.trackBar_GraphX_Up.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar_GraphX_Up.Value = 10;
//
// trackBar_GraphX_Down
//
this.trackBar_GraphX_Down.AutoSize = false;
this.trackBar_GraphX_Down.Dock = System.Windows.Forms.DockStyle.Bottom;
this.trackBar_GraphX_Down.Location = new System.Drawing.Point(0, 16);
this.trackBar_GraphX_Down.Minimum = 1;
this.trackBar_GraphX_Down.Name = "trackBar_GraphX_Down";
this.trackBar_GraphX_Down.Size = new System.Drawing.Size(667, 21);
this.trackBar_GraphX_Down.TabIndex = 1;
this.trackBar_GraphX_Down.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
this.trackBar_GraphX_Down.Value = 10;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.checkBox_AutoY);
this.groupBox1.Controls.Add(this.button_Color);
this.groupBox1.Controls.Add(this.checkedListBox_Series);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBox1.Location = new System.Drawing.Point(667, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(133, 450);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = " Graph ";
//
// button_Color
//
this.button_Color.Dock = System.Windows.Forms.DockStyle.Top;
this.button_Color.Location = new System.Drawing.Point(3, 350);
this.button_Color.Name = "button_Color";
this.button_Color.Size = new System.Drawing.Size(127, 23);
this.button_Color.TabIndex = 7;
this.button_Color.Text = "Color";
this.button_Color.UseVisualStyleBackColor = true;
this.button_Color.Click += new System.EventHandler(this.button_Color_Click);
//
// checkedListBox_Series
//
this.checkedListBox_Series.Dock = System.Windows.Forms.DockStyle.Top;
this.checkedListBox_Series.FormattingEnabled = true;
this.checkedListBox_Series.Location = new System.Drawing.Point(3, 16);
this.checkedListBox_Series.Name = "checkedListBox_Series";
this.checkedListBox_Series.Size = new System.Drawing.Size(127, 334);
this.checkedListBox_Series.TabIndex = 1;
this.checkedListBox_Series.SelectedIndexChanged += new System.EventHandler(this.checkedListBox_Series_SelectedIndexChanged);
this.checkedListBox_Series.DoubleClick += new System.EventHandler(this.checkedListBox_Series_SelectedIndexChanged);
//
// checkBox_AutoY
//
this.checkBox_AutoY.AutoSize = true;
this.checkBox_AutoY.Location = new System.Drawing.Point(6, 379);
this.checkBox_AutoY.Name = "checkBox_AutoY";
this.checkBox_AutoY.Size = new System.Drawing.Size(58, 17);
this.checkBox_AutoY.TabIndex = 8;
this.checkBox_AutoY.Text = "Auto Y";
this.checkBox_AutoY.UseVisualStyleBackColor = true;
this.checkBox_AutoY.CheckedChanged += new System.EventHandler(this.checkBox_AutoY_CheckedChanged);
//
// Record
//
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.chart_Graph);
this.Controls.Add(this.panel_GraphY);
this.Controls.Add(this.panel_GraphX);
this.Controls.Add(this.groupBox1);
this.Name = "Record";
this.Text = "Record";
this.Load += new System.EventHandler(this.Record_Load);
((System.ComponentModel.ISupportInitialize)(this.chart_Graph)).EndInit();
this.panel_GraphY.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphY_Right)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphY_Left)).EndInit();
this.panel_GraphX.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphX_Up)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar_GraphX_Down)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataVisualization.Charting.Chart chart_Graph;
private System.Windows.Forms.Panel panel_GraphY;
private System.Windows.Forms.TrackBar trackBar_GraphY_Right;
private System.Windows.Forms.TrackBar trackBar_GraphY_Left;
private System.Windows.Forms.Panel panel_GraphX;
private System.Windows.Forms.TrackBar trackBar_GraphX_Down;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TrackBar trackBar_GraphX_Up;
private System.Windows.Forms.CheckedListBox checkedListBox_Series;
private System.Windows.Forms.Button button_Color;
private System.Windows.Forms.ColorDialog colorDialog_Color;
private System.Windows.Forms.CheckBox checkBox_AutoY;
}
}

View File

@ -0,0 +1,146 @@
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.IO;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Forms.DataVisualization.Charting;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace WindowsFormsApp1
{
public partial class Record : Form
{
public Record()
{
InitializeComponent();
}
public string RecordFile = null;
private double GraphMin, GraphMax;
private void Record_Load(object sender, EventArgs e)
{
if (RecordFile == null) return;
Text = Path.GetFileName(RecordFile);
string[] record = File.ReadAllLines(RecordFile);
if (record.Length < 3) return;
if (record[0] != "Telem v1") return;
string[] head = record[1].Split('|');
if (head.Length < 2) return;
for (int a = 1; a < head.Length; a++)
{
var s = chart_Graph.Series.Add(head[a]);
s.ChartType = SeriesChartType.FastLine;
s.XValueType = ChartValueType.DateTime;
int i = checkedListBox_Series.Items.Add(head[a]);
checkedListBox_Series.SetItemChecked(i, true);
}
chart_Graph.ChartAreas[0].AxisX.LabelStyle.Format = "mm:ss";
int count = head.Length;
double Max = 0, Min = 0;
double time = 0;
for (int a = 2; a < record.Length; a++)
{
string[] value = record[a].Split('|');
if (value.Length != count) break;
time = double.Parse(value[0]);
if (a == 2) chart_Graph.ChartAreas[0].AxisX.Minimum = time;
for (int b = 1; b < value.Length; b++)
{
float v = float.Parse(value[b], CultureInfo.InvariantCulture.NumberFormat);
chart_Graph.Series[b - 1].Points.AddXY(time, v);
if (v > Max) Max = v;
if (v < Min) Min = v;
}
}
Max += 100;
Min -= 100;
GraphMin = Min; GraphMax = Max;
chart_Graph.ChartAreas[0].AxisX.Maximum = time;
chart_Graph.ChartAreas[0].AxisY.Maximum = Max;
chart_Graph.ChartAreas[0].AxisY.Minimum = Min;
trackBar_GraphY_Left.Minimum = (int)Min;
trackBar_GraphY_Left.Maximum = (int)Max;
trackBar_GraphY_Left.Value = (int)Min;
trackBar_GraphY_Right.Minimum = (int)Min;
trackBar_GraphY_Right.Maximum = (int)Max;
trackBar_GraphY_Right.Value = (int)Max;
}
private void trackBar_GraphY_Left_Scroll(object sender, EventArgs e)
{
if (checkBox_AutoY.Checked) return;
int min = trackBar_GraphY_Left.Value;
int max = trackBar_GraphY_Right.Value;
if (min > max)
{
int sub = min;
min = max;
max = sub;
}
if (max == min) max += 1;
chart_Graph.ChartAreas[0].AxisY.Minimum = min;
chart_Graph.ChartAreas[0].AxisY.Maximum = max;
}
private void checkedListBox_Series_SelectedIndexChanged(object sender, EventArgs e)
{
if (checkedListBox_Series.SelectedIndex == -1) return;
int index = checkedListBox_Series.SelectedIndex;
button_Color.BackColor = chart_Graph.Series[index].Color;
//---
for (int a = 0; a < checkedListBox_Series.Items.Count; a++)
{
chart_Graph.Series[a].Enabled = checkedListBox_Series.GetItemChecked(a);
}
}
private void button_Color_Click(object sender, EventArgs e)
{
if (colorDialog_Color.ShowDialog() == DialogResult.Cancel) return;
if (checkedListBox_Series.SelectedIndex == -1) return;
//---
int index = checkedListBox_Series.SelectedIndex;
chart_Graph.Series[index].Color = colorDialog_Color.Color;
button_Color.BackColor = colorDialog_Color.Color;
}
private void checkBox_AutoY_CheckedChanged(object sender, EventArgs e)
{
if(checkBox_AutoY.Checked)
{
chart_Graph.ChartAreas[0].AxisY.Maximum = double.NaN;
chart_Graph.ChartAreas[0].AxisY.Minimum = double.NaN;
}
else
{
trackBar_GraphY_Left_Scroll(null, null);
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colorDialog_Color.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A4DB35B3-5EFF-4B9C-B34B-8271AC3768F8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WindowsFormsApp1</RootNamespace>
<AssemblyName>WindowsFormsApp1</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Record.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Record.Designer.cs">
<DependentUpon>Record.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Record.resx">
<DependentUpon>Record.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>
</StartArguments>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1", "WindowsFormsApp1.csproj", "{A4DB35B3-5EFF-4B9C-B34B-8271AC3768F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A4DB35B3-5EFF-4B9C-B34B-8271AC3768F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4DB35B3-5EFF-4B9C-B34B-8271AC3768F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4DB35B3-5EFF-4B9C-B34B-8271AC3768F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4DB35B3-5EFF-4B9C-B34B-8271AC3768F8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC77AA94-A5B0-4C45-9E2D-935D68427ABA}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

View File

@ -0,0 +1 @@
1aa5979f3182e34c6d01851a32790ea5a4a91a71

View File

@ -0,0 +1,10 @@
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\bin\Release\WindowsFormsApp1.exe.config
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\bin\Release\WindowsFormsApp1.exe
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\bin\Release\WindowsFormsApp1.pdb
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.csproj.AssemblyReference.cache
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.Form1.resources
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.Properties.Resources.resources
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.csproj.GenerateResource.cache
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.csproj.CoreCompileInputs.cache
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.exe
D:\Desktop\MimiFly(2-4-8)\Graph\WindowsFormsApp1\obj\Release\WindowsFormsApp1.pdb