コード例 #1
0
ファイル: OptionsDialog.cs プロジェクト: xiangnanyue/DDD
        private void SaveRangeRingTab()
        {
            //saves current UI values to DDD_Global

            //save sensors
            string sensorColorName     = GetColorName(comboBoxSensorsColor);
            int    sensorOpacitySlider = trackBarSensorsOpacity.Value;
            float  sensorOpacity       = sensorOpacitySlider * 10f * 2.55f;

            DDD_RangeRings.GetInstance().SensorRangeRings.RingColor = Color.FromName(sensorColorName).ToArgb();
            DDD_RangeRings.GetInstance().SensorRangeRings.Opacity = Convert.ToInt32(Math.Round(sensorOpacity));


            //save capabilities
            string capabilityColorName     = GetColorName(comboBoxCapabilitiesColor);
            int    capabilityOpacitySlider = trackBarCapabilitiesOpacity.Value;
            float  capabilityOpacity       = capabilityOpacitySlider * 10f * 2.55f;

            DDD_RangeRings.GetInstance().CapabilityRangeRings.RingColor = Color.FromName(capabilityColorName).ToArgb();
            DDD_RangeRings.GetInstance().CapabilityRangeRings.Opacity = Convert.ToInt32(Math.Round(capabilityOpacity));

            //save vulnerabilities
            string vulnerabilityColorName     = GetColorName(comboBoxVulnerabilitiesColor);
            int    vulnerabilityOpacitySlider = trackBarVulnerabilitiesOpacity.Value;
            float  vulnerabilityOpacity       = vulnerabilityOpacitySlider * 10f * 2.55f;

            DDD_RangeRings.GetInstance().VulnerabilityRangeRings.RingColor = Color.FromName(vulnerabilityColorName).ToArgb();
            DDD_RangeRings.GetInstance().VulnerabilityRangeRings.Opacity = Convert.ToInt32(Math.Round(vulnerabilityOpacity));
        }
コード例 #2
0
ファイル: OptionsDialog.cs プロジェクト: xiangnanyue/DDD
        private void PopulateRangeRingTab()
        {
            //set sensor color
            Color sensorColor = GetNamedColorFromArgb(DDD_RangeRings.GetInstance().SensorRangeRings.RingColor);

            if (!sensorColor.IsNamedColor)
            {
                sensorColor = Color.FromArgb(sensorColor.R, sensorColor.G, sensorColor.B);
            }
            comboBoxSensorsColor.Text = sensorColor.Name;  //will update swatch

            //set sensor opacity
            int opacityPercent = DDD_RangeRings.GetInstance().SensorRangeRings.GetOpacityAsPercentage(1);

            trackBarSensorsOpacity.Value = opacityPercent / 10; //will update swatch


            //set Capability color
            Color capabilityColor = GetNamedColorFromArgb(DDD_RangeRings.GetInstance().CapabilityRangeRings.RingColor);

            if (!capabilityColor.IsNamedColor)
            {
                capabilityColor = Color.FromArgb(capabilityColor.R, capabilityColor.G, capabilityColor.B);
            }
            comboBoxCapabilitiesColor.Text = capabilityColor.Name; //will update swatch

            //set Capability opacity
            opacityPercent = DDD_RangeRings.GetInstance().CapabilityRangeRings.GetOpacityAsPercentage(1);
            trackBarCapabilitiesOpacity.Value = opacityPercent / 10; //will update swatch

            //set Vulnerability color
            Color vulnerabilityColor = GetNamedColorFromArgb(DDD_RangeRings.GetInstance().VulnerabilityRangeRings.RingColor);

            if (!vulnerabilityColor.IsNamedColor)
            {
                vulnerabilityColor = Color.FromArgb(vulnerabilityColor.R, vulnerabilityColor.G, vulnerabilityColor.B);
            }
            comboBoxVulnerabilitiesColor.Text = vulnerabilityColor.Name; //will update swatch

            //set Vulnerability opacity
            opacityPercent = DDD_RangeRings.GetInstance().VulnerabilityRangeRings.GetOpacityAsPercentage(1);
            trackBarVulnerabilitiesOpacity.Value = opacityPercent / 10; //will update swatch
        }