Exemple #1
0
    private async void UpdateIpd(float ipd)
    {
        // Update only allowed if signed in
        if (state == FBControllerState.LoggedIn)
        {
            try
            {
                // Set IPD
                await portal.SetInterPupilaryDistance(ipd);

                // Reread values
                ReadValues();

                // Define message to speak
                var speakText = string.Format("IPD set to {0}", ipd);

                // Speak the message
                textToSpeech.SpeakText(speakText);
            }
            catch (Exception ex)
            {
                // Show error on Unity thread
                ShowError(ex.Message);
            }
        }
    }
Exemple #2
0
        public async Task <bool> SubmitIPD(float ipd)
        {
            if (Portal == null)
            {
                return(false);
            }
            IsSaving = true;
            try
            {
                await Portal.SetInterPupilaryDistance(ipd);

                Logger.Log("IPD Set to: " + ipd.ToString("0.0"));
            }
            catch (Exception ex)
            {
                IsSaving = false;
                Logger.Log("Failed to set IPD.\n" + (ex.GetType().ToString() + " - " + ex.Message));
                return(false);
            }
            IsSaving = false;
            return(true);
        }