상속: Xwt.Dialog
 void OnAddServer(object sender, EventArgs e)
 {
     using (var dialog = new AddServerDialog())
     {
         if (dialog.Run(this) == Command.Ok && dialog.ServerInfo != null)
         {
             if (TFSVersionControlService.Instance.HasServer(dialog.ServerInfo.Name))
             {
                 MessageService.ShowError("Server with same name already exists!");
                 return;
             }
             using (var credentialsDialog = new CredentialsDialog(dialog.ServerType))
             {
                 if (credentialsDialog.Run(this) == Command.Ok && credentialsDialog.Authentication != null)
                 {
                     CredentialsManager.StoreCredential(dialog.ServerInfo.Uri, credentialsDialog.Authentication.Password);
                     var  password             = CredentialsManager.GetPassword(dialog.ServerInfo.Uri); //Try Get Password
                     bool isPasswordSavedInXml = false;
                     if (password == null)
                     {
                         MessageService.ShowWarning("No keyring service found!\nPassword will be saved as plain text.");
                         isPasswordSavedInXml = true;
                     }
                     var server = TeamFoundationServerFactory.Create(dialog.ServerType, dialog.ServerInfo,
                                                                     credentialsDialog.Authentication, isPasswordSavedInXml);
                     using (var projectsDialog = new ChooseProjectsDialog(server))
                     {
                         if (projectsDialog.Run(this) == Command.Ok && projectsDialog.SelectedProjects.Any())
                         {
                             var selectedProjects = projectsDialog.SelectedProjects;
                             server.ProjectCollections = new List <ProjectCollection>(selectedProjects.Select(x => x.Collection).Distinct());
                             server.ProjectCollections.ForEach(pc => pc.Projects = new List <ProjectInfo>(selectedProjects.Where(pi => pi.Collection == pc)));
                             TFSVersionControlService.Instance.AddServer(server);
                             UpdateServersList();
                         }
                     }
                 }
             }
         }
     }
 }
 void OnAddServer(object sender, EventArgs e)
 {
     using (var dialog = new AddServerDialog())
     {
         if (dialog.Run(this) == Command.Ok && dialog.ServerInfo != null)
         {
             if (TFSVersionControlService.Instance.HasServer(dialog.ServerInfo.Name))
             {
                 MessageService.ShowError("Server with same name already exists!");
                 return;
             }
             using (var credentialsDialog = new CredentialsDialog(dialog.ServerType))
             {
                 if (credentialsDialog.Run(this) == Command.Ok && credentialsDialog.Authentication != null)
                 {
                     CredentialsManager.StoreCredential(dialog.ServerInfo.Uri, credentialsDialog.Authentication.Password);
                     var password = CredentialsManager.GetPassword(dialog.ServerInfo.Uri); //Try Get Password
                     bool isPasswordSavedInXml = false;
                     if (password == null)
                     {
                         MessageService.ShowWarning("No keyring service found!\nPassword will be saved as plain text.");
                         isPasswordSavedInXml = true;
                     }
                     var server = TeamFoundationServerFactory.Create(dialog.ServerType, dialog.ServerInfo, 
                                                                     credentialsDialog.Authentication, isPasswordSavedInXml);
                     using (var projectsDialog = new ChooseProjectsDialog(server))
                     {
                         if (projectsDialog.Run(this) == Command.Ok && projectsDialog.SelectedProjects.Any())
                         {
                             var selectedProjects = projectsDialog.SelectedProjects;
                             server.ProjectCollections = new List<ProjectCollection>(selectedProjects.Select(x => x.Collection).Distinct());
                             server.ProjectCollections.ForEach(pc => pc.Projects = new List<ProjectInfo>(selectedProjects.Where(pi => pi.Collection == pc)));
                             TFSVersionControlService.Instance.AddServer(server);
                             UpdateServersList();
                         }
                     }
                 }
             }
         }
     }
 }