Exemplo n.º 1
0
        protected ComponentUpdateScope BeginUpdate()
        {
            var s = new ComponentUpdateScope(this);

            (_Scopes ?? (_Scopes = new List <WeakReference <ComponentUpdateScope> >(4))).Add(new WeakReference <ComponentUpdateScope>(s));
            return(s);
        }
Exemplo n.º 2
0
 void ComponentUpdateScope.IComponent.EndUpdate(ComponentUpdateScope scope)
 {
     if (!ComponentUpdateScope.HasScopes(_Scopes, scope) && _IsChangeDefered)
     {
         _IsChangeDefered = false;
         base.StateHasChanged();
     }
 }
Exemplo n.º 3
0
 protected new void StateHasChanged()
 {
     if (ComponentUpdateScope.HasScopes(_Scopes))
     {
         _IsChangeDefered = true;
     }
     else
     {
         _IsChangeDefered = false;
         base.StateHasChanged();
     }
 }
Exemplo n.º 4
0
 public static bool HasScopes(List <WeakReference <ComponentUpdateScope> > scopes, ComponentUpdateScope removingScope = null)
 {
     if (scopes != null)
     {
         for (var i = scopes.Count - 1; i >= 0; i--)
         {
             if (!scopes[i].TryGetTarget(out var s) || (removingScope != null && s == removingScope))
             {
                 scopes.RemoveAt(i);
             }
         }
     }
     return(scopes?.Count > 0);
 }