Автозаряд и авторазряд will do well.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using charger_gui.operations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO.Ports;
|
||||
@@ -23,43 +24,102 @@ namespace charger_gui
|
||||
}
|
||||
}
|
||||
|
||||
public float iAcc;
|
||||
public string IAcc
|
||||
private float iAcc;
|
||||
public float IAcc
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0,8:0.0000}", iAcc);
|
||||
return iAcc;
|
||||
}
|
||||
set
|
||||
{
|
||||
iAcc = value;
|
||||
OnPropertyChanged("IAcc");
|
||||
}
|
||||
}
|
||||
|
||||
public float uAcc;
|
||||
public string UAcc
|
||||
private float u1Acc;
|
||||
public float U1Acc
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0,8:0.0000}", uAcc);
|
||||
return u1Acc;
|
||||
}
|
||||
set
|
||||
{
|
||||
u1Acc = value;
|
||||
OnPropertyChanged("U1Acc");
|
||||
}
|
||||
}
|
||||
|
||||
public float iLamp;
|
||||
public string ILamp
|
||||
private float u2Acc;
|
||||
public float U2Acc
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0,8:0.0000}", iLamp);
|
||||
return u2Acc;
|
||||
}
|
||||
set
|
||||
{
|
||||
u2Acc = value;
|
||||
OnPropertyChanged("U2Acc");
|
||||
}
|
||||
}
|
||||
|
||||
public float uLamp;
|
||||
public string ULamp
|
||||
private float iLamp;
|
||||
public float ILamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0,8:0.0000}", uLamp);
|
||||
return iLamp;
|
||||
}
|
||||
set
|
||||
{
|
||||
iLamp = value;
|
||||
OnPropertyChanged("ILamp");
|
||||
}
|
||||
}
|
||||
|
||||
public bool isConnected;
|
||||
private float u1Lamp;
|
||||
public float U1Lamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return u1Lamp;
|
||||
}
|
||||
set
|
||||
{
|
||||
u1Lamp = value;
|
||||
OnPropertyChanged("U1Lamp");
|
||||
}
|
||||
}
|
||||
|
||||
private float u2Lamp;
|
||||
public float U2Lamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return u2Lamp;
|
||||
}
|
||||
set
|
||||
{
|
||||
u2Lamp = value;
|
||||
OnPropertyChanged("U2Lamp");
|
||||
}
|
||||
}
|
||||
|
||||
private bool isConnected;
|
||||
public bool IsConnected
|
||||
{
|
||||
set
|
||||
{
|
||||
if (isConnected != value)
|
||||
{
|
||||
isConnected = value;
|
||||
OnPropertyChanged("ConnectionStatus");
|
||||
}
|
||||
}
|
||||
}
|
||||
private Brush connectedBrush = new SolidColorBrush(Color.FromRgb(0, 255, 0));
|
||||
private Brush notConnectedBrush = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||
|
||||
@@ -72,17 +132,92 @@ namespace charger_gui
|
||||
}
|
||||
}
|
||||
|
||||
private bool isCharging;
|
||||
public bool IsCharging
|
||||
{
|
||||
get { return isCharging; }
|
||||
set
|
||||
{
|
||||
if (isCharging != value)
|
||||
{
|
||||
isCharging = value;
|
||||
OnPropertyChanged("ChargeStatus");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public Brush ChargeStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
if (isCharging) return connectedBrush;
|
||||
else return notConnectedBrush;
|
||||
}
|
||||
}
|
||||
private bool isLampOn;
|
||||
public bool IsLampOn
|
||||
{
|
||||
get { return isLampOn; }
|
||||
set
|
||||
{
|
||||
if (isLampOn != value)
|
||||
{
|
||||
isLampOn = value;
|
||||
OnPropertyChanged("LampStatus");
|
||||
}
|
||||
}
|
||||
}
|
||||
public Brush LampStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
if (isLampOn) return connectedBrush;
|
||||
else return notConnectedBrush;
|
||||
}
|
||||
}
|
||||
|
||||
private AutomaticOperation currentOperation;
|
||||
public AutomaticOperation CurrentOperation
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentOperation;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (currentOperation != null)
|
||||
{
|
||||
currentOperation.StatusChanged -= OnCurrentOperationStatusChanged;
|
||||
}
|
||||
currentOperation = value;
|
||||
currentOperation.StatusChanged += OnCurrentOperationStatusChanged;
|
||||
OnPropertyChanged("OperationStatus");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCurrentOperationStatusChanged()
|
||||
{
|
||||
OnPropertyChanged("OperationStatus");
|
||||
}
|
||||
|
||||
public string OperationStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
if (currentOperation == null) return "MANUAL MODE";
|
||||
return currentOperation.Status;
|
||||
}
|
||||
}
|
||||
|
||||
private void FillPorts()
|
||||
{
|
||||
ports = new List<string>(SerialPort.GetPortNames());
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
public void OnPropertyChanged(string name = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler == null) return;
|
||||
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user