Example #1
0
        internal override void DetachDataItem()
        {
            PW.DetachFromRootItem();
            if (XmlWorker != null)
            {
                XmlWorker.DetachDataItem();
            }

            // cancel any pending async requests.  If it has already completed,
            // but is now waiting in the dispatcher queue, it will be ignored because
            // we set _pending*Request to null.
            AsyncGetValueRequest pendingGetValueRequest = (AsyncGetValueRequest)GetValue(Feature.PendingGetValueRequest, null);

            if (pendingGetValueRequest != null)
            {
                pendingGetValueRequest.Cancel();
                ClearValue(Feature.PendingGetValueRequest);
            }

            AsyncSetValueRequest pendingSetValueRequest = (AsyncSetValueRequest)GetValue(Feature.PendingSetValueRequest, null);

            if (pendingSetValueRequest != null)
            {
                pendingSetValueRequest.Cancel();
                ClearValue(Feature.PendingSetValueRequest);
            }
        }
Example #2
0
        // Token: 0x06007491 RID: 29841 RVA: 0x00215AE0 File Offset: 0x00213CE0
        private void CompleteGetValue(AsyncGetValueRequest request)
        {
            AsyncGetValueRequest asyncGetValueRequest = (AsyncGetValueRequest)base.GetValue(BindingWorker.Feature.PendingGetValueRequest, null);

            if (asyncGetValueRequest == request)
            {
                base.ClearValue(BindingWorker.Feature.PendingGetValueRequest);
                int num = (int)request.Args[1];
                if (this.CheckTarget() == null)
                {
                    return;
                }
                AsyncRequestStatus status = request.Status;
                if (status != AsyncRequestStatus.Completed)
                {
                    if (status != AsyncRequestStatus.Failed)
                    {
                        return;
                    }
                    this.ReportGetValueError(num, request.SourceItem, request.Exception);
                    this.PW.OnNewValue(num, DependencyProperty.UnsetValue);
                }
                else
                {
                    this.PW.OnNewValue(num, request.Result);
                    this.SetStatus(this.PW.Status);
                    if (num == this.PW.Length - 1)
                    {
                        base.ParentBindingExpression.TransferValue(request.Result, false);
                        return;
                    }
                }
            }
        }
Example #3
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;
                }
            }
        }
Example #4
0
        // Token: 0x06007490 RID: 29840 RVA: 0x00215AB4 File Offset: 0x00213CB4
        private static object OnCompleteGetValueOperation(object arg)
        {
            AsyncGetValueRequest asyncGetValueRequest = (AsyncGetValueRequest)arg;
            ClrBindingWorker     clrBindingWorker     = (ClrBindingWorker)asyncGetValueRequest.Args[0];

            clrBindingWorker.CompleteGetValue(asyncGetValueRequest);
            return(null);
        }
Example #5
0
        static object OnCompleteGetValueOperation(object arg)
        {
            AsyncGetValueRequest request = (AsyncGetValueRequest)arg;
            ClrBindingWorker     worker  = (ClrBindingWorker)request.Args[0];

            worker.CompleteGetValue(request);
            return(null);
        }
Example #6
0
        // Token: 0x0600748F RID: 29839 RVA: 0x00215A78 File Offset: 0x00213C78
        private static object OnCompleteGetValueCallback(AsyncDataRequest adr)
        {
            AsyncGetValueRequest asyncGetValueRequest = (AsyncGetValueRequest)adr;
            ClrBindingWorker     clrBindingWorker     = (ClrBindingWorker)asyncGetValueRequest.Args[0];
            DataBindEngine       engine = clrBindingWorker.Engine;

            if (engine != null)
            {
                engine.Marshal(ClrBindingWorker.CompleteGetValueLocalCallback, asyncGetValueRequest, 1);
            }
            return(null);
        }
Example #7
0
        // Token: 0x0600748E RID: 29838 RVA: 0x00215A20 File Offset: 0x00213C20
        private static object OnGetValueCallback(AsyncDataRequest adr)
        {
            AsyncGetValueRequest asyncGetValueRequest = (AsyncGetValueRequest)adr;
            ClrBindingWorker     clrBindingWorker     = (ClrBindingWorker)asyncGetValueRequest.Args[0];
            object value = clrBindingWorker.PW.GetValue(asyncGetValueRequest.SourceItem, (int)asyncGetValueRequest.Args[1]);

            if (value == PropertyPathWorker.IListIndexOutOfRange)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            return(value);
        }
