using System; using System.IO.IsolatedStorage; using System.Net; using System.Windows; using System.Windows.Controls; namespace Juick.Classes { public class AccountManager { private string _userName; private string _password; public string UserName { get { if (_userName == null) { IsolatedStorageSettings.ApplicationSettings.TryGetValue("user", out _userName); } return _userName; } set { _userName = value; IsolatedStorageSettings.ApplicationSettings["user"] = _userName; } } public string Password { get { if (_password == null) { IsolatedStorageSettings.ApplicationSettings.TryGetValue("password", out _password); } return _password; } set { _password = value; IsolatedStorageSettings.ApplicationSettings["password"] = value; } } public bool IsAuthenticated { get { bool authenticated; IsolatedStorageSettings.ApplicationSettings.TryGetValue("authenticated", out authenticated); return authenticated; } set { IsolatedStorageSettings.ApplicationSettings["authenticated"] = value; } } public string NotificationUri { get { string savedUri; IsolatedStorageSettings.ApplicationSettings.TryGetValue("notification_uri", out savedUri); return savedUri; } set { IsolatedStorageSettings.ApplicationSettings["notification_uri"] = value; } } public void SignOut(Page page) { IsAuthenticated = false; page.NavigationService.Navigate(new Uri("/LoginView.xaml", UriKind.Relative)); page.Dispatcher.BeginInvoke(() => page.NavigationService.RemoveBackEntry()); } } }