/// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            await SignOutUserAsync(dc.Context, ConnectionName?.GetValue(dc.State), UserId?.GetValue(dc.State), cancellationToken).ConfigureAwait(false);

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Beispiel #2
0
 private void UserId_GotFocus(object sender, RoutedEventArgs e)
 {
     if (hasFullTextBeenRead)
     {
         UserId.SetValue(AutomationProperties.NameProperty, userIdNameProperty);
     }
     else
     {
         userIdNameProperty = UserId.GetValue(AutomationProperties.NameProperty);
         UserId.SetValue(AutomationProperties.NameProperty,
                         // Add a period so Narrator pauses after reading the logo name.
                         FrameworkElementAutomationPeer.FromElement(Logo)?.GetName() + ". " +
                         FrameworkElementAutomationPeer.FromElement(WelcomeTo)?.GetName() + " " +
                         // Add a period so Narrator pauses after reading the service name.
                         FrameworkElementAutomationPeer.FromElement(ServiceName)?.GetName() + ". " +
                         // Add a period so Narrator pauses after reading the footer.
                         FrameworkElementAutomationPeer.FromElement(Footer)?.GetName() + ". " +
                         FrameworkElementAutomationPeer.FromElement(UserId)?.GetName());
         hasFullTextBeenRead = true;
     }
 }