Serial Port begin
This commit is contained in:
parent
50aac4425a
commit
58911791e9
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
Binary file not shown.
2
TimeKeeper/bin/Release/settings.ini
Normal file
2
TimeKeeper/bin/Release/settings.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[general]
|
||||
comport=COM4
|
2
TimeKeeper/settings.ini
Normal file
2
TimeKeeper/settings.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[general]
|
||||
comport=COM4
|
Loading…
Reference in New Issue
Block a user