From 2b387fb5626a57e3a6473eed66816df80152cd49 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 10 Mar 2012 22:14:25 +0400 Subject: refactoring, tags --- Juick/Api/Message.cs | 2 +- Juick/App.xaml.cs | 25 +++++-- Juick/Juick.csproj | 2 +- Juick/MainPage.xaml | 8 +-- Juick/MainPage.xaml.cs | 24 ++++--- Juick/SampleData/MainViewModelSampleData.xaml | 3 +- Juick/ThreadView.xaml.cs | 12 ++-- Juick/ViewModels/MessageListViewModelBase.cs | 95 +++++++++++++++++++++++++++ Juick/ViewModels/MessageViewModel.cs | 16 +++-- Juick/ViewModels/ThreadViewModel.cs | 72 +++----------------- 10 files changed, 160 insertions(+), 99 deletions(-) create mode 100644 Juick/ViewModels/MessageListViewModelBase.cs (limited to 'Juick') diff --git a/Juick/Api/Message.cs b/Juick/Api/Message.cs index 07cc874..e5b5611 100644 --- a/Juick/Api/Message.cs +++ b/Juick/Api/Message.cs @@ -20,7 +20,7 @@ namespace Juick.Api public int Rid { get; set; } public string Body { get; set; } public User User { get; set; } - public DateTime Timestamp { get; set; } + public string Timestamp { get; set; } public int Replies { get; set; } public List Tags { get; set; } public Photo Photo { get; set; } diff --git a/Juick/App.xaml.cs b/Juick/App.xaml.cs index 69dbe16..4057483 100644 --- a/Juick/App.xaml.cs +++ b/Juick/App.xaml.cs @@ -11,18 +11,29 @@ namespace Juick { public partial class App : Application { - private static MainViewModel viewModel = null; + private static MessageListViewModelBase _myfeed = null; /// - /// A static ViewModel used by the views to bind against. + /// A static _myfeed used by the views to bind against. /// - /// The MainViewModel object. - public static MainViewModel ViewModel + /// The MessageListViewModelBase object. + public static MessageListViewModelBase MyFeedView { get { // Delay creation of the view model until necessary - return viewModel ?? (viewModel = new MainViewModel()); + return _myfeed ?? (_myfeed = new MessageListViewModelBase()); + } + } + + private static MessageListViewModelBase _last; + + public static MessageListViewModelBase LastView + { + get + { + return _last ?? + (_last = new MessageListViewModelBase {RestUri = "/messages?1=1&rnd=" + Environment.TickCount}); } } @@ -93,9 +104,9 @@ namespace Juick private void Application_Activated(object sender, ActivatedEventArgs e) { // Ensure that application state is restored appropriately - if (!App.ViewModel.IsDataLoaded) + if (!App.MyFeedView.IsDataLoaded) { - App.ViewModel.LoadData(); + App.MyFeedView.LoadData(); } } diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj index 38e7a21..5460de0 100644 --- a/Juick/Juick.csproj +++ b/Juick/Juick.csproj @@ -93,7 +93,7 @@ ThreadView.xaml - + diff --git a/Juick/MainPage.xaml b/Juick/MainPage.xaml index 7c19bc1..3895188 100644 --- a/Juick/MainPage.xaml +++ b/Juick/MainPage.xaml @@ -12,7 +12,7 @@ FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" - SupportedOrientations="Portrait" Orientation="Portrait" + SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" shell:SystemTray.IsVisible="False"> @@ -30,7 +30,7 @@ - +