opslaan
opslaan
This commit is contained in:
Binary file not shown.
+10
-2
@@ -43,6 +43,8 @@ namespace ErgometerApplication
|
|||||||
this.timeButton = new System.Windows.Forms.Button();
|
this.timeButton = new System.Windows.Forms.Button();
|
||||||
this.energyButton = new System.Windows.Forms.Button();
|
this.energyButton = new System.Windows.Forms.Button();
|
||||||
this.distanceButton = new System.Windows.Forms.Button();
|
this.distanceButton = new System.Windows.Forms.Button();
|
||||||
|
this.saveTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.writeTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// richTextBox1
|
// richTextBox1
|
||||||
@@ -67,11 +69,15 @@ namespace ErgometerApplication
|
|||||||
// ComPortBox
|
// ComPortBox
|
||||||
//
|
//
|
||||||
this.ComPortBox.FormattingEnabled = true;
|
this.ComPortBox.FormattingEnabled = true;
|
||||||
this.ComPortBox.Items.AddRange(SerialPort.GetPortNames());
|
this.ComPortBox.Items.AddRange(new object[] {
|
||||||
|
"CNCA0",
|
||||||
|
"CNCB0",
|
||||||
|
"COM3",
|
||||||
|
"COM4"});
|
||||||
this.ComPortBox.Location = new System.Drawing.Point(12, 291);
|
this.ComPortBox.Location = new System.Drawing.Point(12, 291);
|
||||||
this.ComPortBox.Name = "ComPortBox";
|
this.ComPortBox.Name = "ComPortBox";
|
||||||
this.ComPortBox.Size = new System.Drawing.Size(97, 24);
|
this.ComPortBox.Size = new System.Drawing.Size(97, 24);
|
||||||
this.ComPortBox.SelectedItem = 1;
|
this.ComPortBox.TabIndex = 11;
|
||||||
//
|
//
|
||||||
// statusButton
|
// statusButton
|
||||||
//
|
//
|
||||||
@@ -203,5 +209,7 @@ namespace ErgometerApplication
|
|||||||
private System.Windows.Forms.Button timeButton;
|
private System.Windows.Forms.Button timeButton;
|
||||||
private System.Windows.Forms.Button energyButton;
|
private System.Windows.Forms.Button energyButton;
|
||||||
private System.Windows.Forms.Button distanceButton;
|
private System.Windows.Forms.Button distanceButton;
|
||||||
|
private System.Windows.Forms.Timer saveTimer;
|
||||||
|
private System.Windows.Forms.Timer writeTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ namespace ErgometerApplication
|
|||||||
public partial class Ergometer : Form
|
public partial class Ergometer : Form
|
||||||
{
|
{
|
||||||
private ComPort comPort;
|
private ComPort comPort;
|
||||||
|
private Meting schrijfweg;
|
||||||
|
private List<Meting> _data;
|
||||||
public Ergometer()
|
public Ergometer()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -154,12 +155,54 @@ namespace ErgometerApplication
|
|||||||
{
|
{
|
||||||
statusButton.Enabled = false;
|
statusButton.Enabled = false;
|
||||||
updateTimer.Start();
|
updateTimer.Start();
|
||||||
|
saveTimer.Start();
|
||||||
|
writeTimer.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
statusButton.Enabled = true;
|
statusButton.Enabled = true;
|
||||||
updateTimer.Stop();
|
updateTimer.Stop();
|
||||||
|
saveTimer.Stop();
|
||||||
|
writeTimer.Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
saveData(schrijfweg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
string json = JsonConvert.SerializeObject(_data.ToArray());
|
||||||
|
|
||||||
|
System.IO.File.WriteAllText(@Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "//path.ergo", json);
|
||||||
|
}
|
||||||
|
private void saveData(Meting meting)
|
||||||
|
{
|
||||||
|
_data = new List<Meting>();
|
||||||
|
_data.Add(new Meting()
|
||||||
|
{
|
||||||
|
HeartBeat = schrijfweg.HeartBeat,
|
||||||
|
RPM = schrijfweg.RPM,
|
||||||
|
Speed = schrijfweg.Speed,
|
||||||
|
Distance = schrijfweg.Distance,
|
||||||
|
Power = schrijfweg.Power,
|
||||||
|
Energy = schrijfweg.Energy,
|
||||||
|
Seconds = schrijfweg.Seconds,
|
||||||
|
ActualPower = schrijfweg.ActualPower
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
writeFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ergometer_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
<?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="updateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>160, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="writeTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>285, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
@@ -57,6 +57,9 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="Ergometer.resx">
|
||||||
|
<DependentUpon>Ergometer.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ErgometerApplication
|
namespace ErgometerApplication
|
||||||
{
|
{
|
||||||
class Meting
|
public class Meting
|
||||||
{
|
{
|
||||||
public int HeartBeat { get; }
|
public int HeartBeat { get; set; }
|
||||||
public int RPM { get; }
|
public int RPM { get; set; }
|
||||||
public double Speed { get; }
|
public double Speed { get; set; }
|
||||||
public double Distance { get; }
|
public double Distance { get; set; }
|
||||||
public int Power { get; }
|
public int Power { get; set; }
|
||||||
public int Energy { get; }
|
public int Energy { get; set; }
|
||||||
public int Seconds { get; }
|
public int Seconds { get; set; }
|
||||||
public int ActualPower { get; }
|
public int ActualPower { get; set; }
|
||||||
|
|
||||||
public Meting(int heartbeat, int rpm, double speed, double distance, int power, int energy, int seconds, int actualpower)
|
public Meting(int heartbeat, int rpm, double speed, double distance, int power, int energy, int seconds, int actualpower)
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,10 @@ namespace ErgometerApplication
|
|||||||
Seconds = seconds;
|
Seconds = seconds;
|
||||||
ActualPower = actualpower;
|
ActualPower = actualpower;
|
||||||
}
|
}
|
||||||
|
public Meting()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string temp = "";
|
string temp = "";
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
</assembly>
|
||||||
BIN
Binary file not shown.
+2
@@ -7,3 +7,5 @@ C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\Ergome
|
|||||||
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache
|
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache
|
||||||
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
|
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
|
||||||
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
|
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
|
||||||
|
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
|
||||||
|
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
|
||||||
|
|||||||
Reference in New Issue
Block a user