Exemple #1
0
        void CompleteGetValue(AsyncGetValueRequest request)
        {
            AsyncGetValueRequest pendingGetValueRequest = (AsyncGetValueRequest)GetValue(Feature.PendingGetValueRequest, null);

            if (pendingGetValueRequest == request)
            {
                ClearValue(Feature.PendingGetValueRequest);
                int k = (int)request.Args[1];

                switch (request.Status)
                {
                case AsyncRequestStatus.Completed:
                    PW.OnNewValue(k, request.Result);
                    SetStatus(PW.Status);
                    if (k == PW.Length - 1)
                    {
                        ParentBindingExpression.TransferValue(request.Result, false);
                    }
                    break;

                case AsyncRequestStatus.Failed:
                    ReportGetValueError(k, request.SourceItem, request.Exception);
                    PW.OnNewValue(k, DependencyProperty.UnsetValue);
                    break;
                }
            }
        }
Exemple #2
0
 // called by the child XmlBindingWorker when there's a new raw value
 internal void UseNewXmlItem(object item)
 {
     PW.DetachFromRootItem();
     PW.AttachToRootItem(item);
     if (Status != BindingStatusInternal.AsyncRequestPending)
     {
         ParentBindingExpression.ScheduleTransfer(false);
     }
 }
Exemple #3
0
 internal void OnDataErrorsChanged(INotifyDataErrorInfo indei, string propName)
 {
     // if notification was on the right thread, just do the work (normal case)
     if (Dispatcher.Thread == Thread.CurrentThread)
     {
         ParentBindingExpression.UpdateNotifyDataErrors(indei, propName, DependencyProperty.UnsetValue);
     }
     else if (!ParentBindingExpression.IsDataErrorsChangedPending)
     {
         // otherwise invoke an operation to do the work on the right context
         ParentBindingExpression.IsDataErrorsChangedPending = true;
         Engine.Marshal(
             (arg) => { object[] args = (object[])arg;
                        ParentBindingExpression.UpdateNotifyDataErrors((INotifyDataErrorInfo)args[0], (string)args[1], DependencyProperty.UnsetValue);
                        return(null); },
             new object[] { indei, propName });
     }
 }
Exemple #4
0
        void ReplaceDependencySources()
        {
            if (!ParentBindingExpression.IsDetaching)
            {
                int size = PW.Length;
                if (PW.NeedsDirectNotification)
                {
                    ++size;
                }

                WeakDependencySource[] newSources = new WeakDependencySource[size];
                int n = 0;

                if (IsDynamic)
                {
                    for (int k = 0; k < PW.Length; ++k)
                    {
                        DependencyProperty dp = PW.GetAccessor(k) as DependencyProperty;
                        if (dp != null)
                        {
                            DependencyObject d = PW.GetItem(k) as DependencyObject;
                            if (d != null)
                            {
                                newSources[n++] = new WeakDependencySource(d, dp);
                            }
                        }
                    }

                    if (PW.NeedsDirectNotification)
                    {
                        // subproperty notifications can only arise from Freezables
                        // (as of today - 11/14/08), so we only need to propagate
                        // them when the raw value is a Freezable.
                        DependencyObject d = PW.RawValue() as Freezable;
                        if (d != null)
                        {
                            newSources[n++] = new WeakDependencySource(d, DependencyObject.DirectDependencyProperty);
                        }
                    }
                }

                ParentBindingExpression.ChangeWorkerSources(newSources, n);
            }
        }
Exemple #5
0
        internal override void OnCurrentChanged(ICollectionView collectionView, EventArgs args)
        {
            // There are two possible CurrentChanged events that comes through this event handler.
            // 1. CurrentChanged from DataItem as CollectionView
            // 2. CurrentChanged from QueriedCollection

            // only handle changed event from DataItem as CollectionView
            if (collectionView == CollectionView)
            {
                using (ParentBindingExpression.ChangingValue())
                {
                    // This will unhook and hook notifications
                    UpdateContextNode(true);

                    // tell host worker to use a new item
                    _hostWorker.UseNewXmlItem(this.RawValue());
                }
            }
        }
Exemple #6
0
        internal override void AttachDataItem()
        {
            object item;

            if (XmlWorker == null)
            {
                item = DataItem;
            }
            else
            {
                XmlWorker.AttachDataItem();
                item = XmlWorker.RawValue();
            }

            PW.AttachToRootItem(item);

            if (PW.Length == 0)
            {
                ParentBindingExpression.SetupDefaultValueConverter(item.GetType());
            }
        }
Exemple #7
0
 internal void SetupDefaultValueConverter(Type type)
 {
     ParentBindingExpression.SetupDefaultValueConverter(type);
 }
Exemple #8
0
        //------------------------------------------------------
        //
        //  Internal Methods - callbacks from PropertyPathWorker
        //
        //------------------------------------------------------

        internal void CancelPendingTasks()
        {
            ParentBindingExpression.CancelPendingTasks();
        }