Example #1
0
        public MainForm(IAboutBox aboutBox,
                        ILogger logger,
                        IEchoer echoer,
                        IFileSender fileSender,
                        CurrentDataDevice dataDevice,
                        WinformsMainMenuExtender mainMenuExtender,
                        IEnumerable<IStatusbarExtension> statusbarExtensions)
        {
            _aboutBox = aboutBox;
            _logger = logger;
            _echoer = echoer;
            _fileSender = fileSender;
            _mainMenuExtender = mainMenuExtender;
            _statusbarExtensions = statusbarExtensions;

            _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;

            Log.Debug("Mainform object created");
        }
Example #2
0
 public MainForm(IAboutBox aboutBox, CurrentDataDevice dataDevice, WinformsMainMenuExtender mainMenuExtender, IEnumerable<IStatusbarExtension> statusbarExtensions)
     : this(aboutBox, null, null, null, dataDevice, mainMenuExtender, statusbarExtensions)
 {
 }