コード例 #1
0
ファイル: DefaultViewModel.cs プロジェクト: wslates/NR2K3Dash
        private void CheckAndDisplayWarnings()
        {
            while (true)
            {
                if (RPMWarning)
                {
                    RPMColor = (RPMColor.Equals(Brushes.Red)) ? Brushes.White : Brushes.Red;
                }
                else if (RPMColor.Equals(Brushes.Red))
                {
                    RPMColor = Brushes.White;
                }

                if (WaterTempWarning)
                {
                    WaterTempColor = (WaterTempColor.Equals(Brushes.Red)) ? Brushes.White : Brushes.Red;
                }
                else if (WaterTempColor.Equals(Brushes.Red))
                {
                    WaterTempColor = Brushes.White;
                }

                if (OilPressureWarning)
                {
                    OilPressureColor = (OilPressureColor.Equals(Brushes.Red)) ? Brushes.White : Brushes.Red;
                }
                else if (OilPressureColor.Equals(Brushes.Red))
                {
                    OilPressureColor = Brushes.White;
                }

                if (FuelPressureWarning)
                {
                    FuelPressureColor = (FuelPressureColor.Equals(Brushes.Red)) ? Brushes.White : Brushes.Red;
                }
                else if (FuelPressureColor.Equals(Brushes.Red))
                {
                    FuelPressureColor = Brushes.White;
                }

                Thread.Sleep(500);
            }
        }
コード例 #2
0
ファイル: AnalogViewModel.cs プロジェクト: wslates/NR2K3Dash
        private void RefreshDash(object sender, GaugeUpdatedEventArgs e)
        {
            //RPM
            RPM             = e._gaugeData.rpm;
            TachNeedleAngle = e._gaugeData.rpm;
            if (GetBit(e._gaugeData.warnings, 0))
            {
                if (RPMColor.Equals(Brushes.Black))
                {
                    TachFacePath = TACH_FACE_RED;
                    RPMColor     = Brushes.White;
                }
            }
            else if (RPMColor.Equals(Brushes.White))
            {
                TachFacePath = TACH_FACE;
                RPMColor     = Brushes.Black;
            }

            //Oil Temp
            OilTemp = UtilFunctions.CelsiusToFarenheit(e._gaugeData.oilTemp);
            OilTemperatureNeedleAngle = UtilFunctions.CelsiusToFarenheit(e._gaugeData.oilTemp);

            //water temp
            WaterTemp = UtilFunctions.CelsiusToFarenheit(e._gaugeData.waterTemp);
            WaterTemperatureNeedleAngle = UtilFunctions.CelsiusToFarenheit(e._gaugeData.waterTemp);

            if (GetBit(e._gaugeData.warnings, 1))
            {
                if (WaterTempColor.Equals(Brushes.Black))
                {
                    WaterTemperatureFacePath = WATT_FACE_RED;
                    WaterTempColor           = Brushes.White;
                }
            }
            else if (OilPressureColor.Equals(Brushes.White))
            {
                OilPressureFacePath = WATT_FACE;
                OilPressureColor    = Brushes.Black;
            }

            //oil pressure
            OilPressure            = UtilFunctions.KPAToPSI(e._gaugeData.oilPress);
            OilPressureNeedleAngle = UtilFunctions.KPAToPSI(e._gaugeData.oilPress);

            if (GetBit(e._gaugeData.warnings, 2))
            {
                if (OilPressureColor.Equals(Brushes.Black))
                {
                    OilPressureFacePath = OILP_FACE_RED;
                    OilPressureColor    = Brushes.White;
                }
            }
            else if (OilPressureColor.Equals(Brushes.White))
            {
                OilPressureFacePath = OILP_FACE;
                OilPressureColor    = Brushes.Black;
            }

            //voltage
            Voltage            = e._gaugeData.voltage;
            VoltageNeedleAngle = e._gaugeData.voltage;

            //fuel pressure
            FuelPressure            = UtilFunctions.KPAToPSI(e._gaugeData.fuelPress);
            FuelPressureNeedleAngle = UtilFunctions.KPAToPSI(e._gaugeData.fuelPress);

            if (GetBit(e._gaugeData.warnings, 3))
            {
                if (FuelPressureColor.Equals(Brushes.Black))
                {
                    FuelPressureFacePath = FUELP_FACE_RED;
                    FuelPressureColor    = Brushes.White;
                }
            }
            else if (FuelPressureColor.Equals(Brushes.White))
            {
                FuelPressureFacePath = FUELP_FACE;
                FuelPressureColor    = Brushes.Black;
            }
        }