/// <summary>
        /// Logs the user in and moves to editing server screen.
        /// Forces a configuration change to the saved connection so the server URL is set,
        /// but the team project and team are null
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void NextButton_Click(object sender, RoutedEventArgs e)
        {
            if (InteractionAllowed)
            {
                if (Uri.IsWellFormedUriString(ServerComboBox.Text, UriKind.Absolute))
                {
                    var serverUri = ToUri(ServerComboBox.Text);

                    // block clicking "next" until login request is done
                    ToggleLoading(true);
                    await AzureDevOps.HandleLoginAsync(CredentialPromptType.PromptIfNeeded, serverUri).ConfigureAwait(false);

                    if (AzureDevOps.ConnectedToAzureDevOps)
                    {
                        AzureDevOps.Configuration.SavedConnection = new ConnectionInfo(serverUri, null, null);
                        ChangeStates(ControlState.EditingServer);
                    }
                    else
                    {
                        ToggleLoading(false);
                        Dispatcher.Invoke(() => MessageDialog.Show(string.Format(CultureInfo.InvariantCulture,
                                                                                 Properties.Resources.UnableToConnectFormattedMessage, serverUri.ToString())));
                        Dispatcher.Invoke(ServerComboBox.Focus);
                    }
                }
                else
                {
                    Dispatcher.Invoke(() => MessageDialog.Show(Properties.Resources.ADO_URL_Fromat_Message));
                }
            }
        }
示例#2
0
        public Task RestoreConfigurationAsync(string serializedConfig)
        {
            if (!String.IsNullOrEmpty(serializedConfig))
            {
                Configuration.LoadFromSerializedString(serializedConfig);
            }

            return(AzureDevOps.HandleLoginAsync());
        }