示例#1
0
        /// <summary>
        /// Returns a connection info object from the selected fields in the treeview
        /// - also sets the date of last usage
        /// </summary>
        /// <returns></returns>
        private ConnectionInfo GetConnectionFromTreeView()
        {
            if (this.serverTreeview.SelectedItem == null)
            {
                return(null);
            }
            var item    = this.serverTreeview.SelectedItem;
            var vm      = item as TeamProjectViewModel;
            var team    = vm.Team;
            var project = vm.Project;

            if (team != null)
            {
                project = team.ParentProject;
            }
            else if (project != null)
            {
                team = null;
            }

            ConnectionInfo connection = FileIssueHelpers.CreateConnectionInfo(new Uri(this.ServerComboBox.Text), project, team);

            connection.SetLastUsage(DateTime.Now);
            return(connection);
        }
示例#2
0
        /// <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 = FileIssueHelpers.CreateConnectionInfo(serverUri, null, null);
                        ChangeStates(ControlState.EditingServer);
                    }
                    else
                    {
                        ToggleLoading(false);
                        Dispatcher.Invoke(ServerComboBox.Focus);
                    }
                }
                else
                {
                    Dispatcher.Invoke(() => MessageDialog.Show(Properties.Resources.ADO_URL_Fromat_Message));
                }
            }
        }