private void DrawPlayingSettings(IRemoteRenderingService service)
        {
            if (!Application.isPlaying)
            {
                return;
            }

            BaseRemoteRenderingServiceProfile loadedProfile = service.LoadedProfile;

            if (sessionOverrideLabel == null)
            {
                sessionOverrideLabel = new GUIContent(
                    "Session Id",
                    "A session guid to connect to. If specified, the app will attempt to connect to this session. If a override guid is suppied, the corresponding domain must also be set.");
            }

            if (preferredDomainLabel == null)
            {
                preferredDomainLabel = new GUIContent(
                    "Preferred Domain",
                    "The preferred to domain to connect to; for example, westus2.mixedreality.azure.com.");
            }

            loadedProfile.PreferredDomain =
                EditorGUILayout.TextField(preferredDomainLabel, loadedProfile.PreferredDomain);

            loadedProfile.SessionOverride =
                EditorGUILayout.TextField(sessionOverrideLabel, loadedProfile.SessionOverride);
        }
        private static async Task <IRemoteRenderingMachine> GetOrCreateMachine(IRemoteRenderingService service)
        {
            IRemoteRenderingMachine           machine       = service.PrimaryMachine;
            BaseRemoteRenderingServiceProfile loadedProfile = service.LoadedProfile;

            if (loadedProfile != null &&
                !string.IsNullOrEmpty(loadedProfile.SessionOverride))
            {
                Guid sessionGuid = Guid.Empty;
                if (Guid.TryParse(loadedProfile.SessionOverride, out sessionGuid))
                {
                    if (machine == null || machine.Session.Id != loadedProfile.SessionOverride)
                    {
                        machine = await service.Open(loadedProfile.SessionOverride);
                    }
                }
            }
            else if (machine == null)
            {
                machine = await service.Create();
            }
            else if (loadedProfile.PreferredDomain != machine.Session.Domain)
            {
                machine = await service.Create();
            }

            return(machine);
        }
        private void DrawConnectionControls(BaseRemoteRenderingServiceProfile profile, IRemoteRenderingService service)
        {
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Connect"))
            {
                Connect(service);
            }

            if (GUILayout.Button("Disconnect"))
            {
                Disconnect(service);
            }

            GUILayout.EndHorizontal();
        }
        public override void DrawInspectorGUI(object target)
        {
            IRemoteRenderingService           service = target as IRemoteRenderingService;
            BaseRemoteRenderingServiceProfile profile = service.ConfigurationProfile as BaseRemoteRenderingServiceProfile;

            if (boldText == null)
            {
                boldText           = new GUIStyle(GUI.skin.label);
                boldText.fontStyle = FontStyle.Bold;
            }

            GUILayout.Space(10.0f);
            GUILayout.Label("Current Session Info", boldText);
            EditorGUI.indentLevel++;
            if (service?.PrimaryMachine == null)
            {
                DrawNoMachine();
            }
            else
            {
                DrawMachingInformation(service.PrimaryMachine);
            }
            EditorGUI.indentLevel--;

            if (service != null)
            {
                GUILayout.Space(10.0f);
                GUILayout.Label("Session Controls", boldText);
                DrawSessionControls(service);

                if (Application.isPlaying)
                {
                    GUILayout.Space(10.0f);
                    GUILayout.Label("Connection Controls", boldText);
                    DrawConnectionControls(profile, service);

                    GUILayout.Space(10.0f);
                    GUILayout.Label("Temporary Overrides", boldText);
                    DrawPlayingSettings(service);
                }
            }
        }