locked
Refresh View from SettingsFlyout RRS feed

  • Question

  • Good morning,

    I'm developing an app (8.1) that is authenticated with Windows Live. As it is not essential to authenticate to the proper functioning of the app I offer, according to the Ms design guide, the possibility to authenticate in the sidebar of charms, within the section configuration. Once we click on "accounts" tells you if you are authenticated or not. If you're not, it offers you the possibility to authenticate using a button. Once you are authenticated must appear your profile photo in Windows Live at the top of all pages. It is something that is achieved smoothly changing page because in the constructor of the corresponding to each view ViewModel I wrote

    UsuarioWindowsLive = app.UsuarioWindowsLive (app.UsuarioWidowsLive is a static variable defined in the app.xaml.cs).

    And in XAML view I have < Image Source = {Binding UsuarioWindowsLive.UrlFoto} />

    As I said I get the desired effect when changing without problems. Not so in the view that I'm seeing when pulse in charms > configuration> accounts. I’m not able to refresh the image of the view to update the value of the static variable.

    I think I must exists a better way to get what I’d like. What do you think?.

    1) Insist on the way that I've taken: pass the UsuarioWindowsLive object using a static variable in the app.xaml.cs and it is completed for the first time when achievement authentication. This authentication done it in the code behind of the SettingsFlyout account.xaml.cs UsuarioWindowsLive usuarioWindowsLive = await windowsLiveService.DameUsuarioWindowsLiveAsync (login);

    (2) Consider a new approach. For example do not use codeBehind for the SettingsFlyout account.xaml and use a view model for this SettingsFlyout that is accessible from any page from which can access the Charms option > settings > accounts. This not be as it would, if you can. If this is the option that you recommend give me any hints on how to do it.

    (3) Not perform authentication using an item in the sidebar and use another mechanism in any view in particular and it spreads through the use of a static variable in the app.xaml.cs.

    Or any other that you think.

    The application is 8.1 with XAML and C#. Use the MVVM for almost everything, with Unity as IoC motor and the use of Services that perform the tasks. I use the code behind in the SettingsFlyout and some user controls.

    Tuesday, February 11, 2014 9:54 AM

Answers

  • I think that after you've authenticated, you can refresh the page with Frame.Navigate to the same page and you should get the picture to show up.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, February 11, 2014 3:36 PM
    Moderator

All replies

  • I think that after you've authenticated, you can refresh the page with Frame.Navigate to the same page and you should get the picture to show up.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, February 11, 2014 3:36 PM
    Moderator
  • Thanks a lot Mat. Nice anwser, it was easier than I thought
    Tuesday, February 11, 2014 9:47 PM