2
« on: July 14, 2016, 09:02:08 pm »
Hey guys,
Extremely long delay on this. Ok so I have 3 of the following functions within my c# add-in along with a EA_Connect() and EA_Disconnect() functions:
public string Shapescript_EndOfSupportDate(EA.Repository repository, string eaGuid, object theParams)
{
string return_value = "";
EA.Element element = repository.GetElementByGuid(eaGuid);
EA.TaggedValue EndOfSupportDate = (EA.TaggedValue)element.TaggedValues.GetByName("EndOfSupportDate");
if (EndOfSupportDate != null)
{
try
{
DateTime dt = DateTime.Parse(EndOfSupportDate.Value);
DateTime today = DateTime.Today;
if (dt.CompareTo(today.AddYears(1)) <= 0)
return_value = "red";
else if (dt.CompareTo(today.AddYears(2)) <= 0)
return_value = "amber";
else
return_value = "green";
}
catch (Exception e)
{
return_value = "exception";
}
}
return return_value;
}
As I mentioned, we have 3 of these (including the one above). The issue we have is apparent, the addin (or internal shapescript code) continues to fill the colour in on the shapes to the point it makes the diagrams unusable.
I cant see it being the Shapescript code having the issue, but the below is a snippet of the code to call the add in
decoration endofSupport
{
orientation="N";
if(hasProperty("Type","Class")){
if (HasProperty("#ADDIN:RAG_Stereotypes, Shapescript_EndOfSupportDate#", "red"))
{
setpencolor (0,0,0); //the border colour
SetFillColor(225,0,0);
}
else if (HasProperty("#ADDIN:RAG_Stereotypes, Shapescript_EndOfSupportDate#", "green"))
{
setpencolor (0,0,0); //the border colour
SetFillColor(0,255,0);
}
else if (HasProperty("#ADDIN:RAG_Stereotypes, Shapescript_EndOfSupportDate#", "amber"))
{
setpencolor (0,0,0); //the border colour
SetFillColor(255,215,0);
}
else
{
setpencolor (0,0,0); //the border colour
SetFillColor(0,0,255);
}
rectangle(65,45,130,125); //left, top, right,bottom
}
else{
}
}