Example #1
0
        public DriveLogic(Driver driver)
        {
            _currentDriver = driver;
            frontAlerters = new List<FrontCameraAlerterAbstract>();
            frontAlerters.Add(new EyeDetectorAlerter());

            _currentDrive = new Drive(_currentDriver, DateTime.Now);


        }
        /// <summary>
        /// Populate the UI Fields via the Drive variable passed.
        /// </summary>
        /// <param name="drive">Last Drive to be used</param>
        private void populateFields(Drive drive)
        {
            var driveDuration = drive.EndTime.Subtract(drive.StartTime);
            txtDrivingTime.Text = string.Format("{0} : {1}", driveDuration.Hours, driveDuration.Minutes);
            txtDriverAVGScore.Text = String.Format("{0:0.##}", drive.Driver.AverageScore);
            AlertEvent commonAlert = drive.Events.GroupBy(evnt => evnt.AlertType)
                .OrderByDescending(type => type.Count()).SelectMany(g => g).FirstOrDefault();

            txtCommonHazzard.Text = commonAlert != null ? 
                WatchDogHelper.GetEnumDescription(commonAlert.AlertType) : 
                "--";
            txtSafetyScore.Text = drive.Events.Any() ? 
                String.Format("{0:0.##}",drive.Events.Average(evnt => evnt.AlertLevel)) 
                : "0";
        }
Example #3
0
 private void startDrive()
 {
     _currentDrive = new Drive(new Driver("Name", "User", "Pass"), DateTime.Now);
     _driveBeginingTime = DateTime.Now;
 }
 private async void updateDriveToDatabase(Drive lastDrive)
 {
     await drivesTable.InsertAsync(lastDrive);
 }
Example #5
0
        private void EndDrive()
        {
            pumpARGBFrames = false;
            _currentDrive = _driveLogic._currentDrive;
            _currentDrive.EndTime = DateTime.Now;

            PhoneApplicationService.Current.State["CurrentDrive"] = _currentDrive;
            NavigationService.Navigate(new Uri("/Screens/DriveSummaryScreen.xaml", UriKind.Relative));
        }
 private void populateFields(Drive drive)
 {
     txtDrivingTime.Text = drive.EndTime.Subtract(drive.StartTime).ToString("HH:MM");
     txtDriverAVGScore.Text = drive.Driver.AverageScore.ToString();
 }