Serial Port begin

This commit is contained in:
BlubbFish 2016-01-21 15:01:58 +00:00
parent 50aac4425a
commit 58911791e9
6 changed files with 25 additions and 0 deletions

View File

@ -1,16 +1,34 @@
using BlubbFish.Utils;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TimeKeeper.Models {
class Tray : OwnModel<Tray> {
private Boolean isConnectedValue;
private SerialPort serial;
private InIReader settingsfile;
private Tray() {
this.init();
}
public Boolean isConnected {
get { return this.isConnectedValue; }
set { this.isConnectedValue = value; this.update(); }
}
override protected void init() {
this.settingsfile = InIReader.getInstance("settings.ini");
this.serial = new SerialPort(this.settingsfile.getValue("general", "comport"));
try {
this.serial.Open();
} catch(Exception) {
this.isConnected = false;
}
}
}
}

View File

@ -83,6 +83,9 @@
</ItemGroup>
<ItemGroup>
<None Include="Resources\Icons\main.ico" />
<None Include="settings.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Icons\door_open.png" />

Binary file not shown.

View File

@ -0,0 +1,2 @@
[general]
comport=COM4

2
TimeKeeper/settings.ini Normal file
View File

@ -0,0 +1,2 @@
[general]
comport=COM4