Exemple #1
0
        /// <summary>
        /// All static classes and singletons meant for global
        /// usage are activated here. Some areas depend on these classes having their
        /// data loaded before the program starts (e.g., OdometerTracker), so it
        /// is very important that they are called here. All static classes should at
        /// the bare minimum implement an empty Activate() method to ensure their
        /// constructors are called
        /// </summary>
        private void ActivateStaticClasses()
        {
            EventBridge.Initialize();
            DiagnosticsParser.Initialize();
            CanMessageHandler.Initialize();
            ConfigManager.LoadConfiguration();
            DiagnosticLogger.Initialize();
            RawLogger.Initialize();
            PIDValueStager.Initialize();
            _EngineDataParser = new EngineDataParser();
            _Acceleration     = new Acceleration();
            _Trackers         = new Trackers();
            ChassisParameters.Initialize();
            var engineFilePointer = new FileOpener(ConfigManager.Settings.Contents.engineFilePath);

            if (engineFilePointer.Exists())
            {
                EngineSpec.SetEngineFile(engineFilePointer.absoluteFilepath);
            }
            else
            {
                MessageBox.Show("No engine files can be found. Horsepower and Torque settings will be inaccurate");
            }
            SPNDefinitions.Activate();      //in VMSpc/Parsers/J1939/SPNDefinitions.cs - Defines every SPN object
            //Odometer.Activate();
            //ParamData.Activate();
            TireManager.Initialize();
            CommunicationManager.Initialize();
            DayNightManager.Initialize();
        }
Exemple #2
0
        private void OkayButton_Click(object sender, RoutedEventArgs e)
        {
            var tireTypes = Enum.GetValues(typeof(TireMapType));

            foreach (RadioButton radioButton in TireLayout.Children)
            {
                if (radioButton.IsChecked == true)
                {
                    foreach (TireMapType tireMapType in tireTypes)
                    {
                        if (tireMapType.GetDescription() == radioButton.Content.ToString())
                        {
                            Settings.tireMapType = tireMapType;
                        }
                    }
                }
            }
            if (Settings.tpmsType != tpmsType)
            {
                Settings.tpmsType = tpmsType;
                TireManager.Initialize();
            }
            DialogResult = true;
            UpdateTimer?.Stop();
            UpdateTimer.Dispose();
            UpdateTimer = null;
            Close();
        }