Added ComPort

This commit is contained in:
2015-09-01 21:53:47 +02:00
parent 11b7e55cc9
commit 7bb15c63dd
5 changed files with 26 additions and 11 deletions
@@ -46,16 +46,16 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Form1.cs"> <Compile Include="MainWindow.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Form1.Designer.cs"> <Compile Include="MainWindow.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>MainWindow.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="MainWindow.resx">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>MainWindow.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
@@ -1,6 +1,6 @@
namespace ErgometerSimulator namespace ErgometerSimulator
{ {
partial class Form1 partial class MainWindow
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -30,12 +30,12 @@
{ {
this.SuspendLayout(); this.SuspendLayout();
// //
// Form1 // MainWindow
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(370, 253); this.ClientSize = new System.Drawing.Size(370, 253);
this.Name = "Form1"; this.Name = "MainWindow";
this.Text = "Ergometer Simulator"; this.Text = "Ergometer Simulator";
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -10,9 +10,9 @@ using System.Windows.Forms;
namespace ErgometerSimulator namespace ErgometerSimulator
{ {
public partial class Form1 : Form public partial class MainWindow : Form
{ {
public Form1() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
} }
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO.Ports;
namespace ErgometerSimulator namespace ErgometerSimulator
{ {
@@ -16,7 +17,21 @@ namespace ErgometerSimulator
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); Application.Run(new MainWindow());
startComportConnection();
} }
private static void startComportConnection()
{
SerialPort comPort = new SerialPort();
comPort.PortName = "COM6";
comPort.DataBits = 8;
comPort.Parity = Parity.None;
comPort.StopBits = StopBits.One;
comPort.BaudRate = 9600;
}
} }
} }