From 151e56ec2e3466389804b8874b4224bf6bd08097 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 3 Apr 2013 05:03:20 +0400 Subject: New pages, LoginViewModel, Validation (in progress) --- Juick/App.xaml.cs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'Juick/App.xaml.cs') diff --git a/Juick/App.xaml.cs b/Juick/App.xaml.cs index 98dc31c..03e0d10 100644 --- a/Juick/App.xaml.cs +++ b/Juick/App.xaml.cs @@ -10,22 +10,31 @@ namespace Juick { public partial class App : Application { - public void NavigateTo(Uri param) { - RootFrame.Navigate(param); + public void NavigateTo(Uri param, bool removeFromStack = false) + { + var page = (PhoneApplicationPage) RootFrame.Content; + var service = page.NavigationService; + service.Navigate(param); + if (removeFromStack) + { + page.Dispatcher.BeginInvoke(() => service.RemoveBackEntry()); + } } - private static AppViewModel context = null; + private static AppViewModel _context = null; public static AppViewModel AppContext { get { // Delay creation of the view model until necessary - if (context == null) { - context = new AppViewModel(); - context.Pages.Add(new PageViewModel(context) { RestUri = "/home?1=1" }); - context.Pages.Add(new PageViewModel(context) { RestUri = "/messages?1=1" }); + if (_context == null) { + _context = new AppViewModel(); + _context.Pages.Add(new PageViewModel(_context) { RestUri = "/home?1=1", Caption = "My feed"}); + _context.Pages.Add(new PageViewModel(_context) { RestUri = "/messages?1=1", Caption = "Last"}); + _context.Pages.Add(new PageViewModel(_context) { RestUri = "/messages?1=1&popular=1", Caption = "Top"}); + _context.Pages.Add(new PageViewModel(_context) { RestUri = "/messages?1=1&media=all", Caption = "Images" }); }; - return context; + return _context; } } /// -- cgit v1.2.3