Exemplo n.º 1
0
        private static async Task LightIntensityChange(QLabOSCClient client)
        {
            var workspaces = await client.GetWorkSpaces();

            var workspace = workspaces.data[0];
            var response  = await client.ConnectToWorkSpace(workspace.uniqueID);

            Console.WriteLine("Connected to workspace");
            //Create lighting cue first
            var cueResponse = await client.CreateWorkSpaceCue(workspace.uniqueID, CueType.Light);

            var y = await client.SetCueDuration(workspace.uniqueID, cueResponse.data, .25f);

            Console.WriteLine("Set cue lighting settings");

            Console.WriteLine("Press enter to toggle on and off lights!");
            string endCommand = Console.ReadLine();
            bool   lightOn    = false;

            while (endCommand != "end")
            {
                string command = lightOn ? "all.intensity = 100" : "all.intensity = 0";
                var    x       = await client.SetCueLightCommand(workspace.uniqueID, cueResponse.data, command);

                await client.StartCue(workspace.uniqueID, cueResponse.data);

                lightOn    = !lightOn;
                endCommand = Console.ReadLine();
            }
            Console.ReadKey();
        }