/// <summary>
        /// Activate this method when a login is successful to navigate to a MainPage and remove the
        /// Former pages for the Navigation.
        /// It will also update all the search filter for the app, and its crucial that they are in this
        /// method and not just the startup method.
        /// </summary>
        public static void SuccessfulLoginAction()
        {
            // NavPage.Navigation.PopModalAsync();
            DbLocation            dbLocation = new DbLocation();
            StudyGroupsController sgc        = new StudyGroupsController();
            LocationsController   lc         = new LocationsController();
            JobTypesController    jtc        = new JobTypesController();
            CoursesController     cc         = new CoursesController();

            NavPage.Navigation.InsertPageBefore(new MainPage(), NavPage.Navigation.NavigationStack.First());
            NavPage.Navigation.PopToRootAsync();

            if (dbLocation.GetAllLocations().Count != 0)
            {
                lc.CompareServerHash();
                sgc.CompareServerHash();
                jtc.CompareServerHash();
                cc.CompareServerHash();
            }
            else
            {
                cc.UpdateCoursesFromServer();
                jtc.UpdateJobTypesFromServer();
                sgc.UpdateStudyGroupsFromServer();
                lc.UpdateLocationsFromServer();
            }
        }
Example #2
0
        private async void TestGetServerHash(object sender, EventArgs e)
        {
            StudyGroupsController sgc = new StudyGroupsController();
            LocationsController   lc  = new LocationsController();
            JobTypesController    jtc = new JobTypesController();
            CoursesController     cc  = new CoursesController();

            // this won't work properly with the placeholder backend due to the collation used on that sql database.
            // but will work if xyzøæå gets sortered properly
            lc.CompareServerHash();
            sgc.CompareServerHash();
            jtc.CompareServerHash();
            cc.CompareServerHash();
        }
        private void UpdateAllFilters()
        {
            // This is to make sure that the app got the study groups that is used as search filters.
            DbLocation            dbLocation = new DbLocation();
            StudyGroupsController sgc        = new StudyGroupsController();
            LocationsController   lc         = new LocationsController();
            JobTypesController    jtc        = new JobTypesController();
            CoursesController     cc         = new CoursesController();

            if (dbLocation.GetAllLocations().Count != 0)
            {
                lc.CompareServerHash();
                sgc.CompareServerHash();
                jtc.CompareServerHash();
                cc.CompareServerHash();
            }
            else
            {
                cc.UpdateCoursesFromServer();
                jtc.UpdateJobTypesFromServer();
                sgc.UpdateStudyGroupsFromServer();
                lc.UpdateLocationsFromServer();
            }
        }