I am using some code based on 500px Mobile App that has been made by fuse everything was working just fine until I upgraded to the latest version of fuse, and when I tried to run my app in preview again I have got this error “Fuse.Triggers.WhileLoading does not contain a member called SetState, Could you be missing a package reference”
and here is sample code:
public class ImgView: Element
{
HttpImageSource _source = new HttpImageSource();
public ImageSource Source
{
get { return _source; }
set
{
_source = value as HttpImageSource;
}
}
public String ImageUrl
{
get { return _source.Url; }
set
{
_source.Url = value;
if (value == "" || value == null)
{
// Cleanup state triggers
WhileLoaded.SetState(this, false);
WhileFailed.SetState(this, false, "");
WhileLoading.SetState(this, false);
}
else
{
// Check if image is already available
WhileCacheLoaded.SetState(this, _source.State == ImageSourceState.Ready);
}
}
}
public MemoryPolicy ImageMemoryPolicy
{
get { return _source.Policy; }
set { if (_source.Policy != value) _source.Policy = value; }
}
protected override void OnRooted()
{
base.OnRooted();
_source.Changed += OnSourceChanged;
}
protected override void OnUnrooted()
{
_source.Changed -= OnSourceChanged;
_source.Url = null; // abort pending Http request
base.OnUnrooted();
}
protected override VisualBounds CalcRenderBounds()
{
return base.CalcRenderBounds().AddRect(float2(0), ActualSize);
}
void OnSourceChanged(object Source, object Args)
{
if (_source.State == ImageSourceState.Ready) UpdateManager.AddDeferredAction(InvalidateVisual);
WhileLoaded.SetState(this, _source.State == ImageSourceState.Ready);
WhileFailed.SetState(this, _source.State == ImageSourceState.Failed, "Image loading error");
WhileLoading.SetState(this, _source.State == ImageSourceState.Loading);
}
protected override void OnDraw(DrawContext dc)
{
texture2D tex = _source.GetTexture();
if (tex != null)
draw
{
apply Fuse.Drawing.Planar.Image;
DrawContext: dc;
Visual: this;
Size: ActualSize;
Texture: tex;
BlendEnabled: false;
DepthTestEnabled: false;
};
}
}