private ITsCapsSet GetServerCapSet(capabilitySetType_Values capsetType)
        {
            Collection <ITsCapsSet> capsets = this.rdpbcgrClient.Context.DemandActiveCapabilitySets;

            if (capsets != null)
            {
                foreach (ITsCapsSet capSet in capsets)
                {
                    if (capSet.GetCapabilityType() == capsetType)
                    {
                        return(capSet);
                    }
                }
            }
            return(null);
        }
        /// <summary>
        /// Delete capability set from a capset collection according to capset id
        /// </summary>
        /// <param name="capSetCollection">Cap set collection</param>
        /// <param name="capType">Cap type</param>
        private void DeleteCapset(Collection <ITsCapsSet> capSetCollection, capabilitySetType_Values capType)
        {
            if (capSetCollection == null || capSetCollection.Count == 0)
            {
                return;
            }
            int i = 0;

            for (i = 0; i < capSetCollection.Count; i++)
            {
                if (capSetCollection[i].GetCapabilityType() == capType)
                {
                    capSetCollection.RemoveAt(i);
                    return;
                }
            }
        }
 /// <summary>
 /// Delete capability set from a capset collection according to capset id
 /// </summary>
 /// <param name="capSetCollection">Cap set collection</param>
 /// <param name="capType">Cap type</param>
 private void DeleteCapset(Collection<ITsCapsSet> capSetCollection, capabilitySetType_Values capType)
 {
     if (capSetCollection == null || capSetCollection.Count == 0)
     {
         return;
     }
     int i = 0;
     for (i = 0; i < capSetCollection.Count; i++)
     {
         if (capSetCollection[i].GetCapabilityType() == capType)
         {
             capSetCollection.RemoveAt(i);
             return;
         }
     }
     
 }
        /// <summary>
        /// Search a cap set with type value.
        /// </summary>
        /// <param name="capType">Type of the cap set</param>
        /// <returns>The cap set with the specified type; if not find, return null;</returns>
        public ITsCapsSet FindCapSet(capabilitySetType_Values capType)
        {
            foreach (ITsCapsSet cap in m_arrCapSet)
            {
                if (cap.GetCapabilityType() == capType)
                    return cap;
            }

            return null;
        }