Exemple #1
0
        private async void loadPersonsAndCheckEnquiry()
        {
            Persons.Clear();
            ObservableCollection <Person> persons = await AzureDatabaseService.GetPersonList(PatientId);

            foreach (Person person in persons)
            {
                Persons.Add(person);
            }

            //Check the unfinished Stranger Warning Enquiry
            unfinishedWarningList = await AzureDatabaseService.GetUnfinishedWarningList(PatientId);

            if (unfinishedWarningList.Count > 0)
            {
                WarningImage.Visibility = Visibility.Visible;
            }
        }
Exemple #2
0
        private async void testInternetConnection()
        {
            //Test Internet Connection
            try
            {
                //showProgressDialog("Checking the Internet Connection...");
                //progressDialog.Title = "Processing: ";
                //progressDialog.PrimaryButtonText = "Ok";
                statusTextBlock.Text = "Checking the Internet Connection...";
                Persons.Clear();
                ObservableCollection <Person> persons = await AzureDatabaseService.GetPersonList(PatientId);

                foreach (Person person in persons)
                {
                    Persons.Add(person);
                }

                //Check the unfinished Stranger Warning Enquiry
                unfinishedWarningList = await AzureDatabaseService.GetUnfinishedWarningList(PatientId);

                if (unfinishedWarningList.Count > 0)
                {
                    WarningImage.Visibility = Visibility.Visible;
                }
            }
            catch (System.Net.Http.HttpRequestException)
            {
                internetConnection   = false;
                statusTextBlock.Text = " ";
                showProgressDialog("Internet Connection Error! Please check your Internet connection.");
                progressDialog.Title                  = "Internet Connection Error!";
                progressDialog.PrimaryButtonText      = "Ok, I know";
                progressDialog.IsPrimaryButtonEnabled = true;
                await progressDialog.ShowAsync();

                return;
                //Test Internet Connection Again
                //testInternetConnection();
            }

            //Set up the timer to check Stranger Warning Enquiry
            CheckEnquiryTimer = ThreadPoolTimer.CreatePeriodicTimer(async(source) =>
            {
                //t++; //for testing

                //Check the unfinished Stranger Warning Enquiry
                unfinishedWarningList = await AzureDatabaseService.GetUnfinishedWarningList(PatientId);

                // Update the UI thread by using the UI core dispatcher.
                await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    //testTextBlock.Text = t.ToString(); //for testing

                    if (unfinishedWarningList.Count > 0)
                    {
                        WarningImage.Visibility = Visibility.Visible;
                    }
                });
            }, checkEnquiryTimeSpan);

            internetConnection   = true;
            statusTextBlock.Text = "Internet Connection Success!";
            //progressDialog.Content = "Internet Connection Success!";
            //progressDialog.IsPrimaryButtonEnabled = true;


            return;
        }