private async void NotificationsFromDb_OnClicked(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: Initiated");
            NotificationsController nc = new NotificationsController();
            List<Advert> notifications = nc.GetNotificationList();
            System.Diagnostics.Debug.WriteLine(
                "ViktorTestView - NotificationsFromDb_OnClicked: notifications.Count = " + notifications.Count);

            foreach (var n in notifications)
            {
                if (n is Job)
                {
                    // DO spesific Job code 
                    Job job = (Job) n;
                    //long date = job.expiryDate; // Will work
                    System.Diagnostics.Debug.WriteLine("job.title = " + job.title);
                    if (job.companies != null && job.companies[0].logo != null)
                    {
                        System.Diagnostics.Debug.WriteLine("job.companies.logo = " + job.companies[0].logo);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("job.companies = null");
                    }
                    System.Diagnostics.Debug.WriteLine("job.expiryDate = " + job.expiryDate);

                }
                else if (n is Project)
                {
                    // Do spesific Project  code.
                    Project project = (Project) n;
                    System.Diagnostics.Debug.WriteLine("project.title = " + project.title);
                    if (project.companies != null && project.companies[0].logo != null)
                    {
                        System.Diagnostics.Debug.WriteLine("project.companies.logo = " + project.companies[0].logo);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("project.companies = null");
                    }
                    System.Diagnostics.Debug.WriteLine("project.companies.logo = " + project.companies[0].logo);
                    System.Diagnostics.Debug.WriteLine("project.published = " + project.published);
                }
            }
        }
 private async void TestTurnOffJobNotification(object sender, EventArgs e)
 {
     NotificationsController nc = new NotificationsController();
     nc.UpdateStudentsNotificationsPref(true, true, false);
 }
        public void AddData()
        {
            //if (pullList == false)
            //{
            //}
            //else if (pullList == true)
            //{
            System.Diagnostics.Debug.WriteLine("ViktorTestView - NotificationsFromDb_OnClicked: Initiated");
            NotificationsController nc = new NotificationsController();
            List<Advert> notifications = nc.GetNotificationList();

            System.Diagnostics.Debug.WriteLine(
                "ViktorTestView - NotificationsFromDb_OnClicked: notifications.Count = " + notifications.Count);

            foreach (var n in notifications)
            {
                if (n is Job)
                {
                    Job job = (Job)n;

                    if (job.companies != null && job.companies[0].logo != null)
                    {
                        string logo = job.companies[0].logo;
                        string varselText = "Ny stilling fra " + job.companies[0].name + "!";
                        string published = "Publisert " + DateTimeHandler.MakeDateTimeString(job.published);
                        varsler.Add(new Varsel(varselText, job.title, published, job.published, logo, job.uuid, "job", job.webpage));
                        // DO spesific Job code
                        //long date = job.expiryDate; // Will work
                        System.Diagnostics.Debug.WriteLine("job.title = " + job.title);
                        System.Diagnostics.Debug.WriteLine("job.companies.logo = " + job.companies[0].logo);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("job.companies = null");
                    }
                    System.Diagnostics.Debug.WriteLine("job.expiryDate = " + job.expiryDate);

                }
                else if (n is Project)
                {
                    // Do spesific Project  code.
                    Project project = (Project)n;
                    if (project.companies != null && project.companies[0].logo != null)
                    {
                        string logo = project.companies[0].logo;
                        string varselText = "Ny oppgave fra " + project.companies[0].name + "!";
                        string published = "Publisert " + DateTimeHandler.MakeDateTimeString(project.published);
                        varsler.Add(new Varsel(varselText, project.title, published, project.published, logo, project.uuid, "project", project.webpage));

                        System.Diagnostics.Debug.WriteLine("project.title = " + project.title);
                        System.Diagnostics.Debug.WriteLine("project.companies.logo = " + project.companies[0].logo);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("project.companies = null");
                    }
                    System.Diagnostics.Debug.WriteLine("project.companies.logo = " + project.companies[0].logo);
                    System.Diagnostics.Debug.WriteLine("project.published = " + project.published);
                }
                if (!Authenticater.Authorized)
                {
                    GoToLogin();
                }


            }
        }
 void SaveToggle()
 {
     NotificationsController nc = new NotificationsController();
     bool allNotifications = varselSwitch.IsToggled;
     bool jobNotifications = stillingSwitch.IsToggled;
     bool projectNotification = oppgaveSwitch.IsToggled;
     nc.UpdateStudentsNotificationsPref(allNotifications, projectNotification, jobNotifications);
 }