Beispiel #1
0
        public MainWindow()
        {
            _datumLock = new ReaderWriterLockSlim();
            InitializeComponent();
            try
            {
                _RiderView = RiderViewModel.Load();
            }
            catch (Exception ex)
            {
                _RiderView = new RiderViewModel();
            }

            try
            {
                Device.Instance(); // force initialisation
                _RiderView.AntEnabled = true;
            }
            catch (Exception ex)
            {
                _RiderView.AntEnabled = false;
            }

            try
            {
                initialiseSender();
            }
            catch (Exception ex)
            {
            }
            myRiders.DataContext = _RiderView;
        }
Beispiel #2
0
 public static RiderViewModel Load()
 {
     Properties.Settings.Default.Reload();
     RiderViewModel rvm = Properties.Settings.Default.RiderViewModel;
     if (rvm == null)
     {
         rvm = new RiderViewModel();
     }
     else
     {
         // Need to reinitialise all those sensors
         foreach (RiderUI r in rvm.RiderUIs)
         {
             foreach (SensorUI s in r.SensorUIs)
             {
                 s.Reinitialise();
                 s.Sensor.SensorMessage += new SensorMessageHandler(r.Rider.SensorMessageReceived);
             }
         }
     }
     return rvm;
 }