Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();

            _viewModel  = new ViewModel();
            DataContext = _viewModel;

            InstrumentClusterElectronicsEmulator.Init();
            NavigationModuleEmulator.Init();
            AuxilaryHeaterEmulator.Init();
            RadioEmulator.Init();
            DigitalDieselElectronicsEmulator.Init();
            FrontDisplayEmulator.Init();
            HeadlightVerticalAimControlEmulator.Init();
            IntegratedHeatingAndAirConditioningEmulator.Init();
            VolumioEmulator.Init(_viewModel);

            Launcher.Launch(Launcher.LaunchMode.WPF);

            //AuxilaryHeaterEmulator.FirstMessageAfterWakeup();

            InstrumentClusterElectronics.IgnitionStateChanged += (e) =>
            {
                if (e.PreviousIgnitionState == IgnitionState.Acc && e.CurrentIgnitionState == IgnitionState.Ign)
                {
                    InstrumentClusterElectronicsEmulator.StartAnnounce();
                }

                if (e.PreviousIgnitionState == IgnitionState.Ign && e.CurrentIgnitionState == IgnitionState.Acc)
                {
                    InstrumentClusterElectronicsEmulator.StopAnnounce();
                }
            };

            Bordmonitor.ReplyToScreenUpdates = true;
            Bordmonitor.TextReceived        += Bordmonitor_TextReceived;
            FrontDisplayEmulator.LedChanged += FrontDisplayEmulator_LedChanged;
            InstrumentClusterElectronicsEmulator.OBCTextChanged += InstrumentClusterElectronicsEmulator_OBCTextChanged;

            //BordmonitorMenu.Instance.CurrentScreen = HomeScreen.Instance;

            Manager.Instance.AddMessageReceiverForSourceDevice(DeviceAddress.Radio, m =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    if (m.Data.StartsWith(Radio.DataRadioOn))
                    {
                        EnableRadio();
                    }
                    if (m.Data.StartsWith(Radio.DataRadioOff))
                    {
                        DisableRadio();
                    }
                });
            });
#if !DebugOnRealDeviceOverFTDI
            //Launcher.emulator.IsEnabled = true;
#endif
        }
Exemple #2
0
        public void Should_StartApp_AndAcquireDateTime()
        {
            ManualResetEvent dateTimeChangedWaitHandler = new ManualResetEvent(false);

            InstrumentClusterElectronicsEmulator.Init();

            InstrumentClusterElectronics.DateTimeChanged += (e) => { dateTimeChangedWaitHandler.Set(); };

            var now = DateTime.Now;

            Launcher.Launch(Launcher.LaunchMode.WPF);

            dateTimeChangedWaitHandler.WaitOne(Debugger.IsAttached ? 30000 : 1000);

            Assert.AreEqual(Utility.CurrentDateTime.Year, now.Year);
            Assert.AreEqual(Utility.CurrentDateTime.Month, now.Month);
            Assert.AreEqual(Utility.CurrentDateTime.Day, now.Day);
            Assert.AreEqual(Utility.CurrentDateTime.Hour, now.Hour);
            Assert.AreEqual(Utility.CurrentDateTime.Minute, now.Minute);
        }