示例#1
0
        private async Task WiredLogout(Windows.Security.Credentials.PasswordCredential credential)
        {
            var response = await AuthHelper.LogoutAsync(4, currentAccount.Username);

            if (response.Contains("logout_ok"))
            {
                SetLogoutButtonAnimation();
            }
            else if (response == "not_online_error")
            {
                SetLogoutButtonAnimation();
            }
            else
            {
                isOnline = await NetHelper.IsOnline();

                if (isOnline)
                {
                    SetLoginButton();
                }
                else
                {
                    SetLogoutButton();
                }
            }
        }
示例#2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            GetCurrentNetwork();
            currentAccount = App.Accounts.FirstOrDefault();
            isOnline       = await NetHelper.IsOnline();

            var isCampus = await NetHelper.IsCampus();

            if (!isCampus)
            {
                var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
                LoginButton.IsEnabled = false;
                Notification.Show(resourceLoader.GetString("NotOnCampus"));
            }
            if (connectedNetwork != null && isCampus)
            {
                if (isOnline)
                {
                    SetLoginButton();
                }
                await LoadCachedStatusAsync();

                await LoginNetworkIfFavoriteAsync();

                await GetConnectionStatusAsync();
                await GetUsageChartSourceAsync();
            }
        }
示例#3
0
        private async Task WirelessLogout()
        {
            var response = await NetHelper.LogoutAsync();

            if (response == "Logout is successful.")
            {
                SetLogoutButtonAnimation();
            }
            else
            {
                isOnline = await NetHelper.IsOnline();

                if (isOnline)
                {
                    SetLoginButton();
                }
                else
                {
                    SetLogoutButton();
                }
            }
        }