How to do a AND
Posted: Mon Dec 10, 2012 10:38 am
I have to enable a light when two controller tags are active so I was wondering if there is any way to do a AND without having to use a script?
Code: Select all
if((Globals.Tags.MyTag1.Value == 1) && (Globals.Tags.MyTag2.Value == 1)){
//Do Something here
}
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
}
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if(Tag1.Value == true && Tag2.Value == true)
{
Tag3.Value = true;
}
else
{
Tag3.Value = false;
}
}
Code: Select all
void Tag2_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if(Tag1.Value == true && Tag2.Value == true)
{
Tag3.Value = true;
}
else
{
Tag3.Value = false;
}
}
Code: Select all
void DetermineStatusForTag3()
{
if(Tag1.Value == true && Tag2.Value == true)
{
Tag3.Value = true;
}
else
{
Tag3.Value = false;
}
}
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
DetermineStatusForTag3();
}
void Tag2_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
DetermineStatusForTag3();
}
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
DetermineStatusForTag3();
}
void Tag2_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
DetermineStatusForTag3();
}
void DetermineStatusForTag3()
{
if(Tag1.Value == true && Tag2.Value == true)
{
Tag3.Value = true;
}
else
{
Tag3.Value = false;
}
}