blob: f85ec974288f1e4ace88d9476a1c7a41673dd429 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
using System;
using System.Windows.Data;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using RestSharp.Authenticators;
namespace Juick
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
// Holds the push channel that is created or found.
InitializeComponent();
DataContext = App.AppContext;
Loaded += (o, args) =>
{
var progressIndicator = SystemTray.ProgressIndicator;
if (progressIndicator != null)
{
return;
}
progressIndicator = new ProgressIndicator();
SystemTray.SetProgressIndicator(this, progressIndicator);
Binding binding = new Binding("IsDataLoading") { Source = DataContext };
BindingOperations.SetBinding(
progressIndicator, ProgressIndicator.IsVisibleProperty, binding);
binding = new Binding("IsDataLoading") { Source = DataContext };
BindingOperations.SetBinding(
progressIndicator, ProgressIndicator.IsIndeterminateProperty, binding);
if (App.AppContext.Account.IsAuthenticated)
{
App.AppContext.Pages[0].RefreshData();
}
};
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
App.AppContext.Client.Authenticator = new HttpBasicAuthenticator(App.AppContext.Account.UserName, App.AppContext.Account.Password);
}
private void ApplicationBarIconButtonClick(object sender, EventArgs e)
{
App.AppContext.Pages[Pages.SelectedIndex].Items.Clear();
App.AppContext.Pages[Pages.SelectedIndex].RefreshData();
}
private void ApplicationBarMenuItemClick(object sender, EventArgs e)
{
App.AppContext.Account.SignOut(this);
}
private void ApplicationBarIconButtonClick1(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/NewPostView.xaml", UriKind.Relative));
}
}
}
|