private void OnExaminationDataLoaded(OnExaminationDataLoaded onExaminationDataLoaded) { DispatcherHelper.CheckBeginInvokeOnUI((Action)(() => { this.ExaminationTitleDaDk = onExaminationDataLoaded.TitleDaDk; this.ExaminationTitleEnGb = onExaminationDataLoaded.TitleEnGb; })); }
private void OnExaminationDataLoaded(OnExaminationDataLoaded onExaminationDataLoaded) { if (!this.HasVerifiedPinCode()) { Task.Factory.StartNew((Action)(() => { this.UpdateAssignmentFiles(); this._assignmentFilesRedownloadTimerService.Start(); })); } this.ExaminationTitleDaDk = onExaminationDataLoaded.TitleDaDk; this.ExaminationTitleEnGb = onExaminationDataLoaded.TitleEnGb; this.ExaminationStart = onExaminationDataLoaded.Start; DispatcherHelper.CheckBeginInvokeOnUI((Action)(() => this.MaxTimeUntilExamStart = (double)onExaminationDataLoaded.EarliestLoginTimeBeforeStartInMinutes)); }
private LoginState Login(string boardingPassLogin) { try { this._flexClient.SetBoardingPassPrefix(boardingPassLogin); this._flexClient.Authenticate(boardingPassLogin); this._boardingPassStorageService.Store(boardingPassLogin); ExaminationResponse examination = this._flexClient.GetExamination(); IMessenger messenger = this._messenger; string daDk = examination.Title.DaDK; string enGb = examination.Title.EnGB; DateTime dateTime = examination.Start; DateTime localTime1 = dateTime.ToLocalTime(); dateTime = examination.End; DateTime localTime2 = dateTime.ToLocalTime(); string username = examination.Username; int beforeStartInMinutes = examination.EarliestLoginTimeBeforeStartInMinutes; OnExaminationDataLoaded message = new OnExaminationDataLoaded(daDk, enGb, localTime1, localTime2, username, beforeStartInMinutes); messenger.Send <OnExaminationDataLoaded>(message); this._messenger.Send <OnHandInFieldsLoaded>(new OnHandInFieldsLoaded(examination.HandinFields.Select <HandinField, HandInFieldDescriptionModel>((Func <HandinField, HandInFieldDescriptionModel>)(h => new HandInFieldDescriptionModel() { ValueType = h.Type.ToHandInFieldValueType(), TextDaDk = h.Title.DaDK, Required = h.IsRequired, TextEnGb = h.Title.EnGB, Id = h.Id, DescriptionDaDk = h.Description.DaDK, DescriptionEnGb = h.Description.EnGB, RegexValidation = h.Regex })))); this._messenger.Send <OnExaminationUrlLoaded>(new OnExaminationUrlLoaded(examination.Url)); this._messenger.Send <OnAllowedFileExtensionsLoaded>(new OnAllowedFileExtensionsLoaded(examination.SubmitExtensions.Select <SubmitExtension, string>((Func <SubmitExtension, string>)(se => se.Extension)))); this._messenger.Send <OnHandInFilesizeLimitLoaded>(new OnHandInFilesizeLimitLoaded(examination.MaxHandInFileSizeInMegabytes)); this._heartbeatService.StartHeartbeats(); return(LoginState.Success); } catch (UnauthorizedBoardingPassException ex) { this._storageCleanerService.Clean(); return(LoginState.Unauthorized); } catch (Exception ex) { return(LoginState.Failed); } }
private void OnExaminationDataLoaded(OnExaminationDataLoaded onExaminationDataLoaded) { TimeSpan examinationDuration = onExaminationDataLoaded.End - onExaminationDataLoaded.Start; DispatcherHelper.CheckBeginInvokeOnUI((Action)(() => this.ExamLengthInMinutes = examinationDuration.TotalMinutes)); }