Exemplo n.º 1
0
        /// <summary>
        /// Fetch all the attributes and subscribe according to the filter
        /// </summary>
        public void SubscribeAttributes()
        {
            //just in case we are resubscribing, clear everything
            _d.Invoke(() => FilteredAttributes.Clear());
            Attributes.Clear();
            DataReferenceSource r = new DataReferenceSource(
                Name + "._Attributes[]",
                Name,
                (i) =>
            {
                //we need to start this on a new thread otherwise we can't make other calls to the RuntimeDataClient
                string[] attributes = (string[])i.VTQ.Value.Array;
                if (attributes == null)
                {
                    return;
                }
                new Thread(() =>
                {
                    Thread.CurrentThread.IsBackground = true;
                    DealWithNewAttributes(attributes.ToList <string>());
                }).Start();
            }
                );

            //just in case
            if (DataSubscription != null)
            {
                DataSubscription.Subscribe(new DataReferenceSource[] { r });
            }
        }
Exemplo n.º 2
0
        //enum filter

        public void GetAttributes()
        {
            DataItem d = new DataItem()
            {
                ReferenceString = "_Attributes[]",
                OwningObject    = Name
            };
            DataReferenceSource r = new DataReferenceSource(
                "_Attributes[]",
                Name,
                (i) =>
            {
                string[] attributes = (string[])i.VTQ.Value.Array;
                DealWithNewAttributes(attributes.ToList <string>());
            }
                );
        }