Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinRT ImageSource binding with cookies

I have a website and now I`m building a WinRT app for it. I use a JSON API both for web and for WinRT app.

One component is a picture gallery, where pictures have access control, so only specific users can download them.

Authorization is made using cookies, for WinRT they are held inside System.Net.Http.HttpClient object.

I tried to bind picture url`s as ImageSource for Image controls, but it fails because resource loader doesn`t send cookies to server.

I want to use binding because of it cleareness and simplicity, I don`t want to make complex code for such task as setting image inside a view.

Questions:

  1. How can I bind ImageSource and force loader to send cookies to server when it tries to download a picture?

  2. Is there a way to save simplicity of binding syntax and add custom loader behavior?

like image 770
Oleh Nechytailo Avatar asked Nov 12 '22 21:11

Oleh Nechytailo


1 Answers

I ended up with custom control with Source and HttpClient properties, which uses HttpClient to download picture and this client is shared across all app.

like image 195
Oleh Nechytailo Avatar answered Nov 15 '22 11:11

Oleh Nechytailo