public void SetSession(Session session) { this.Session = session; if (this.IsLogin) { ApplicationData.Current.LocalSettings.Set(SESSION_KEY, session); this.LoadUser(); } else { ApplicationData.Current.LocalSettings.Remove(SESSION_KEY); } }
public CurrentUserViewModel() { this.ApiClient = new ApiClient(this); this.EventAggregator = App.Container.Resolve<IEventAggregator>(); this.JoinedGroupList = new ObservableCollection<Group>(); this.ManagedGroupList = new ObservableCollection<Group>(); this.EventAggregator.GetEvent<Events.JoinGroupEvent>().Subscribe(this.OnJoinGroup); this.EventAggregator.GetEvent<Events.QuitGroupEvent>().Subscribe(this.OnQuitGroup); var session = ApplicationData.Current.LocalSettings.Get<Session>(SESSION_KEY); _session = session; if (this.IsLogin) { this.LoadUser(); } }