protected override void OnResume()
        {
            base.OnResume();

            ThreadStart myThreadDelegate = new ThreadStart(zoekNieuweKlanten);

            myThread = new Thread(myThreadDelegate);

            ThreadStart notificationThreadDelegate = new ThreadStart(notificationThreadFunctie);

            notificationThread = new Thread(notificationThreadDelegate);

            dataService = new KlantDataService();

            getKlanten();
            if (klanten != null)
            {
                makeMarkers();
                makeMap();
                myThread.Start();
                threadRunning = true;
                notificationThread.Start();
            }
            else
            {
                Toast.MakeText(this, "geen klanten geselecteerd", ToastLength.Long).Show();
                var intent = new Intent(this, typeof(MainMenuActivity));
                StartActivity(intent);
            }
        }
        protected override void OnResume()
        {
            base.OnResume();
            SetContentView(Resource.Layout.AccepteerLayout);
            dataService      = new KlantDataService();
            routeDataService = new RoutesDataService();

            FindViews();
            VulLijst();
            HandleEvents();
        }
Exemple #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LijstView);
            klantenLijst = FindViewById <ListView>(Resource.Id.klantenListView);
            KlantDataService dataService = new KlantDataService();

            klanten = dataService.GeefAlleKlanten();
            klantenLijst.Adapter           = new KlantenLijstAdapter(this, klanten);
            klantenLijst.FastScrollEnabled = true;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.KaartView);

            dataService = new KlantDataService();
            klanten     = dataService.GeefAlleKlanten();

            activeKlant = klanten;
            //mapButton = FindViewById<Button>(Resource.Id.viewOnMapButton);
            mapButton        = FindViewById <Button>(Resource.Id.viewOnMapButton);
            mapButton.Click += MapButton_Click;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.KlantDetailActivity);

            dataService      = new KlantDataService();
            routeDataService = new RoutesDataService();

            geaccepteerdeKlanten = new List <Klant>();
            klant = new List <Klant>();

            email = Intent.GetStringExtra("email");
            //klantId = Convert.ToInt32(k);

            GetKlant();
            FindViews();
            FillViews();
            // Create your application here
        }
        public void notificationThread()
        {
            int aantalNieuweKlanten      = 0;
            int vorigAantalNieuweKlanten = 0;

            List <Klant>     serverKlanten     = new List <Klant>();
            List <Klant>     geweigerdeKlanten = new List <Klant>();
            KlantDataService dataService       = new KlantDataService();

            //while (threadRunning == true) //zorg voor een eeuwige lus
            while (true) //zorg voor een eeuwige lus
            {
                if (threadRunning == true)
                {
                    serverKlanten     = dataService.GeefAlleKlantenFromServer();
                    geweigerdeKlanten = dataService.getGewijgerdeKlanten();

                    aantalNieuweKlanten = serverKlanten.Count;                  //maximum aantal nieuwe klanten (gelijk aan server klanten)
                    if (geweigerdeKlanten[0].Username != "XXXXGEENKLANTENXXXX") //wanneer er nog geen gewijgerde klanten zijn
                    {
                        for (int i = 0; i < serverKlanten.Count; i++)
                        {
                            for (int j = 0; j < geweigerdeKlanten.Count; j++)
                            {
                                if (serverKlanten == geweigerdeKlanten) //als bepaalde klant op de server == aan de reeds geweigerde klant
                                {
                                    aantalNieuweKlanten--;              //wordt maximum aantal klanten verminderd met 1
                                }
                            }
                        }
                    }

                    if (aantalNieuweKlanten != 0 && aantalNieuweKlanten != vorigAantalNieuweKlanten)
                    {
                        vorigAantalNieuweKlanten++;
                        //voor het maken van de klik event
                        // When the user clicks the notification, SecondActivity will start up.
                        Intent resultIntent = new Intent(this, typeof(AccepteerActivity));
                        // Construct a back stack for cross-task navigation:
                        TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this);
                        stackBuilder.AddParentStack(Java.Lang.Class.FromType(typeof(AccepteerActivity)));
                        stackBuilder.AddNextIntent(resultIntent);
                        // Create the PendingIntent with the back stack:
                        PendingIntent resultPendingIntent =
                            stackBuilder.GetPendingIntent(0, PendingIntentFlags.UpdateCurrent);

                        Android.Net.Uri alarmSound = RingtoneManager.GetDefaultUri(RingtoneType.Notification);

                        Notification.Builder builder = new Notification.Builder(this)
                                                       .SetContentTitle("Nieuwe klanten")
                                                       .SetContentText("Er zijn " + aantalNieuweKlanten + " nieuwe klanten")
                                                       .SetAutoCancel(true)                   // Dismiss from the notif. area when clicked
                                                       .SetContentIntent(resultPendingIntent) // Start 2nd activity when the intent is clicked.
                                                       .SetSmallIcon(Android.Resource.Drawable.IcDialogAlert)
                                                       .SetSound(alarmSound)
                                                       .SetVibrate(new long[] { 500, 500, 500, 500, 500 })
                                                       .SetPriority(10);

                        // Build the notification:
                        Notification nieuweKlantNotification = builder.Build();



                        // Get the notification manager:
                        NotificationManager notificationManager =
                            GetSystemService(Context.NotificationService) as NotificationManager;

                        // Publish the notification:
                        const int notificationId = 0;
                        notificationManager.Notify(notificationId, nieuweKlantNotification);
                    }
                    Thread.Sleep(7000);
                }
            }
        }