Exemple #1
0
        private void AddMonitorManager(TabItem tab, MonitorManager manager)
        {
            Trace("");
            Trace("Adding monitor Manager: " + manager.GetType().Name);
            StackPanel tabContent = new StackPanel()
            {
                Orientation = Orientation.Vertical
            };

            tab.Content = tabContent;

            MonitorSliders masterSlider = new MonitorSliders(manager.MasterMonitor);

            tabContent.Children.Add(masterSlider);

            int            supportBrightness  = 0;
            int            supportContrast    = 0;
            int            supportTemperature = 0;
            List <Monitor> monitors           = manager.GetMonitorsList();

            foreach (Monitor monitor in monitors)
            {
                Trace("- " + monitor.ToStringDbg());
                MonitorSliders slider = new MonitorSliders(monitor);
                tabContent.Children.Add(slider);
                if (monitor.SupportsBrightness)
                {
                    supportBrightness++;
                }
                if (monitor.SupportsContrast)
                {
                    supportContrast++;
                }
                if (monitor.SupportsTemperature)
                {
                    supportTemperature++;
                }
            }

            // "< 2" or "== 0" whichever works better
            if (supportBrightness == 0)
            {
                masterSlider.BrightnessSliderLabel.Visibility = Visibility.Collapsed;
                masterSlider.BrightnessSlider.Visibility      = Visibility.Collapsed;
                masterSlider.BrightnessSliderText.Visibility  = Visibility.Collapsed;
            }
            if (supportContrast == 0)
            {
                masterSlider.ContrastSliderLabel.Visibility = Visibility.Collapsed;
                masterSlider.ContrastSlider.Visibility      = Visibility.Collapsed;
                masterSlider.ContrastSliderText.Visibility  = Visibility.Collapsed;
            }
            if (supportTemperature == 0)
            {
                masterSlider.TemperatureSliderLabel.Visibility = Visibility.Collapsed;
                masterSlider.TemperatureSlider.Visibility      = Visibility.Collapsed;
                masterSlider.TemperatureSliderText.Visibility  = Visibility.Collapsed;
            }
        }