Exemple #1
0
        private void ResetItemTriggeredRefresh()
        {
            var props     = new HashSet <Property>();
            var workQueue = new Queue <QueryX>();

            Owner.ClearItemTriggeredRefresh();

            foreach (var cx in _computeXManager.Items)
            {
                if (_relation_ComputeX_QueryX.TryGetChild(cx, out QueryX qh))
                {
                    SetTriggers(cx, qh);
                }
            }

            foreach (var gx in _graphXManager.Items)
            {
                if (_relation_GraphX_QueryX.TryGetChildren(gx, out IList <QueryX> roots))
                {
                    foreach (var qh in roots)
                    {
                        SetTriggers(gx, qh);
                    }
                }
            }

            void SetTriggers(Item ti, QueryX qh)
            {
                workQueue.Clear();
                workQueue.Enqueue(qh);
                while (workQueue.Count > 0)
                {
                    var qx = workQueue.Dequeue();
                    props.Clear();
                    qx.GetPropertyRefs(props);
                    foreach (var p in props)
                    {
                        p.IsRefreshTriggerItem = true;
                        Owner.AddItemTriggeredRefresh(p, ti);
                    }
                    if (_relation_Relation_QueryX.TryGetParent(qx, out Relation r))
                    {
                        r.IsRefreshTriggerItem = true;
                        Owner.AddItemTriggeredRefresh(r, ti);
                    }
                    if (_relation_QueryX_QueryX.TryGetChildren(qx, out IList <QueryX> list))
                    {
                        foreach (var q in list)
                        {
                            workQueue.Enqueue(q);
                        }
                    }
                }
            }
        }