ArcGISRuntime.WPF.Samples.AuthorMap.OAuthAuthorize.AuthorizeAsync C# (CSharp) Метод

AuthorizeAsync() публичный Метод

public AuthorizeAsync ( Uri serviceUri, Uri authorizeUri, Uri callbackUri ) : string>>.Task
serviceUri System.Uri
authorizeUri System.Uri
callbackUri System.Uri
Результат string>>.Task
        public Task<IDictionary<string, string>> AuthorizeAsync(Uri serviceUri, Uri authorizeUri, Uri callbackUri)
        {
            // If the TaskCompletionSource or Window are not null, authorization is in progress
            if (_tcs != null || _window != null)
            {
                // Allow only one authorization process at a time
                throw new Exception();
            }

            // Store the authorization and redirect URLs
            _authorizeUrl = authorizeUri.AbsoluteUri;
            _callbackUrl = callbackUri.AbsoluteUri;

            // Create a task completion source
            _tcs = new TaskCompletionSource<IDictionary<string, string>>();

            // Call a function to show the login controls, make sure it runs on the UI thread for this app
            var dispatcher = Application.Current.Dispatcher;
            if (dispatcher == null || dispatcher.CheckAccess())
                AuthorizeOnUIThread(_authorizeUrl);
            else
            {
                var authorizeOnUIAction = new Action(() => AuthorizeOnUIThread(_authorizeUrl));
                dispatcher.BeginInvoke(authorizeOnUIAction);
            }

            // Return the task associated with the TaskCompletionSource
            return _tcs.Task;
        }