Esempio n. 1
0
        private void cmdLogin_Click(object sender, RoutedEventArgs e)
        {
            Utils.Login theLogin = new Utils.Login();

            //now that we're logged in we can look at the Twitter daters.
            theLogin.TwitterLogin();
            UpdateControls();
        }
Esempio n. 2
0
        public MainPage()
        {
            this.InitializeComponent();

            // Set an app variable to track logged-in status
            // There's probably a better way to do this.
            (App.Current as App).IsLoggedIn = false;

            // This might be better?
            Utils.Login theLogin = new Utils.Login();
            theLogin.TwitterLogin();

            // if login was successful, IsLoggedIn is true

            if ((App.Current as App).IsLoggedIn == true)
            {
                // this means login was successful
                // load the twitter feed at launch
                ContentFrame.Navigate(typeof(FeedPage));

                // change the navMain selected item to Feed
                // this is for UX completeness...otherwise the selected bar won't appear in the right place in navMain
                // sauce: https://stackoverflow.com/questions/48361741/windows-10-uwp-navigationview-update-selected-menuitem-on-backnavigation
                var pageName = "Feed";
                //find menu item that has the matching tag
                var menuItem = navMain.MenuItems.OfType <NavigationViewItem>().Where(item => item.Tag.ToString() == pageName).First();
                //select
                navMain.SelectedItem = menuItem;
            }
            else
            {
                // this means the user never logged in
                // load the settings page at launch
                ContentFrame.Navigate(typeof(SettingsPage));
            }
        }