summaryrefslogtreecommitdiff
path: root/Juick/MainPage.xaml.cs
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2013-04-01 13:34:49 +0400
committerGravatar Vitaly Takmazov2013-04-01 13:34:49 +0400
commitfb1fab2e1593ba13fae8eae519f5482525eb68a1 (patch)
treef3557b2e8991ec53fde46d05346fab2bd8fce37e /Juick/MainPage.xaml.cs
parent57550f203995b61d600fae59832e409fd5feebcd (diff)
AppViewModel
Diffstat (limited to 'Juick/MainPage.xaml.cs')
-rw-r--r--Juick/MainPage.xaml.cs28
1 files changed, 16 insertions, 12 deletions
diff --git a/Juick/MainPage.xaml.cs b/Juick/MainPage.xaml.cs
index 503c023..4861114 100644
--- a/Juick/MainPage.xaml.cs
+++ b/Juick/MainPage.xaml.cs
@@ -7,6 +7,7 @@ using System.Windows.Data;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Notification;
using Microsoft.Phone.Shell;
+using Juick.ViewModels;
namespace Juick
{
@@ -61,8 +62,9 @@ namespace Juick
}*/
// Set the data context of the listbox control to the sample data
- Home.DataContext = App.MyFeedView;
- Last.DataContext = App.LastView;
+ DataContext = App.AppContext;
+ Home.DataContext = ((AppViewModel)DataContext).Pages[0];
+ Last.DataContext = ((AppViewModel)DataContext).Pages[1];
Loaded += (o, args) =>
{
var progressIndicator = SystemTray.ProgressIndicator;
@@ -76,12 +78,12 @@ namespace Juick
SystemTray.SetProgressIndicator(this, progressIndicator);
- Binding binding = new Binding("IsDataLoading") { Source = Home.DataContext };
+ Binding binding = new Binding("IsDataLoading") { Source = DataContext };
BindingOperations.SetBinding(
progressIndicator, ProgressIndicator.IsVisibleProperty, binding);
- binding = new Binding("IsDataLoading") { Source = Home.DataContext };
+ binding = new Binding("IsDataLoading") { Source = DataContext };
BindingOperations.SetBinding(
progressIndicator, ProgressIndicator.IsIndeterminateProperty, binding);
@@ -100,7 +102,7 @@ namespace Juick
// Ensure that there is at least one key in the query string, and check
// whether the "FileId" key is present.
- navigateUri = string.IsNullOrEmpty(App.Account.Credentials.UserName) ? loginUriPart : newPostUriPart;
+ navigateUri = string.IsNullOrEmpty(App.AppContext.Account.Credentials.UserName) ? loginUriPart : newPostUriPart;
if (queryStrings.ContainsKey("FileId"))
{
FileId = queryStrings["FileId"];
@@ -112,8 +114,10 @@ namespace Juick
}
else
{
- ((ViewModels.ViewModelBase)Home.DataContext).LoadData(null);
- ((ViewModels.ViewModelBase)Last.DataContext).LoadData(null);
+ if (((ViewModels.PageViewModel)Home.DataContext).Items.Count == 0)
+ ((ViewModels.PageViewModel)Home.DataContext).LoadData(null);
+ if (((ViewModels.PageViewModel)Last.DataContext).Items.Count == 0)
+ ((ViewModels.PageViewModel)Last.DataContext).LoadData(null);
}
}
@@ -166,15 +170,15 @@ namespace Juick
private void ApplicationBarIconButtonClick(object sender, EventArgs e)
{
- App.MyFeedView.Items.Clear();
- App.LastView.Items.Clear();
- App.MyFeedView.LoadData(null);
- App.LastView.LoadData(null);
+ App.AppContext.Pages[0].Items.Clear();
+ App.AppContext.Pages[1].Items.Clear();
+ App.AppContext.Pages[0].LoadData(null);
+ App.AppContext.Pages[1].LoadData(null);
}
private void ApplicationBarMenuItemClick(object sender, EventArgs e)
{
- App.Account.SignOut(this);
+ App.AppContext.Account.SignOut(this);
}
private void ApplicationBarIconButtonClick1(object sender, EventArgs e)