/// <summary>
        /// Log a signed-in user out.
        /// </summary>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task LogoutAsync()
        {
            var cargs = new CancelEventArgs();

            LogoutInitiated?.Invoke(this, cargs);

            if (cargs.Cancel)
            {
                return;
            }

            if (UserDetails != null)
            {
                UserDetails = null;
            }
            else
            {
                return; // No-op
            }

            var provider = ProviderManager.Instance.GlobalProvider;

            if (provider != null)
            {
                await provider.LogoutAsync();

                LogoutCompleted?.Invoke(this, new EventArgs());
            }

            // Close Menu
            if (FlyoutBase.GetAttachedFlyout(_loginButton) is FlyoutBase flyout)
            {
                flyout.Hide();
            }
        }
Exemple #2
0
        public void LogoutFinished(IAsyncResult ar)
        {
            var    result = (AsyncResult)ar;
            var    logout = (Func <string>)result.AsyncDelegate;
            string error  = logout.EndInvoke(ar);

            LogoutCompleted?.Invoke(error);
        }