Ejemplo n.º 1
0
        protected override void BeginQuery()
        {
            // TODO: We should take a weak reference to the parent PropBag and use it
            // to detect when this data is coming from a new PropBag object.
            // Actually our LocalBinder should take care of this work -- let's test before
            // implementing checks here.

            try
            {
                // Data holds a reference the previously fetched data, if any.
                if (Data is INotifyItemEndEdit inieeCurrent)
                {
                    inieeCurrent.ItemEndEdit -= Iniee_ItemEndEdit;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine($"Could not remove ItemEndEdit handler. The exception description is {e.Message}.");
            }

            //if (TryGetDataFromProp(_storeAccessor, _propId, out object rawData))
            //{
            //    if (rawData is IList data)
            //    {
            //        if(data is INotifyItemEndEdit inieeNew)
            //        {
            //            inieeNew.ItemEndEdit += Iniee_ItemEndEdit;
            //        }
            //        // This raises our DataChanged event (courtsey of our base class.)
            //        OnQueryFinished(data);
            //    }
            //    else
            //    {
            //        OnQueryFinished(null);
            //    }
            //}
            //else
            //{
            //    // TODO: Fix this error message -- need a way to better identify the property and parent PropBag.
            //    throw new InvalidOperationException($"{nameof(PBCollectionDSP)} cannot access property with Id = {_propId}.");
            //}

            IList data = _propItemWatcherGen.GetValue() as IList;

            if (data is INotifyItemEndEdit inieeNew)
            {
                inieeNew.ItemEndEdit += Iniee_ItemEndEdit;
            }

            OnQueryFinished(data);
        }
Ejemplo n.º 2
0
        protected override void BeginQuery()
        {
            try
            {
                // Data holds a reference the previously fetched data, if any.
                if (Data is INotifyItemEndEdit inieeCurrent)
                {
                    inieeCurrent.ItemEndEdit -= Iniee_ItemEndEdit;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine($"Could not remove ItemEndEdit handler. The exception description is {e.Message}.");
            }

            IList data = _propItemWatcherGen.GetValue() as IList;

            if (data is INotifyItemEndEdit inieeNew)
            {
                inieeNew.ItemEndEdit += Iniee_ItemEndEdit;
            }

            OnQueryFinished(data);
        }