Пример #1
0
        /// <summary>
        /// Called whenever the authentication has changed; act dependent on the authentication state.
        /// </summary>
        /// <param name="context">The authentication context holding information on credentials</param>
        /// <param name="isAuthenticated">A flag specifying whether the user is authenticated</param>
        protected override async void OnAuthenticationChanged(AuthenticationContext context, bool isAuthenticated)
        {
            int fadeInMs = 500;

            base.OnAuthenticationChanged(context, isAuthenticated);

            if (isAuthenticated)
            {
                // Set the new Search Postfix on the GeoLocator
                this.PlaceFinderViewModel.SearchPostfix = ClientSettingsViewModel.GeoLocatorSearchPostfix;

                // Set the maximum number of records for the result list
                this.FeatureCollectionResultViewModel.GridProperties.DefaultBatchSize = ClientSettingsViewModel.ResultListMaximumNumberOfRecords;

                // Set up the MapDefinitions, waiting (asynchronously) for completion
                await this.MapsViewModel.GetServiceProviderMapDefinitionsAsync();

                // Wait a bit to have some map information drawn, showing some more interesting
                // Map when it comes available
                await TaskEx.Delay(fadeInMs);

                // With everything loaded and set up; start showing the application
                AuthenticationOpacity.FadeIn(fadeInMs);

                // We could do something with the number of sessions currently active on this server.
                // Note that not signing off will retain the session's token active on the server (for a
                // period equal to the lease time).
                int numberOfActiveSessions = await MainXYServiceProvider.GetActiveSessionsCountAsync();
            }

            // Only allow (visibility of) trace logging in case of admin rights
            this.TraceLogger.AllowLogging = isAuthenticated && context.HasAdminRights;
        }