/// <summary>Initialise une nouvelle instance de la classe <see cref="SourceControlProject"/></summary> /// <param name="configuration">The application configuration information.</param> /// <param name="projectId">The project id used to define which configuration will be used.</param> public SourceControlProject(TfsCommitMonitorConfigurationSection configuration, string projectId) { _configuration = configuration; _tfsServer = _configuration.Servers[projectId]; _teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ServerConfiguration.TfsTeamProjectCollection)); _versionControlServer = _teamProjectCollection.GetService <VersionControlServer>(); foreach (MonitoredProjectItemConfigurationElement item in _tfsServer.Folders) { _monitoredItems.Add(item.ItemId, item.MonitoredFolder); } }
private bool TryGetSelectedEmulator(out ServerConfigurationElement server) { server = CurrentSelectedServer; return(server != null); //if (c_ComboBox_Emulators.SelectedIndex == -1) //{ // server = null; // return false; //} //string emulatorName = c_ComboBox_Emulators.SelectedItem.ToString(); //server = Program.Configuration.Servers[emulatorName]; //return true; }
private void DoDisplayHosts() { try { ServerConfigurationElement server = CurrentSelectedServer; if (server == null) { return; } // Lock Auth-Settings c_GroupBox_Authentication.Enabled = server.EnableAdvancedSettings; c_GroupBox_Misc.Enabled = server.EnableAdvancedSettings; int?selectedIndex = null; c_ComboBox_Servers.Items.Clear(); foreach (HostConfigurationElement host in server.Hosts) { int index = c_ComboBox_Servers.Items.Add(host.Hostname); if (String.Equals(host.Hostname, Properties.Settings.Default.LastServerName, StringComparison.InvariantCultureIgnoreCase)) { selectedIndex = index; } } if (c_ComboBox_Servers.Items.Count > 0) { c_ComboBox_Servers.SelectedIndex = selectedIndex.GetValueOrDefault(0); } else { c_ComboBox_Servers.SelectedIndex = -1; } } catch (Exception e) { DisplayErrorMessage("Could not retrieve servers for emulator.", e); } }
private bool TryGetSelectedServer(out ServerConfigurationElement emulator, out HostConfigurationElement server) { if (TryGetSelectedEmulator(out emulator) == false) { server = null; return(false); } else if (c_ComboBox_Servers.SelectedIndex == -1 && m_LastSelectedServer == null) { server = null; return(false); } else if (c_ComboBox_Servers.SelectedIndex == -1 && m_LastSelectedServer != null) { server = m_LastSelectedServer; return(true); } string serverName = c_ComboBox_Servers.SelectedItem.ToString(); server = emulator.Hosts.GetByHostName(serverName); return(true); }