private void ReloadTargets() { this.ExplorerTree.Items.Clear(); var targets = CloudTargetManager.GetTargets(); foreach (var target in targets) { ExplorerTree.Items.Add(new CloudFoundryTarget(target)); } }
public PublishProfileEditorResources(PublishProfile publishProfile, CancellationToken cancellationToken) { this.selectedPublishProfile = publishProfile; this.selectedPublishProfile.PropertyChanged += this.PublishProfile_PropertyChanged; this.cancellationToken = cancellationToken; this.CloudTargets = CloudTargetManager.GetTargets(); var publishProfiles = new List <PublishProfile>(); var publishDirectory = Directory.GetParent(this.selectedPublishProfile.Path); if (Directory.Exists(publishDirectory.FullName)) { foreach (var file in publishDirectory.GetFiles()) { if (file.Name.EndsWith(PushEnvironment.Extension, StringComparison.OrdinalIgnoreCase)) { try { var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment env = new PushEnvironment(selectedProject); env.ProfileFilePath = file.FullName; var profile = PublishProfile.Load(env); publishProfiles.Add(profile); } catch (Exception ex) { // Ignore profiles that cannot be loaded. Logger.Warning(string.Format(CultureInfo.InvariantCulture, "Cloud not load profile from {0}: {1}", file.Name, ex)); } } } } this.PublishProfiles = publishProfiles.ToArray(); }