public ChannelInfoControl(IRelayDeviceInfo deviceInfo, IRelayChannelInfo channelInfo) { ChannelInfo = channelInfo; _deviceInfo = deviceInfo; InitializeComponent(); }
private void LoadDevice() { foreach (ChannelInfoControl child in Channels.Children.OfType <ChannelInfoControl>()) { child.ToggleStateClicked -= ChannelControl_ToggleStateClicked; } Channels.Children.Clear(); IRelayDeviceInfo device = GetCurrentDevice(); if (device == null) { return; } using (var relayController = new RelayController()) { relayController.ConnectDevice(device); List <IRelayChannelInfo> channels = relayController.ListChannels(device); foreach (var channel in channels) { var channelControl = new ChannelInfoControl(device, channel); channelControl.ToggleStateClicked += ChannelControl_ToggleStateClicked; Channels.Children.Add(channelControl); } } }
private void CloseAllChannels() { IRelayDeviceInfo device = GetCurrentDevice(); if (device == null) { return; } using (var relayController = new RelayController()) { relayController.ConnectDevice(device); relayController.CloseAllChannels(device); } }
private void LoadDevice() { IRelayDeviceInfo device = GetCurrentDevice(); }