Esempio n. 1
0
        private void AddDeviceControl(IDeviceControl deviceCtrl)
        {
            Action EmptyDelegate = delegate(){ };

            if (deviceCtrl.ActiveDevices.Count == 0)
            {
                RadioButton radioButton = new RadioButton();
                radioButton.Checked   += DeviceSelected;
                radioButton.Unchecked += DeviceDeselected;

                radioButton.Content   = deviceCtrl.ToString();
                radioButton.IsChecked = false;
                radioButton.IsEnabled = true;

                radioButton.Style   = this.FindResource("IZRadioButton") as Style;
                radioButton.ToolTip = deviceCtrl.ToString();

                TestDevicePanel.Children.Add(radioButton);
                radioButton.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
            }
            else
            {
                for (var dev = 0; dev < deviceCtrl.ActiveDevices.Count; dev++)
                {
                    RadioButton radioButton = new RadioButton();
                    radioButton.Checked   += DeviceSelected;
                    radioButton.Unchecked += DeviceDeselected;

                    radioButton.Content   = deviceCtrl.ActiveDevices[dev];
                    radioButton.IsChecked = false;
                    radioButton.Style     = this.FindResource("IZRadioButton") as Style;
                    radioButton.ToolTip   = deviceCtrl.ActiveDevices[dev].Description.Replace(", ", "\n");
                    TestDevicePanel.Children.Add(radioButton);
                    radioButton.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
                }
            }
        }
Esempio n. 2
0
        private void AddDeviceControl(IDeviceControl deviceCtrl)
        {
            RadioButton radioButton = new RadioButton();

            radioButton.Checked   += DeviceSelected;
            radioButton.Unchecked += DeviceDeselected;
            if (deviceCtrl.ActiveDevices.Count == 0)
            {
                radioButton.Content   = deviceCtrl.ToString();
                radioButton.IsChecked = false;
                radioButton.IsEnabled = true;

                radioButton.Style = this.FindResource("IZRadioButton") as Style;

                TestDevicePanel.Children.Add(radioButton);
            }
            else
            {
                radioButton.Content   = deviceCtrl.ActiveDevices[0];
                radioButton.IsChecked = false;
                radioButton.Style     = this.FindResource("IZRadioButton") as Style;
                TestDevicePanel.Children.Add(radioButton);
            }
        }