예제 #1
0
        public ChannelInfoControl(IRelayDeviceInfo deviceInfo, IRelayChannelInfo channelInfo)
        {
            ChannelInfo = channelInfo;
            _deviceInfo = deviceInfo;

            InitializeComponent();
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        private void CloseAllChannels()
        {
            IRelayDeviceInfo device = GetCurrentDevice();

            if (device == null)
            {
                return;
            }
            using (var relayController = new RelayController())
            {
                relayController.ConnectDevice(device);
                relayController.CloseAllChannels(device);
            }
        }
예제 #4
0
 private void LoadDevice()
 {
     IRelayDeviceInfo device = GetCurrentDevice();
 }