.NET Customisation
User Guide
.NET Customisation
:
How to Write a CAF Addin
: Addins In TTY
Addins In TTY
TTY addins that implement the IAddinTty interface can also be defined in the <module>Addins.xml and will be loaded when the application starts. In graphics only those addins which implement the IAddin interface will be loaded and started as before. Addins can implement both interfaces but may need refactoring so that no UI elements are started in TTY mode. UDAs implemented as pseudo attributes can now be implemented in this way; see example implementation of IAddinTty interface below.
using
System;
using
System.IO;
using
System.Windows.Forms;
using
Aveva.ApplicationFramework;
using
Aveva.ApplicationFramework.Presentation;
using
Aveva.Core.Database;
using
Ps = Aveva.Core.Database.DbPseudoAttribute;
using
NOUN = Aveva.Core.Database.DbElementTypeInstance;
namespace
Aveva.Core.Tests.AddinTty
/// <summary>
///
Summary description for AddinTtyTest
/// </summary>
public class
AddinTty
: IAddinTty, IAddin
{
/// <summary>
///
Start the Addin
/// </summary>
/// <param name="serviceManager"></param>
void
IAddinTty.Start(ServiceManager serviceManager)
{
// get uda attribute
DbAttribute uda = DbAttribute.GetDbAttribute(
":UDADDIN"
);
if
(uda !=
null
)
{
// Create instance of delegate containing method to evaluate
// pseudo attribute
P
s.GetStringDelegate dele =
new
Ps.GetStringDelegate(AddinTtyValue);
// and pass delegate instance to core.
P
s.AddGetStringAttribute(uda, NOUN.EQUIPMENT, dele);
}
}
void
IAddinTty.Stop()
{
}
String
IAddinTty.Name
{
get
{
return
"AddinTty"
; }
}
String
IAddinTty.Description
{
get
{
return
"AddinTty"
; }
}
// String delegate for UDA
static private string
AddinTtyValue(DbElement ele, DbAttribute att, DbQualifier qualifier)
{
return
"AddinTty"
;
}
}
}
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.