Report post

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.


Post

Posted by Josh L
on
So I want a script to read from a CarNum folder in my theme. It's a script to hide the carnum data binding if a dynamic image is found. I cannot for the life of me figure out how to get it to read that the path exists.

Here's the code:
using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Results;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;

namespace Scripts
{
public class CarNumScript : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
if (value == null)
return null;
// Get the label running this converter script
// This label is showing the dynamic image
var label = item as Label;
if (label == null)
return null;

string path = @"assets/CarNum" + value + ".png";

if (System.IO.File.Exists(path))
{
// Send transparent as output
return Colors.Transparent;
}

else
{
if (parameter == "font")
return Colors.White;
return Colors.Black;
}
}
}
}


Any help is appreciated!