summaryrefslogtreecommitdiff
path: root/Juick/ViewModels/AppViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/ViewModels/AppViewModel.cs')
-rw-r--r--Juick/ViewModels/AppViewModel.cs67
1 files changed, 67 insertions, 0 deletions
diff --git a/Juick/ViewModels/AppViewModel.cs b/Juick/ViewModels/AppViewModel.cs
new file mode 100644
index 0000000..5d22cab
--- /dev/null
+++ b/Juick/ViewModels/AppViewModel.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using System.Collections.ObjectModel;
+using Juick.Classes;
+using RestSharp;
+
+namespace Juick.ViewModels
+{
+ public class AppViewModel : ViewModelBase
+ {
+ private ObservableCollection<PageViewModel> _pages;
+ public ObservableCollection<PageViewModel> Pages
+ {
+ get
+ {
+ if (_pages == null)
+ _pages = new ObservableCollection<PageViewModel>();
+ return _pages;
+ }
+ }
+
+ static readonly string IsDataLoadingPropertyName = ExpressionHelper.GetPropertyName<AppViewModel>(x => x.IsDataLoading);
+ bool isDataLoading;
+
+ public bool IsDataLoading
+ {
+ get { return isDataLoading; }
+ set
+ {
+ isDataLoading = value;
+ NotifyPropertyChanged(IsDataLoadingPropertyName);
+ foreach (var page in Pages)
+ {
+ page.LoadMessagesPageCommand.NotifyCanExecuteChanged();
+ }
+ }
+ }
+
+ private AccountManager _acc;
+
+ public AccountManager Account
+ {
+ get { return _acc ?? (_acc = new AccountManager()); }
+ }
+
+ private RestClient _cl;
+ public RestClient Client
+ {
+ get
+ {
+ return _cl ?? (_cl = new RestClient("http://api.juick.com")
+ {
+ UserAgent = "Juick 1.1/Windows Phone " + Environment.OSVersion.Version
+ });
+ }
+ }
+
+ }
+}