Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Everything E3D

Addins In TTY

  • Last UpdatedJan 25, 2024
  • 1 minute read

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

                Ps.GetStringDelegate dele =

new Ps.GetStringDelegate(AddinTtyValue);

                // and pass delegate instance to core.

                Ps.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";

        }

    }

}