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 Emmanuel S
on
I test but when I add IsVisible for the widget to check, the widget I want to show stay hide.

In the code below, if I remove the line:  if (widget0.IsVisible == true);
my widget is SHOW

With the control IsVisible I've got the error in Event Log : Scripts .... Object reference not set to an instance of an object

using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Entity;
using System.Collections.Generic;
using ATVO.ThemesSDK.Data.Results;

namespace Scripts
{
public class Sc_Pilot_Team : IScript

{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
if (value == null)
{
    return null;
}

IEntitySessionResult result = (IEntitySessionResult) value;

var entity = result.Entity;

var theme = item.Theme;
//find widget I want to show
var widget = theme.Widgets.Find("W_Pilote_Team");
//find widget to check VISIBLE for showing widget
var widget0 = theme.Widgets.Find("W_Pilote_Complet");

if (widget0.IsVisible == true);
{
if (entity is ITeam)
{widget.AnimateShow("0");
return null;}
else
widget.AnimateHide("0");
return null;
}
}}}