/// <summary>
        /// Returns an unconnected copy of the subscription with the same items.
        /// </summary>
        public virtual object Clone()
        {
            // do a memberwise clone.
            TsCDaSubscription clone = (TsCDaSubscription)MemberwiseClone();

            // place clone in disconnected state.
            clone.server_            = null;
            clone.Subscription       = null;
            clone.subscriptionState_ = (TsCDaSubscriptionState)subscriptionState_.Clone();

            // clear server handles.
            clone.subscriptionState_.ServerHandle = null;

            // always make cloned subscriptions inactive.
            clone.subscriptionState_.Active = false;

            // clone items.
            if (clone.daItems_ != null)
            {
                ArrayList items = new ArrayList();

                Array.ForEach(clone.daItems_, item => items.Add(item.Clone()));

                clone.daItems_ = (TsCDaItem[])items.ToArray(typeof(TsCDaItem));
            }

            // return clone.
            return(clone);
        }
Пример #2
0
        ///////////////////////////////////////////////////////////////////////
        #region Class properties serialization helpers

        /// <summary>Serializes a server into a stream.</summary>
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            info.AddValue(Names.FILTERS, _filters);

            TsCDaSubscription[] subscriptions = null;

            if (_subscriptions.Count > 0)
            {
                subscriptions = new TsCDaSubscription[_subscriptions.Count];

                for (int ii = 0; ii < subscriptions.Length; ii++)
                {
                    subscriptions[ii] = _subscriptions[ii];
                }
            }

            info.AddValue(Names.SUBSCRIPTIONS, subscriptions);
        }
Пример #3
0
        /// <summary>Serializes a server into a stream.</summary>
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            info.AddValue(Names.Filters, filters_);

            TsCDaSubscription[] subscriptions = null;

            if (subscriptions_.Count > 0)
            {
                subscriptions = new TsCDaSubscription[subscriptions_.Count];

                for (int ii = 0; ii < subscriptions.Length; ii++)
                {
                    subscriptions[ii] = subscriptions_[ii];
                }
            }

            info.AddValue(Names.Subscriptions, subscriptions);
        }
Пример #4
0
        ///////////////////////////////////////////////////////////////////////
        #region Private Methods

        /// <summary>
        /// Establishes a subscription based on the template provided.
        /// </summary>
        private TsCDaSubscription EstablishSubscription(TsCDaSubscription template)
        {
            // create subscription.
            TsCDaSubscription subscription = new TsCDaSubscription(this, ((ITsDaServer)_server).CreateSubscription(template.State));

            // set filters.
            subscription.SetResultFilters(template.Filters);

            // add items.
            try
            {
                subscription.AddItems(template.Items);
            }
            catch
            {
                subscription.Dispose();
                subscription = null;
            }

            // return new subscription.
            return(subscription);
        }
Пример #5
0
 /// <summary>
 /// Adds an subscription to the IList.
 /// </summary>
 /// <param name="value">The Object to add to the IList. </param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(TsCDaSubscription value)
 {
     return(Add((object)value));
 }
Пример #6
0
 /// <summary>
 /// Determines the index of a specific subscription in the IList.
 /// </summary>
 /// <param name="value">The Object to locate in the IList.</param>
 /// <returns>The index of value if found in the list; otherwise, -1.</returns>
 public int IndexOf(TsCDaSubscription value)
 {
     return(IndexOf((object)value));
 }
Пример #7
0
 /// <summary>
 /// Determines whether the IList contains a specific value.
 /// </summary>
 /// <param name="value">The Object to locate in the IList.</param>
 /// <returns>true if the Object is found in the IList; otherwise, false.</returns>
 public bool Contains(TsCDaSubscription value)
 {
     return(Contains((object)value));
 }
Пример #8
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the IList.
 /// </summary>
 /// <param name="value">The Object to remove from the IList.</param>
 public void Remove(TsCDaSubscription value)
 {
     Remove((object)value);
 }
Пример #9
0
 /// <summary>
 /// Inserts an subscription to the IList at the specified position.
 /// </summary>
 /// <param name="index">The zero-based index at which value should be inserted.</param>
 /// <param name="value">The Object to insert into the IList. </param>
 public void Insert(int index, TsCDaSubscription value)
 {
     Insert(index, (object)value);
 }