Jump to: navigation, search

Changes


Internal:STATUSCOLOR (MetaProperty)

1,856 bytes added, 11:04, 26 June 2015
Created page with "{{Internal/Coding/MetaProperties}} === Change the color of the status LED === {{Internal/CodeSnippetInfo|KNO|Change the color of the status LED}} <syntaxhighlight lang="cshar..."
{{Internal/Coding/MetaProperties}}
=== Change the color of the status LED ===
{{Internal/CodeSnippetInfo|KNO|Change the color of the status LED}}

<syntaxhighlight lang="csharp">
get
{
if (this.PP_ACTIVE)
return (-16724992);
else
return(-6710887);

//return default(System.Int32);
}
set
{
//this.TrySetPropertyValue<System.Int32>("STATUSCOLOR", value);
}
</syntaxhighlight>

=== Change the color of the status LED ===
{{Internal/CodeSnippetInfo|KNO|Change the color of the status LED}}

<syntaxhighlight lang="csharp">
//Definition for Property STATUSCOLOR, (Status LED) type: System.Int32
public virtual System.Int32 STATUSCOLOR
{
get
{
int mntcStatus = this.GetValue<int>("STATUS");
DateTime mntcDate = this.GetValue<DateTime>("DUEDATE");

int statusColor = -6710887; // default = grey

bool overDue = false;
if (mntcDate.Equals(DateTime.MinValue)) // 2013.07.09 (MHM) no date => deliver grey
{
return(-6710887); // planned = grey
}

DateTime dateNow = DateTime.Now.Date;
overDue = mntcDate.Date < dateNow.Date;

// Task done
if (mntcStatus == 30)
return(-16724992); // done = green

//if (procState == 1)
if (mntcStatus == 10)
{
// Task is under work

// and overdue
if (overDue)
return(-65536); // overdue = red

return(-256); // under work = yellow
}
if (mntcStatus == 0) // 2013.07.09 (MHM) planned == 0
{
// Task is planned

// and overdue
if (overDue)
return(-65536); // overdue = red

// and not taken yet
return(-6710887); // planned = grey
}

return statusColor;

//return default(System.Int32);
}
set
{
//this.TrySetPropertyValue<System.Int32>("STATUSCOLOR", value);
}
}
</syntaxhighlight>
10,686
edits