HamBook – Rev 55

Subversion Repositories:
Rev:
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
using Configuration.Annotations;
using RJCP.IO.Ports;

namespace Configuration
{
    [XmlRoot(Namespace = "urn:hambook-configuration-schema", ElementName = "Configuration")]
    public class Configuration : INotifyPropertyChanged
    {
        private Audio _audio = new Audio();
        private int _dataBits = 8;
        private Definitions _definitions = new Definitions();
        private Handshake _handshake = Handshake.None;
        private bool _launchOnBoot;
        private Navigation _navigation = new Navigation();
        private Notifications _notifications = new Notifications();
        private Parity _parity = Parity.None;
        private string _port = "COM1";
        private string _radio = "Yaesu FT-891";
        private SerialPortTimeout _serialPortTimeout = new SerialPortTimeout();
        private int _speed = 38400;
        private StopBits _stopBits = StopBits.One;
        private Visualizations _visualizations = new Visualizations();

        public bool LaunchOnBoot
        {
            get => _launchOnBoot;
            set
            {
                if (value == _launchOnBoot) return;

                _launchOnBoot = value;
                OnPropertyChanged();
            }
        }

        public string Radio
        {
            get => _radio;
            set
            {
                if (value == _radio) return;

                _radio = value;
                OnPropertyChanged();
            }
        }

        public string Port
        {
            get => _port;
            set
            {
                if (value == _port) return;

                _port = value;
                OnPropertyChanged();
            }
        }

        public int Speed
        {
            get => _speed;
            set
            {
                if (value == _speed) return;

                _speed = value;
                OnPropertyChanged();
            }
        }

        public int DataBits
        {
            get => _dataBits;
            set
            {
                if (value == _dataBits) return;

                _dataBits = value;
                OnPropertyChanged();
            }
        }

        public Parity Parity
        {
            get => _parity;
            set
            {
                if (value == _parity) return;

                _parity = value;
                OnPropertyChanged();
            }
        }

        public StopBits StopBits
        {
            get => _stopBits;
            set
            {
                if (value == _stopBits) return;

                _stopBits = value;
                OnPropertyChanged();
            }
        }

        public Handshake Handshake
        {
            get => _handshake;
            set
            {
                if (value == _handshake) return;

                _handshake = value;
                OnPropertyChanged();
            }
        }

        public SerialPortTimeout SerialPortTimeout
        {
            get => _serialPortTimeout;
            set
            {
                if (value == _serialPortTimeout) return;

                _serialPortTimeout = value;
                OnPropertyChanged();
            }
        }

        public Definitions Definitions
        {
            get => _definitions;
            set
            {
                if (value == _definitions) return;

                _definitions = value;
                OnPropertyChanged();
            }
        }

        public Audio Audio
        {
            get => _audio;
            set
            {
                if (value == _audio) return;

                _audio = value;
                OnPropertyChanged();
            }
        }

        public Notifications Notifications
        {
            get => _notifications;
            set
            {
                if (value == _notifications) return;

                _notifications = value;
                OnPropertyChanged();
            }
        }

        public Visualizations Visualizations
        {
            get => _visualizations;
            set
            {
                if (value == _visualizations) return;

                _visualizations = value;
                OnPropertyChanged();
            }
        }

        public Navigation Navigation
        {
            get => _navigation;
            set
            {
                if (value == _navigation) return;

                _navigation = value;
                OnPropertyChanged();
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

Generated by GNU Enscript 1.6.5.90.