public ChildInformationpageViewModel(int offlineStudentId) { productResearchCodeValuesService = DependencyService.Get <IProductResearchCodeValuesService>(); productResearchCodesService = DependencyService.Get <IProductResearchCodesService>(); userPermissionService = DependencyService.Get <IUserPermissionService>(); studentTestFormsService = DependencyService.Get <IStudentTestFormsService>(); commonDataService = DependencyService.Get <ICommonDataService>(); locationService = DependencyService.Get <ILocationService>(); clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>(); OfflineStudentId = offlineStudentId; EditCommand = new Command(EditClicked); AddNewRecordCommand = new Command(AddNew); HyperLinkClickedCommand = new Xamarin.Forms.Command <ChildInformationRecord>(HyperlinkClicked); _studentService = DependencyService.Get <IStudentsService>(); _tokenService = DependencyService.Get <ITokenService>(); var tokenModel = _tokenService.GetTokenResposne(); if (tokenModel != null) { UserFullName = "" + tokenModel.FirstName + " " + "" + tokenModel.LastName + ""; } FailedString = "Failed: 0"; PendingString = "Pending: 0"; Task.Run(async() => { await LoadData(OfflineStudentId); }); LoadTestRecordsFromDB(OfflineStudentId); if (Connectivity.NetworkAccess != NetworkAccess.Internet) { foreach (var child in ChildInformationRecords) { child.EnableRow = false; } EnableSync = false; } else { if (ChildInformationRecords.Any(p => p.Status != "Not started") && ChildInformationRecords.Any(p => p.IsSelect)) { EnableSync = true; } } Connectivity.ConnectivityChanged -= Connectivity_ConnectivityChanged; Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged; commonDataService.ClearAddChildContent = ResetContent; }
public DashboardpageViewModel() { _locationService = DependencyService.Get <ILocationService>(); _tokenService = DependencyService.Get <ITokenService>(); _studentService = DependencyService.Get <IStudentsService>(); _productResearchCodesService = DependencyService.Get <IProductResearchCodesService>(); _productResearchCodeValuesService = DependencyService.Get <IProductResearchCodeValuesService>(); _productService = DependencyService.Get <IProductService>(); _assessmentService = DependencyService.Get <IAssessmentsService>(); _contentCategoryLevelsService = DependencyService.Get <IContentCategoryLevelsService>(); _contentCategoryService = DependencyService.Get <IContentCategoryService>(); _contentCategoryItemsService = DependencyService.Get <IContentCategoryItemsService>(); _programNoteService = DependencyService.Get <IProgramNoteService>(); _examinerService = DependencyService.Get <IExaminerService>(); _contentItemService = DependencyService.Get <IContentItemsService>(); _contentItemAttributeService = DependencyService.Get <IContentItemAttributesService>(); _contentRubricsService = DependencyService.Get <IContentRubricsService>(); _contentRubicPointsService = DependencyService.Get <IContentRubricPointsService>(); _contentItemTalliesService = DependencyService.Get <IContentItemTallyService>(); _contentItemTalliesScoresService = DependencyService.Get <IContentItemTalliesScoresService>(); _contentGroupService = DependencyService.Get <IContentGroupService>(); _contentGroupItemsService = DependencyService.Get <IContentGroupItemsService>(); _orgRecordFormService = DependencyService.Get <IOrgRecordFormService>(); _userPermissionService = DependencyService.Get <IUserPermissionService>(); var userID = Convert.ToInt32(Application.Current.Properties["UserID"]); var user = userService.GetUserByID(userID); if (user != null) { DeviceID = user.DeviceId; } CheckInternet(); if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet) { IsInternetAvailable = false; string userFirstName = "", userLastName = ""; if (Application.Current.Properties.ContainsKey("FirstName") && Application.Current.Properties["FirstName"] != null) { userFirstName = Application.Current.Properties["FirstName"].ToString(); } if (Application.Current.Properties.ContainsKey("LastName") && Application.Current.Properties["LastName"] != null) { userLastName = Application.Current.Properties["LastName"].ToString(); } UserFullName = "" + userFirstName + " " + "" + userLastName + ""; } else { IsInternetAvailable = true; _tokenService = DependencyService.Get <ITokenService>(); var tokenModel = _tokenService.GetTokenResposne(); if (tokenModel != null) { UserFullName = "" + tokenModel.FirstName + " " + "" + tokenModel.LastName + ""; } } FailedString = "Failed: 0"; PendingString = "Pending: 0"; NewAssessmentCommand = new Command(NewAssessment); ResumeAssessmentCommand = new Command(ResumeAssessment); BrowseUpdateRecordCommand = new Command(BrowseUpdate); AddNewRecordCommand = new Command(AddNew); ReportToFamilyCommand = new Command(Report); OpenFullReportCommand = new Command(OpenFullReport); ShowInfoCommand = new Command(openInfo); HomeCommand = new Command(async() => { var popUpNavigationInstance = PopupNavigation.Instance; await popUpNavigationInstance.PushAsync(new LogoutpopupView()); //await App.Current.MainPage.Navigation.PushModalAsync(new LogoutpopupView()); //if (!Application.Current.Properties.ContainsKey("RememberMe") || Application.Current.Properties["RememberMe"].ToString() == "False") //{ //Application.Current.Properties.Clear(); //} //App.LogoutAction?.Invoke(false); }); }