Example #8
0
        static object OnCompleteGetValueCallback(AsyncDataRequest adr)
        {
            AsyncGetValueRequest request = (AsyncGetValueRequest)adr;
            ClrBindingWorker     worker  = (ClrBindingWorker)request.Args[0];

            DataBindEngine engine = worker.Engine;

            if (engine != null) // could be null if binding has been detached
            {
                engine.Marshal(CompleteGetValueLocalCallback, request);
            }

            return(null);
        }
Example #9
0
        // Token: 0x0600748D RID: 29837 RVA: 0x00215990 File Offset: 0x00213B90
        private void RequestAsyncGetValue(object item, int level)
        {
            string nameFromInfo = this.GetNameFromInfo(this.PW.GetAccessor(level));

            Invariant.Assert(nameFromInfo != null, "Async GetValue expects a name");
            AsyncGetValueRequest asyncGetValueRequest = (AsyncGetValueRequest)base.GetValue(BindingWorker.Feature.PendingGetValueRequest, null);

            if (asyncGetValueRequest != null)
            {
                asyncGetValueRequest.Cancel();
            }
            asyncGetValueRequest = new AsyncGetValueRequest(item, nameFromInfo, base.ParentBinding.AsyncState, ClrBindingWorker.DoGetValueCallback, ClrBindingWorker.CompleteGetValueCallback, new object[]
            {
                this,
                level
            });
            base.SetValue(BindingWorker.Feature.PendingGetValueRequest, asyncGetValueRequest);
            base.Engine.AddAsyncRequest(base.TargetElement, asyncGetValueRequest);
        }
Example #10
0
        // Token: 0x0600746F RID: 29807 RVA: 0x002152B4 File Offset: 0x002134B4
        internal override void DetachDataItem()
        {
            this.PW.DetachFromRootItem();
            if (this.XmlWorker != null)
            {
                this.XmlWorker.DetachDataItem();
            }
            AsyncGetValueRequest asyncGetValueRequest = (AsyncGetValueRequest)base.GetValue(BindingWorker.Feature.PendingGetValueRequest, null);

            if (asyncGetValueRequest != null)
            {
                asyncGetValueRequest.Cancel();
                base.ClearValue(BindingWorker.Feature.PendingGetValueRequest);
            }
            AsyncSetValueRequest asyncSetValueRequest = (AsyncSetValueRequest)base.GetValue(BindingWorker.Feature.PendingSetValueRequest, null);

            if (asyncSetValueRequest != null)
            {
                asyncSetValueRequest.Cancel();
                base.ClearValue(BindingWorker.Feature.PendingSetValueRequest);
            }
        }
Example #11
0
        void RequestAsyncGetValue(object item, int level)
        {
            // get information about the property whose value we want
            string name = GetNameFromInfo(PW.GetAccessor(level));

            Invariant.Assert(name != null, "Async GetValue expects a name");

            // abandon any previous request
            AsyncGetValueRequest pendingGetValueRequest = (AsyncGetValueRequest)GetValue(Feature.PendingGetValueRequest, null);

            if (pendingGetValueRequest != null)
            {
                pendingGetValueRequest.Cancel();
            }

            // issue the new request
            pendingGetValueRequest =
                new AsyncGetValueRequest(item, name, ParentBinding.AsyncState,
                                         DoGetValueCallback, CompleteGetValueCallback,
                                         this, level);
            SetValue(Feature.PendingGetValueRequest, pendingGetValueRequest);
            Engine.AddAsyncRequest(TargetElement, pendingGetValueRequest);
        }
Example #12
0
        void CompleteGetValue(AsyncGetValueRequest request) 
        { 
            if (_pendingGetValueRequest == request)
            { 
                _pendingGetValueRequest = null;
                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; 
                }
            } 
        }
Example #13
0
        void RequestAsyncGetValue(object item, int level) 
        { 
            // get information about the property whose value we want
            string name = GetNameFromInfo(PW.GetAccessor(level)); 
            Invariant.Assert(name != null, "Async GetValue expects a name");

            // abandon any previous request
            if (_pendingGetValueRequest != null) 
            {
                _pendingGetValueRequest.Cancel(); 
            } 

            // issue the new request 
            _pendingGetValueRequest =
                new AsyncGetValueRequest(item, name, ParentBinding.AsyncState,
                                DoGetValueCallback, CompleteGetValueCallback,
                                this, level); 
            Engine.AddAsyncRequest(TargetElement, _pendingGetValueRequest);
        }