Beispiel #1
0
        static async Task <T> ResolveApi <T>(int requestCode, Func <Task <T> > apiCall)
        {
            LogEx.StartMethod();
            try
            {
                return(await apiCall());
            }
            catch (ApiException apiEx)
            {
                if (apiEx.StatusCode == CommonStatusCodes.ResolutionRequired)                 // Resolution required
                {
                    tcsResolveConnection = new TaskCompletionSource <object>();

                    // Start the resolution
                    apiEx.Status.StartResolutionForResult(Essentials.Platform.CurrentActivity, requestCode);

                    // Wait for the activity result to be called
                    await tcsResolveConnection.Task;

                    // Try the original api call again
                    return(await apiCall());
                }
            }

            return(default);
Beispiel #2
0
        // static IExposureNotificationClient instance;
        //		static IExposureNotificationClient Instance
        //			=> instance ??= Nearby.GetExposureNotificationClient(Application.Context);

        static async Task <ExposureConfiguration> GetConfigurationAsync()
        {
            LogEx.StartMethod();
            var c = await Handler.GetConfigurationAsync();

            LogEx.EndMethod();


            return(new ExposureConfiguration.ExposureConfigurationBuilder()
                   .SetAttenuationScores(c.AttenuationScores)
                   .SetDurationScores(c.DurationScores)
                   .SetDaysSinceLastExposureScores(c.DaysSinceLastExposureScores)
                   .SetTransmissionRiskScores(c.TransmissionRiskScores)
                   .SetAttenuationWeight(c.AttenuationWeight)
                   .SetDaysSinceLastExposureWeight(c.DaysSinceLastExposureWeight)
                   .SetDurationWeight(c.DurationWeight)
                   .SetTransmissionRiskWeight(c.TransmissionWeight)
                   .SetMinimumRiskScore(c.MinimumRiskScore)
                   .SetDurationAtAttenuationThresholds(c.DurationAtAttenuationThresholds)
                   .Build());
        }