AVEVA OMI Software Developer Kit
Build Your Business Logic

Build the logic in your app to solve a business problem. As there are many ways to achieve a particular result, use the methods that you are most comfortable using.

Let's say you want to build an app that gets property-change notifications. Among the tasks that need to be done are:

  • Create a simple property to get change event notifications from the SDK.
  • Add a reference to the appropriate SDK namespace (for example, ArchestrA.Client.MyViewApp.Navigation).
  • Specify the property your are interested in (for example, ArchestrA.Client.MyViewApp.Navigation.CurrentAssetName).
  • Determine if the ViewApp is functioning in run time or is being configured. If it is being configured, we are not interested in receiving notification.
  • Establish a reference to the SDK to get change notification.
CurrentAsset Changed Notification
Copy Code
namespace MyOMIApp
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : UserControl, INotifyPropertyChanged
    {
        /// <summary>
        /// this is a constructor
        /// </summary>
        public UserControl1()
        {
            InitializeComponent();
         
            /// if this control is in design mode, don't do anything
            if(!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
          
            /// if not in design mode, subscribe
            ArchestrA.Client.MyViewApp.Navigation.PropertyChanged +- Navigation_PropertyChanged;
        }
        /// simple property - get asset change notification from SDK; need to get reference from SDK
        public string CurrentAssetName { get; set; }
        /// <summary>
        /// setting up business logic
        /// </summary>
      
        void Navigation_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (Incontext)
            {
                if (e.PropertyName == CurrentAsset)
                {
                    CurrentAssetName = ArchestrA.Client.MyViewApp.Navigation.CurrentAsset;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventsArgs("CurrentAssetName"));
                }
            }
        }
    /// Create a simple property to get notification from SDK
    /// use browsable(false) so this is not imported
    [Browsable(false)]
    public string CurrentAssetName { get; set; }
    public bool Incontext { get; set; }