Exemple #1
0
        protected override async void OnStart()
        {
            base.OnStart();

            buttonProvideDiagnosisKeys.Enabled   = false;
            buttonProvideDiagnosisKeysV1.Enabled = false;

            _diagnosisKeyServerConfiguration = await LoadDiagnosisKeyServerConfiguration();

            serverInfo.Text = $"Endpoint: {_diagnosisKeyServerConfiguration.ApiEndpoint}\n";
            serverInfo.Append($"Cluster ID: {_diagnosisKeyServerConfiguration.ClusterId}");

            _diagnosisKeyServer = new DiagnosisKeyServer(_diagnosisKeyServerConfiguration);

            await InitializeExposureNotificationApiStatus();

            buttonProvideDiagnosisKeys.Enabled   = true;
            buttonProvideDiagnosisKeysV1.Enabled = true;
        }
Exemple #2
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            Logger.D("ViewDidLoad");

            PrepareDirs();

            IList <ExposureNotificationStatus> statuses = await ExposureNotificationClientManager.Shared.GetStatusesAsync();

            long version = await ExposureNotificationClientManager.Shared.GetVersionAsync();

            ShowStatus(statuses, version);

            buttonEnableEn.TouchUpInside += async(sender, e) =>
            {
                status.Text = "Enable Exposure Notification is clicked.\n";

                try
                {
                    await ExposureNotificationClientManager.Shared.StartAsync();

                    IList <ExposureNotificationStatus> statuses = await ExposureNotificationClientManager.Shared.GetStatusesAsync();

                    long version = await ExposureNotificationClientManager.Shared.GetVersionAsync();

                    ShowStatus(statuses, version);
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonShowTeksHistory.TouchUpInside += async(sender, e) =>
            {
                status.Text = "Show TEKs History is clicked.\n";
                try
                {
                    List <TemporaryExposureKey> teks = await ExposureNotificationClientManager.Shared.GetTemporaryExposureKeyHistoryAsync();

                    ShowTeks(teks);
                    await SaveTeksAsync(teks);
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonDetectExposure.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await DetectExposure();
                }
                catch (TaskCanceledException exception)
                {
                    Logger.E(exception);
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonRequestPreauthorizedKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await RequestPreauthorizedKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonRequestReleaseKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await RequestReleaseKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonUploadDiagnosisKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await UploadDiagnosisKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonDownloadDiagnosisKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await DownloadDiagnosisKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };

            _diagnosisKeyServerConfiguration = await LoadDiagnosisKeyServerConfiguration();

            _diagnosisKeyServer = new DiagnosisKeyServer(_diagnosisKeyServerConfiguration);
            ShowServerConfiguration(_diagnosisKeyServerConfiguration);
        }