private void TransmitToViewDataIsTransmit_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if ((e.PropertyName == "IsTransmit") && (sender is TransmitToViewData viewData) && (TransmitToItems.Contains(viewData))) { if (viewData.IsTransmit) { if (TransmitToSelectedChannels == null) { TransmitToSelectedChannels = viewData.Transmit; } else { TransmitToSelectedChannels += viewData.Transmit; } } else { try { TransmitToSelectedChannels -= viewData.Transmit; } catch { } } } }
private void Device_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName != "Device") { return; } //create ViewData for transmitable channels _context.Send((s) => { //remove real channels TransmitToItems.RemoveAll(x => x.IsRealChannel); }, null); TransmitToSelectedChannels = null; if (Settings.Instance.Device != null && Settings.Instance.Device.IsConnected && Settings.Instance.Device.Channels != null) { Settings.Instance.Device.IsConnectedChanged += Device_IsConnectedChanged; AddTransmitToItems(Settings.Instance.Device.Channels, true); } }