35 lines
868 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|