Exemple #1
0
        private async void ShowSaveMapDialog(object sender, EventArgs e)
        {
            // Create a SaveMapPage page for getting user input for the new web map item
            var mapInputForm = new ArcGISRuntime.Samples.AuthorEditSaveMap.SaveMapPage();

            // Handle the save button click event on the page
            mapInputForm.OnSaveClicked += SaveMapAsync;

            // Navigate to the SaveMapPage UI
            await Navigation.PushAsync(mapInputForm);

            // Define an OAuth challenge for ArcGIS Online
            var info = new CredentialRequestInfo
            {
                AuthenticationType = AuthenticationType.Token,
                ServiceUri         = new Uri(ArcGISOnlineUrl)
            };

            // Get the credential
            try
            {
                Credential cred = await AuthenticationManager.Current.GetCredentialAsync(info, false);

                // Add the credential to the AuthenticationManager
                AuthenticationManager.Current.AddCredential(cred);
            } catch (System.Threading.Tasks.TaskCanceledException ex)
            {
                // Handle situation where the user closes the login window
                return;
            } catch (System.OperationCanceledException ex)
            {
                // Handle situation where the user presses 'cancel' in the login UI
                return;
            } catch (Exception ex)
            {
                // Handle all other exceptions related to canceled login
                return;
            }
        }
        private async void ShowSaveMapDialog(object sender, EventArgs e)
        {
            // Create a SaveMapPage page for getting user input for the new web map item
            var mapInputForm = new ArcGISRuntime.Samples.AuthorEditSaveMap.SaveMapPage();

            // Handle the save button click event on the page
            mapInputForm.OnSaveClicked += SaveMapAsync;

            // Navigate to the SaveMapPage UI
            await Navigation.PushAsync(mapInputForm);

            // Define an OAuth challenge for ArcGIS Online
            var info = new CredentialRequestInfo
            {
                AuthenticationType = AuthenticationType.Token,
                ServiceUri         = new Uri(ArcGISOnlineUrl)
            };

            // Get the credential
            Credential cred = await AuthenticationManager.Current.GetCredentialAsync(info, false);

            // Add the credential to the AuthenticationManager
            AuthenticationManager.Current.AddCredential(cred);
        }