/// <summary>
 /// Edits items in the subscription.
 /// </summary>
 internal void EditSubscriptions()
 {
     using (SubscriptionListEditDlg dial = new SubscriptionListEditDlg())
     {
         OpcDa.SubscriptionState ss = dial.ShowDialog(Parent.SuportedLocales, Parent.Locale, State);
         if (dial.DialogResult != DialogResult.OK || ss == null)
         {
             return;
         }
         Text  = ss.Name;
         State = ss;
     }
     try
     {
         if (Tag != null)
         {
             Tag.ModifyState((int)OpcDa::StateMask.All, h_State);
             Subscription.RaiseSubscriptionModified(Tag, !h_State.Active);
         }
         State = h_State;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Edit Subscriptions", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     AssignImageIndex();
 }
 private void NormalizeSubscriptionName(global::Opc.Da.SubscriptionState subscription)
 {
     if (String.IsNullOrEmpty(subscription.Name))
     {
         subscription.Name = "OffLineSubscription" + (m_SumscriptionNum++).ToString();
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SubscriptionTreeNode"/> class.
 /// </summary>
 /// <param name="subscription">The subscription <see cref="OPCCliConfiguration.SubscriptionsRow"/>.</param>
 /// <param name="parent">The parent tree node  <see cref="OPCSessionServer"/>.</param>
 internal SubscriptionTreeNodeSession(OPCCliConfiguration.SubscriptionsRow subscription, OPCSessionServer parent) :
     base("", null, parent)
 {
     Text    = subscription.Name;
     m_Menu  = new ContextMenuSubscription(this);
     Enabled = subscription.Enabled;
     State   = subscription.CreateSubscriptionState;
     foreach (var item in subscription.GetItemsRows())
     {
         new TagTreeNode(item, this);
     }
     AssignImageIndex();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SubscriptionTreeNode"/> class.
 /// </summary>
 /// <param name="subscription">The subscription <see cref="OpcDa::SubscriptionState"/>.</param>
 /// <param name="items">The items <see cref="OpcDa::Item"/>.</param>
 /// <param name="parent">The parent <see cref="OPCSessionServer"/>.</param>
 internal SubscriptionTreeNodeSession(OpcDa::SubscriptionState subscription, OpcDa::Item[] items, OPCSessionServer parent)
     : base("", null, parent)
 {
     NormalizeSubscriptionName(subscription);
     Text   = subscription.Name;
     m_Menu = new ContextMenuSubscription(this);
     State  = subscription;
     Clear();
     foreach (OpcDa::Item item in items)
     {
         new TagTreeNode(item, this);
     }
     this.Expand();
     AssignImageIndex();
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OPCClientGroup"/> class.
 /// </summary>
 /// <param name="group">The group description from XML configuration file<see cref="OPCCliConfiguration.SubscriptionsRow"/>.</param>
 /// <param name="items">The table of items <see cref="OPCCliConfiguration.ItemsRow"/>.</param>
 /// <param name="server">Server that this group should belong to</param>
 /// <param name="parent">The parent.</param>
 /// <param name="volumeConstrain">The volume constrain.</param>
 internal OPCClientGroup
   (
   OPCCliConfiguration.SubscriptionsRow group,
   OPCCliConfiguration.ItemsRow[] items,
   OPC_Interface server,
   OPCDataQueue parent,
   ref uint? volumeConstrain
   )
 {
   if ( volumeConstrain.HasValue )
     if ( volumeConstrain.Value < items.Length )
       throw new LicenseException( typeof( Main ), Main.MainComponent, CAS.Lib.CodeProtect.Properties.Resources.Tx_LicVolumeConstrainErr );
     else
       volumeConstrain = volumeConstrain.Value - Convert.ToUInt32( items.Length );
   OpcDa.SubscriptionState state = group.CreateSubscriptionState;
   m_OPCGroup = server.CreateOPCGroup( (uint)group.ID, (uint)group.ID_server, group.Asynchronous, state );
   m_OPCGroup.Tags = Tags( items, server, m_OPCGroup );
   m_AllGroups.Add( this );
 }