protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (PhoneApplicationFrameEx.NavigatePendingStateRestore())
                return;

            if(vm == null)
                vm = new Vidyano.ViewModel.Pages.PersistentObjectPage(this, (PhonePersistentObject)Client.CurrentClient.GetCachedObject<PersistentObject>(NavigationContext.QueryString["id"]));

            DataContext = vm;

            base.OnNavigatedTo(e);
        }
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.Back && Service.Current.IsConnected && e.SourcePageType == typeof(SignInPage))
                e.Cancel = true;
            else if (vm != null)
            {
                vm.Dispose();
                vm = null;
            }

            base.OnNavigatingFrom(e);
        }
        protected override void OnRemovedFromJournal(JournalEntryRemovedEventArgs e)
        {
            if (vm != null)
            {
                vm.Dispose();
                vm = null;
            }

            base.OnRemovedFromJournal(e);

            if (Client.RootFrame.BackStack.Count() < 1 && Settings.Current.StartupPageType == Settings.StartupPageTypeEnum.PersistenObjectPage)
                Application.Current.Terminate();
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     DataContext = vm = new Vidyano.ViewModel.Pages.PersistentObjectPage(this, Client.CurrentClient.GetCachedObject<StorePersistentObject>(e.Parameter as string));
     base.OnNavigatedTo(e);
 }