コード例 #1
0
        /// <summary>
        /// Called when the close button is clicked.
        /// </summary>
        private void DoneBTN_Click(object sender, System.EventArgs e)
        {
            try
            {
                mAreas_   = areaSourcesListCtrl_.GetAreas();
                mSources_ = areaSourcesListCtrl_.GetSources();

                // don't activate until all the filters are applied.
                bool active = mState_.Active;
                bool update = mSubscription_ != null;

                // create new subscription.
                if (mSubscription_ == null)
                {
                    mState_.Active       = false;
                    mState_.ClientHandle = Guid.NewGuid().ToString();
                    mSubscription_       = (TsCAeSubscription)mServer_.CreateSubscription(mState_);
                }

                // update existing subscription.
                else
                {
                    mSubscription_.ModifyState(((int)TsCAeStateMask.All & ~(int)TsCAeStateMask.Active), mState_);
                }

                // select filters.
                mFilters_.Areas.Clear();
                mFilters_.Areas.AddRange(mAreas_);
                mFilters_.Sources.Clear();
                mFilters_.Sources.AddRange(mSources_);

                mSubscription_.SetFilters(mFilters_);

                // select attributes.
                IDictionaryEnumerator enumerator = mAttributes_.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    int categoryId = (int)enumerator.Key;
                    Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeCollection attributeIDs = (Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeCollection)enumerator.Value;

                    mSubscription_.SelectReturnedAttributes(categoryId, attributeIDs.ToArray());
                }

                // activate the subscription.
                if (active || update)
                {
                    mState_.Active = active;
                    mSubscription_.ModifyState((int)TsCAeStateMask.Active, mState_);
                }

                // close the dialog.
                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        ///////////////////////////////////////////////////////////////////////
        #region Public Methods

        /// <summary>
        /// Gets or sets the atrtibute collection for the specified category.
        /// </summary>
        public TsCAeAttributeCollection this[int categoryID]
        {
            get { return((TsCAeAttributeCollection) base[categoryID]); }

            set
            {
                if (value != null)
                {
                    base[categoryID] = value;
                }
                else
                {
                    base[categoryID] = new TsCAeAttributeCollection();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Adds selected attributes to the dictionary.
        /// </summary>
        private void GetSelectedAttributes(TreeNode parent, Technosoftware.DaAeHdaClient.Ae.TsCAeCategory category, Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes)
        {
            foreach (TreeNode child in parent.Nodes)
            {
                if (!typeof(Technosoftware.DaAeHdaClient.Ae.TsCAeAttribute).IsInstanceOfType(child.Tag))
                {
                    continue;
                }

                if (child.Checked)
                {
                    Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeCollection collection = attributes[category.ID];

                    if (collection == null)
                    {
                        attributes.Add(category.ID, null);
                        collection = attributes[category.ID];
                    }

                    collection.Add(((Technosoftware.DaAeHdaClient.Ae.TsCAeAttribute)child.Tag).ID);
                }
            }
        }