Example #1
0
        /// <summary>
        /// Calls PostRequest for the datasource, and which invokes the action
        /// where all Adaptors connected start posting data back to the DataSource
        ///
        /// If DataSource is IObserveable then this request is redirected directly to
        /// the DataSource, otherwise it is redirected to central registry where all
        /// information needed for this to happen' is collected
        /// </summary>
        public static void PostRequest(object aDataSource)
        {
            if (aDataSource == null)
            {
                return;
            }

            postQueue.Current = aDataSource;
            if (postQueue.Current != aDataSource)
            {
                return;
            }

            if (aDataSource is IObserveable)
            {
                // If target is IObserveable then there's no need to enter it into the registry
                // it can handle all on its own, so connection is made to him directly
                (aDataSource as IObserveable).PostRequest();
            }
            else
            {
                // Since DataSource is a stupid object registry has to handle his bindings and connections
                DataSourceInfo ds = (DataSourceInfo)GetInfoFor(aDataSource);
                if (ds != null)
                {
                    ds.PostRequest();
                    ds = null;
                }
            }
            postQueue.Current = null;
            if (postQueue.Current != null)
            {
                PostRequest(postQueue.Current);
            }
        }