public void StopCharging() { IsChargingThread = false; IsCharging = false; SqlLiteHelper.SaveTranineesInfo(_trnLicense); SqlLiteHelper.SaveChargesInfo(_chargesDisplayInfo); SqlLiteHelper.SaveTraningInfo(_trnLicense); writeToDisk(); if (StopNewExamDelegate != null) { StopNewExamDelegate(); } }
public bool StartCharge(string autoType) { _sw.WriteLine(DateTime.Now.ToLocalTime() + ":" + "准备开始计费,开始检测许可信息……"); _lincenseState = _trnLicense.CheckLicense(autoType); SqlLiteHelper.SaveTranineesInfo(_trnLicense); if (_lincenseState == LicenseState.Normal) { _sw.WriteLine(DateTime.Now.ToLocalTime() + ":" + "该许可信息有效……"); if (_currentInfoControl == null) { _currentInfoControl = new ChargingControl(); _currentInfoControl.Show(); } else { _currentInfoControl.Show(); } IsChargerControlHide = false; _chargesDisplayInfo = new ChargesInfo { PidNo = _trnLicense.PidNo, Mode = _trnLicense.ChargeMode, SeqNo = Guid.NewGuid().ToString("N").ToUpper(), CurrentMileage = _trnLicense.MileageLmt, CurrentMinutes = _trnLicense.TimeLmt, SurplusTimes = _trnLicense.TriesLmt }; _currentInfoControl.CallShowTrainerName(_trnLicense.Name); _currentInfoControl.CallShowTrainerPhoto(_trnLicense.Photo); _currentInfoControl.CallChangesShowInfo(_chargesDisplayInfo); IsChargingThread = true; Thread chargingThread = new Thread(ChargingThread); chargingThread.Start(); return(true); } else { IsChargingThread = false; IsCharging = false; _sw.WriteLine(DateTime.Now.ToLocalTime() + ":" + "许可信息无效,失效类型:" + _lincenseState); return(false); } }
/// <summary> /// Stops the train. /// </summary> /// <param name="isSave">if set to <c>true</c> [is save Train Info].</param> public void StopTrain(bool isSave) { if (!IsChargerControlHide) { IsRunning = false; IsChargingThread = false; IsCharging = false; HideChargeControl(); if (ResetUiViewDelegate != null) { ResetUiViewDelegate(); } if (isSave) { SqlLiteHelper.SaveTranineesInfo(_trnLicense); SqlLiteHelper.SaveChargesInfo(_chargesDisplayInfo); SqlLiteHelper.SaveTraningInfo(_trnLicense); writeToDisk(); } IsChargerControlHide = true; } }