+ void add_task(binding<bool> when, std::function<void ()> task)
+ {
+ auto subscription = when.on_change([=]
+ {
+ if (when.get())
+ {
+ try
+ {
+ task();
+ }
+ catch (...)
+ {
+ CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug);
+ CASPAR_LOG(error) << print() << " Error when invoking scene task. Turn on log level debug for stacktrace.";
+ }
+ }
+ });
+
+ task_subscriptions_.push_back(std::move(subscription));
+ }
+