TimeKeeper/TimeKeeper/Models/MTray.cs
2016-01-21 15:01:58 +00:00

35 lines
868 B
C#

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;
}
}
}
}