我正在編寫一個C#外接程序Enterprise Architect來驗證標記值,因爲當使用Type = Integer的標記值時,標記值空間中會顯示默認值0。 我給了Type = String的標籤值並驗證用戶輸入的值。我正在使用下面的代碼。通過Enterprise Architect中的C#加載項進行標記值驗證
public bool EA_OnNotifyContextItemModified(EA.Repository Repository, string GUID, EA.ObjectType ot)
{
string test_value;
bool isInteger;
int integer_converted;
if (ot == EA.ObjectType.otElement)
{
EA.Element element = (EA.Element)Repository.GetElementByGuid(GUID);
EA.TaggedValue tag = element.TaggedValues.GetByName("MAX-BASE-TYPE-SIZE");
test_value = tag.Value;
if (string.IsNullOrEmpty(test_value))
{
Session.Repository.WriteOutput("EA", "Enter any Value", 1);
}
else
{
isInteger = int.TryParse(test_value, out integer_converted);
if (isInteger == false)
{
string empty = " ";
tag.Value = empty;
tag.Update();
Session.Repository.WriteOutput("EA", "Enter Integer Value" + " " + tag.Name + ":" + "", 1);
}
}
}
}
}
return true;
}
的問題是,當我關閉元素屬性窗口,然後重新打開該元素替換與空字符串無效的標記值纔會發生。
當我將光標移動到元素本身的下一個標記值時,如何查看使用空字符串更新的標記值,而不是每次關閉和重新打開元素。
請幫助。提前致謝。
如果您正在構建一個插件,爲什麼堅持EA屬性窗口..?構建一個簡單的自己的表單,用於將標記值添加到元素,以便您可以輕鬆驗證..! – Arshad
我需要爲這個元素標記type = RefGUID,RefGUIDList的值,這就是爲什麼我要驗證值 – rashmi
即使在您的自定義窗口na中也可以獲取所有值。 – Arshad