Beispiel #1
0
        public async void ExecuteStartCommand()
        {
            BeginDialog dialog = new BeginDialog();
            await dialog.ShowAsync();

            if (dialog.DiagResult == ContentDialogResult.Primary)
            {
                CurrentTripDataRepo.DriveValue = EnumHelper.DeParse(DriveStateStatus.TripStarted);
                smartTimer.StopTimer();
                upTimer.Start();

                if (SelectedTripData.IsTripStarted != true)
                {
                    SelectedTripData.TripStartTime = CurrentTripDataRepo.StartTime = DateTime.Now;
                    SelectedTripData.IsTripStarted = CurrentTripDataRepo.IsTripStarted = true;
                    tripDataManager.SaveTrip(SelectedTripData);
                }

                StartCommand.RaiseCanExecuteChanged();
                StopCommand.RaiseCanExecuteChanged();
            }
        }
        public void IntervalTimerTest(MainForm frm)
        {
            IntervalTimer timer   = new IntervalTimer();
            long          loopMax = 100000000;
            long          sumNum  = 0;

            try
            {
                _msg.Length = 0;
                _msg.Append("IntervalTimerTest started ...\r\n");
                WriteMessageToLog(_msg.ToString());

                timer.StartTimer();

                for (long num = 1; num <= loopMax; num++)
                {
                    sumNum += num;
                }

                timer.StopTimer();

                _msg.Length = 0;
                _msg.Append(Environment.NewLine);
                _msg.Append("loopMax = ");
                _msg.Append(loopMax.ToString("#,##0"));
                _msg.Append(Environment.NewLine);
                _msg.Append("sumNum = ");
                _msg.Append(sumNum.ToString("#,##0"));
                _msg.Append(Environment.NewLine);
                _msg.Append("Elapsed time = ");
                _msg.Append(timer.ElapsedTime.ToString("#,##0"));
                _msg.Append(" milliseconds");
                _msg.Append(Environment.NewLine);
                WriteMessageToLog(_msg.ToString());
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                WriteMessageToLog(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                _msg.Length = 0;
                _msg.Append("\r\n... IntervalTimerTest finished.");
                WriteMessageToLog(_msg.ToString());
            }
        }