public FaderDemo(IEnumerable<string> args)
{
lightGroup.Add(lightA, lightB);
acnOutput.Connect(new Physical.SmallRGBStrobe(lightA, 1), 20);
acnOutput.Connect(new Physical.SmallRGBStrobe(lightB, 2), 20);
// Set color
testButton.Output.Subscribe(button =>
{
if (button)
{
log.Info("Button press!");
// Test priority/control
//lightA.Brightness = 0.25;
//using (var control1 = lightA.TakeControl(1))
//{
// lightA.Brightness = 0.33;
// var observer1 = lightA.GetBrightnessObserver(control1);
// observer1.OnNext(1.0);
// using (var control2 = lightA.TakeControl(1))
// {
// var observer2 = lightA.GetBrightnessObserver(control2);
// observer1.OnNext(0.5);
// observer2.OnNext(0.75);
// }
//}
lightA.Brightness = 0.2;
var control1 = lightA.TakeControl(1);
lightA.Brightness = 0.33;
var observer1 = lightA.GetBrightnessObserver();
// Should skip
observer1.OnNext(1.0);
var faderTask = Exec.MasterEffect.Fade(observer1, 0.0, 1.0, 5000);
Exec.Sleep(S(3));
Exec.MasterEffect.Fade(Exec.Blackout, 0.0, 1.0, 1000)
.ContinueWith(b =>
{
Task.Delay(2000).ContinueWith(c =>
{
Exec.Blackout.OnNext(0);
});
});
faderTask.ContinueWith(x =>
{
control1.Dispose();
Exec.MasterEffect.Fade(observer1, 1.0, 0.0, 5000);
});
//lightB.Brightness = 1.0;
//Exec.MasterShimmer.Shimmer(lightA, 0, 1.0, 1500);
//Task.Delay(500).ContinueWith(y =>
// {
// Exec.MasterFader.Fade(lightB, 1.0, 0.0, 1000);
// });
}
});
}