Zzz – Rev 1
?pathlinks?
using Configuration.Annotations;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
namespace Configuration
{
[XmlRoot(Namespace = "urn:zzz-configuration-schema", ElementName = "Configuration")]
public class Configuration : INotifyPropertyChanged
{
private bool _launchOnBoot = false;
private bool _enabled = true;
private decimal _timeout = 5;
private string _action = "Dim";
private bool _mqttEnable = false;
private string _mqttServer = string.Empty;
private decimal _mqttPort = 1883;
private string _mqttUsername = string.Empty;
private string _mqttPassword = string.Empty;
private string _mqttTopic = "Zzz";
private decimal _mouseMoveTolerance = 50;
private bool _monitorMouse = true;
private bool _monitorKeyboard = true;
private string _actionClick = "Dim";
private string _actionDoubleClick = "Standby";
private bool _monitorBluetooth = false;
private bool _monitorWindows = false;
private bool _debugging = false;
private decimal _bluetoothScanInterval = 1;
private ObservableCollection<string> _bluetoothWatchList = new ObservableCollection<string>() { };
private ObservableCollection<string> _windowsWatchList = new ObservableCollection<string>() { };
private decimal _hibernateTimeout = 30;
private bool _hibernateEnabled = false;
private decimal _clickActionDelay = 250;
public bool LaunchOnBoot
{
get => _launchOnBoot;
set
{
if (value == _launchOnBoot)
{
return;
}
_launchOnBoot = value;
OnPropertyChanged();
}
}
public bool Enabled
{
get => _enabled;
set
{
if (value == _enabled)
{
return;
}
_enabled = value;
OnPropertyChanged();
}
}
public decimal Timeout
{
get => _timeout;
set
{
if (value == _timeout)
{
return;
}
_timeout = value;
OnPropertyChanged();
}
}
public string Action
{
get => _action;
set
{
if (value == _action)
{
return;
}
_action = value;
OnPropertyChanged();
}
}
public bool MqttEnable
{
get => _mqttEnable;
set
{
if (value == _mqttEnable)
{
return;
}
_mqttEnable = value;
OnPropertyChanged();
}
}
public string MqttServer
{
get => _mqttServer;
set
{
if (value == _mqttServer)
{
return;
}
_mqttServer = value;
OnPropertyChanged();
}
}
public decimal MqttPort
{
get => _mqttPort;
set
{
if (value == _mqttPort)
{
return;
}
_mqttPort = value;
OnPropertyChanged();
}
}
public string MqttUsername
{
get => _mqttUsername;
set
{
if (value == _mqttUsername)
{
return;
}
_mqttUsername = value;
OnPropertyChanged();
}
}
public string MqttPassword
{
get => _mqttPassword;
set
{
if (value == _mqttPassword)
{
return;
}
_mqttPassword = value;
OnPropertyChanged();
}
}
public string MqttTopic
{
get => _mqttTopic;
set
{
if (value == _mqttTopic)
{
return;
}
_mqttTopic = value;
OnPropertyChanged();
}
}
public decimal MouseMoveTolerance
{
get => _mouseMoveTolerance;
set
{
if (value == _mouseMoveTolerance)
{
return;
}
_mouseMoveTolerance = value;
OnPropertyChanged();
}
}
public bool MonitorMouse
{
get => _monitorMouse;
set
{
if (value == _monitorMouse)
{
return;
}
_monitorMouse = value;
OnPropertyChanged();
}
}
public bool MonitorKeyboard
{
get => _monitorKeyboard;
set
{
if (value == _monitorKeyboard)
{
return;
}
_monitorKeyboard = value;
OnPropertyChanged();
}
}
public string ActionClick
{
get => _actionClick;
set
{
if (value == _actionClick)
{
return;
}
_actionClick = value;
OnPropertyChanged();
}
}
public string ActionDoubleClick
{
get => _actionDoubleClick;
set
{
if (value == _actionDoubleClick)
{
return;
}
_actionDoubleClick = value;
OnPropertyChanged();
}
}
public bool MonitorBluetooth
{
get => _monitorBluetooth;
set
{
if (value == _monitorBluetooth)
{
return;
}
_monitorBluetooth = value;
OnPropertyChanged();
}
}
public bool MonitorWindows
{
get => _monitorWindows;
set
{
if (value == _monitorWindows)
{
return;
}
_monitorWindows = value;
OnPropertyChanged();
}
}
public bool Debugging
{
get => _debugging;
set
{
if (value == _debugging)
{
return;
}
_debugging = value;
OnPropertyChanged();
}
}
public decimal BluetoothScanInterval
{
get => _bluetoothScanInterval;
set
{
if (value == _bluetoothScanInterval)
{
return;
}
_bluetoothScanInterval = value;
OnPropertyChanged();
}
}
public decimal ClickActionDelay
{
get => _clickActionDelay;
set
{
if (value == _clickActionDelay)
{
return;
}
_clickActionDelay = value;
OnPropertyChanged();
}
}
public ObservableCollection<string> BluetoothWatchList
{
get => _bluetoothWatchList;
set
{
if (value == _bluetoothWatchList)
{
return;
}
_bluetoothWatchList = value;
OnPropertyChanged();
}
}
public ObservableCollection<string> WindowsWatchList
{
get => _windowsWatchList;
set
{
if (value == _windowsWatchList)
{
return;
}
_windowsWatchList = value;
OnPropertyChanged();
}
}
public decimal HibernateTimeout
{
get => _hibernateTimeout;
set
{
if (value == _hibernateTimeout)
{
return;
}
_hibernateTimeout = value;
OnPropertyChanged();
}
}
public bool HibernateEnabled
{
get => _hibernateEnabled;
set
{
if (value == _hibernateEnabled)
{
return;
}
_hibernateEnabled = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}