frochet38
Topic Author
Posts: 13
Joined: 14 Jun 2020, 11:14

How to bypass the image cache when loading a BitmapImage from a file

10 Aug 2020, 17:38

Hi,

I'm trying to display an image on some control, this works fine, but my image content changes based on user input.
I reload and refresh the user-interface using the code below :
	Noesis::Image* pImage = m_pMainWindow->FindName<Noesis::Image>("PhotoModiface");
	if (pImage != nullptr)
	{
		Noesis::BitmapImage* pBitmapImage = new Noesis::BitmapImage(szScreenShotFile.c_str());
		Noesis::Ptr<Noesis::ImageSource> pScreenShotImage = *pBitmapImage;
		pImage->SetSource(pScreenShotImage);
	}
The update works until I load an other XAML page, using GUI::LoadComponent, and then when
I reload back the page contaning the "PhotoModiface" image control, and refresh it using the above method, the image is always the one
loaded just before the page change, like if GUI::LoadComponent was caching the images based on their Uri.
Is there a way to bypass this cache ? I wasn't able to find how.

Thanks
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to bypass the image cache when loading a BitmapImage from a file

11 Aug 2020, 10:56

I assume you are installing your own TextureProvider. In that case, every time your filename is modified you can invoke
RaiseTextureChanged("MyImage.png");
and it will automatically reload.
 
frochet38
Topic Author
Posts: 13
Joined: 14 Jun 2020, 11:14

Re: How to bypass the image cache when loading a BitmapImage from a file

11 Aug 2020, 15:05

Thanks a lot, that's what I was looking for, seems to work well.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to bypass the image cache when loading a BitmapImage from a file

11 Aug 2020, 16:37

Great!

Who is online

Users browsing this forum: Google [Bot] and 85 guests