using System; using System.Collections.Generic; using System.Text; using Eplan.EplApi.EServices; namespace EPLAN.API.Schulung_AddIn { public class Verification1 : Eplan.EplApi.EServices.FunctionVerification, Eplan.EplApi.EServices.IFunctionVerification, Eplan.EplApi.EServices.IVerification, Eplan.EplApi.EServices.IMessage { private int m_iMessageId = 500; public Verification1() { // // TODO: Add constructor logic here // } public override void AddCategoryFilter(ref Eplan.EplApi.DataModel.Function.Enums.Category eCategory) { } #region IVerification Members public override void Execute(Eplan.EplApi.DataModel.StorableObject oObject1) { if (oObject1 is Eplan.EplApi.DataModel.Function) { System.Collections.ArrayList colFunctions = new System.Collections.ArrayList(); Eplan.EplApi.DataModel.Function oFunction = oObject1 as Eplan.EplApi.DataModel.Function; { string sText_Prüf = ""; try { sText_Prüf = myGet_Prop_Value(oFunction.Properties[20031]); } catch { } //Adding the error message for function. if (sText_Prüf.Length > 15) { DoErrorMessage(oObject1, oFunction.Name); } } } } private string myGet_Prop_Value(Eplan.EplApi.DataModel.PropertyValue myProp) { try { // Fehlermeldungen vermeiden if (myProp.IsEmpty) return ""; Eplan.EplApi.Base.MultiLangString oMl = myProp; string sDE = oMl.GetString(Eplan.EplApi.Base.ISOCode.Language.L_de_DE); // falls nicht übersetzt if (sDE == "") sDE = oMl.GetString(Eplan.EplApi.Base.ISOCode.Language.L___); return sDE; } catch (System.Exception ex) { { System.Windows.Forms.MessageBox.Show(ex.ToString()); } return ""; } } public override void OnEndInspection() { // TODO: Add NewVerification.OnEndInspection implementation } public override void OnRegister(ref string strName, ref int iOrdinal) { strName = "Verification1"; iOrdinal = 30; } public override void OnStartInspection(bool bOnline) { // TODO: Add NewVerification.OnStartInspection implementation } #endregion #region IMessage Members public override string GetMessageText() { return "Funktion fehlerhaft."; } public override void DoHelp() { //System.Windows.Forms.MessageBox.Show("Fehlerhafte Funktion."); // TODO: Verification1.DoHelp implementation } public override void OnRegister(ref String strCreator, ref Eplan.EplApi.EServices.IMessage.Region eRegion, ref int iMessageId, ref Eplan.EplApi.EServices.IMessage.Classification eClassification, ref int iOrdinal) { strCreator = "API"; eRegion = IMessage.Region.Externals; iMessageId = m_iMessageId; eClassification = IMessage.Classification.Error; iOrdinal = 20; } #endregion } }