summaryrefslogtreecommitdiff
path: root/Juick/LoginView.xaml.cs
blob: 4d6114e6cf1081daafe0b46fae1a726aa174d9a0 (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
using System.Linq;
using System.Windows;
using Microsoft.Phone.Controls;
using System;

namespace Juick
{
    public partial class LoginView : PhoneApplicationPage
    {
        public LoginView()
        {
            InitializeComponent();
            DataContext = App.Account.Credentials;
        }

        private Uri nextUri;

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            nextUri = NavigationContext.QueryString.ContainsKey("FileId")
                ? new Uri(string.Format("/NewPostView.xaml?FileId={0}", NavigationContext.QueryString["FileId"]), UriKind.Relative)
                : new Uri("/MainPage.xaml", UriKind.Relative);
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            App.Account.SignIn(this, textBox1.Text, textBox2.Password, nextUri);
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            while (NavigationService.BackStack.Any())
                NavigationService.RemoveBackEntry();
        }
    }
}