private void LoadFromCoreData()
 {
     var coreData = IoC.Get<ICoreData>();
     var sessions = coreData.Sessions;
     this.ViewModel = sessions.Where(i => i.SessionId == this.SessionId).FirstOrDefault();
 }
Ejemplo n.º 2
0
 public static Uri Session(SessionItemViewModel session)
 {
     var uri = new Uri(string.Format("/Pages/SessionDetailsPage.xaml?SessionId={0}", session.SessionId), UriKind.Relative);
     return uri;
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (DesignerProperties.IsInDesignTool) return;

            var store = new TransientDataStorage();
            var vm =  store.Restore(()=> ViewModel);

            var sessionIdArg = this.NavigationContext.QueryString["SessionId"];
            this.SessionId = Convert.ToInt32(sessionIdArg);

            if (null != vm && vm.SessionId == this.SessionId)
            {
                this.ViewModel = vm;
                this.ScrollOffset = store.Restore<double>(ScrollPos);
                LogInstance.LogInfo("Restored from transient storage: {0}", vm);
                return;
            }

            LoadFromCoreData();
        }