Ejemplo n.º 1
0
        private static async Task <IRemoteRenderingMachine> GetOrCreateMachine(IRemoteRenderingService service)
        {
            IRemoteRenderingMachine       machine       = service.PrimaryMachine;
            RemoteRenderingServiceProfile 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 static async void StartSession(IRemoteRenderingService service)
        {
            await ApplySettings(service);

            await service.StopAll();

            var machine = await service.Create();

            if (machine != null)
            {
                await machine.Session.Connection.Connect();
            }
        }