Ejemplo n.º 1
0
 protected SerialStatusBarExtension(ISerialPort iSerialPort, CurrentDataDevice currentDataDevice)
 {
     _serialPort = iSerialPort;
     _serialPort.PropertyChanged        += (sender, args) => UpdateStatusBarItem();
     _currentDataDevice                  = currentDataDevice;
     _currentDataDevice.PropertyChanged += (sender, args) => UpdateVisibility();
 }
Ejemplo n.º 2
0
        public MainForm(IAboutBox aboutBox,
                        ILogger logger,
                        CurrentDataDevice dataDevice,
                        WinformsMainMenuExtender mainMenuExtender,
                        IEnumerable <IStatusbarExtension> statusbarExtensions,
                        IEnumerable <IToolbarExtension> toolbarExtensions)
        {
            _aboutBox            = aboutBox;
            _logger              = logger;
            _mainMenuExtender    = mainMenuExtender;
            _statusbarExtensions = statusbarExtensions;
            _toolbarExtensions   = toolbarExtensions;

            _currentDataDevice = dataDevice;
            _currentDataDevice.PropertyChanged += (sender, args) =>
            {
                var oldDataDevice = _dataDevice;
                _dataDevice = _currentDataDevice.CurrentDevice;
                if (_dataDevice != null)
                {
                    _dataDevice.PropertyChanged += DataDeviceOnPropertyChanged;
                    _dataDevice.DataReceived    += DataDeviceOnDataReceived;
                }
                if (oldDataDevice != null)
                {
                    oldDataDevice.PropertyChanged -= DataDeviceOnPropertyChanged;
                    oldDataDevice.DataReceived    -= DataDeviceOnDataReceived;
                }
            };

            _dataDevice = _currentDataDevice.CurrentDevice;

            LogTo.Debug("Mainform object created");
        }
        public CurrentDeviceSerialStatusLabel(CurrentDataDevice terminal)
        {
            _terminal = terminal;
            _terminal.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "CurrentDevice")
                {
                    SetDataDevicePropertyChanged();
                    UpdateLabel();
                }
            };

            SetDataDevicePropertyChanged();
        }
Ejemplo n.º 4
0
 public PortMenu(ISerialPort serialPort, CurrentDataDevice terminal)
     : base(serialPort)
 {
     _dataDevice = terminal;
 }
Ejemplo n.º 5
0
 public DeviceSelectionMenu(IDataDevice dataDevice, CurrentDataDevice terminal)
 {
     _dataDevice = dataDevice;
     _terminal   = terminal;
     _dataDevice.PropertyChanged += (sender, args) => UpdateCheckedStates(args.PropertyName);
 }
Ejemplo n.º 6
0
 public SerialStatusbarPortMenu(ISerialPort iSerialPort, CurrentDataDevice currentDataDevice)
     : base(iSerialPort, currentDataDevice)
 {
 }
Ejemplo n.º 7
0
 public SerialStatusbarBaudMenu(ISerialPort serialPort, CurrentDataDevice currentDataDevice)
     : base(serialPort, currentDataDevice)
 {
     _baudRates = new List <int>(new[] { 110, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 });
 }
Ejemplo n.º 8
0
 public SerialStatusbarStatusLabel(ISerialPort serialPort, CurrentDataDevice currentDataDevice)
     : base(serialPort, currentDataDevice)
 {
 }