Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.
Users reporting for no reason may be locked out.
using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
namespace Scripts
{
public class WeatherConverter : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
if (value == null)
return null;
var values = (object[])value;
if (values?.Length != 2)
return null;
// Get the two binding values
// First binding should be: "livedatetime_object"
// Second binding should be: "sky"
var time = (DateTime) values[0];
var sky = (string) values[1];
// When is "night time"?
// Arbitrary choice here: between 20:00 and 07:00
if (time.Hour > 20 || time.Hour < 7)
{
// Append "night" to the sky name
sky = sky + " Night";
}
return sky;
}
}
}