public List <Parameter> GetActiveParameters() { if (string.IsNullOrEmpty(Environment)) { if (Parameters.Any()) { return(Parameters); } if (Environments.Any()) { return(Environments.First().Parameters); } } else { var environment = Environment.ToLower(); foreach (var e in Environments) { if (!string.IsNullOrEmpty(e.Name) && e.Name.ToLower() == environment) { return(e.Parameters); } } } return(new List <Parameter>()); }
public IEnumerable <Parameter> GetActiveParameters() { if (!Environments.Any()) { return(Enumerable.Empty <Parameter>()); } return(string.IsNullOrEmpty(Environment) ? Environments.First().Parameters : Environments.First(e => e.Name == Environment).Parameters); }
public EnvironmentSettings GetActiveEnviroment() { if (String.IsNullOrEmpty(ActiveEnvironmentKey) || !Environments.ContainsKey(ActiveEnvironmentKey)) { ActiveEnvironmentKey = Environments.First().Key; return(Environments.First().Value); } else { return(Environments[ActiveEnvironmentKey]); } }
void ExecEnvClone() { if (!(EnvList.SelectedItem is Environment senv)) { return; } var name = senv.Name; if (Environments.Any(e => e.IsLocal && (e.Name.Equals(name, StringComparison.OrdinalIgnoreCase)))) { var ibox = new InputBox("New environment name:", "Clone Environment", name + " - Copy"); ibox.Closing += (sender, args) => { var ib = (InputBox)sender; if (ib.DialogResult != true) { return; } name = ib.Text.Trim(); if (Environments.Any(e => e.IsLocal && (e.Name.Equals(name, StringComparison.OrdinalIgnoreCase)))) { MessageBox.Show( $"Environment '{name}' already exists.\nPlease choose a different name.", Strings.APP_NAME, MessageBoxButton.OK, MessageBoxImage.Error ); args.Cancel = true; } ; }; if (ibox.ShowDialog() != true) { return; } } var nenv = senv.Clone(name); nenv.Dirty = true; nenv.Save(); Environments.Add(nenv); EnvList.SelectedItem = Environments.First(e => e.Id == nenv.Id); }
private void Filter() { if (!string.IsNullOrEmpty(SearchText)) { if (FilterByType) { Environments.First().Filter(a => a.ResourceName.ToUpper().Contains(SearchText.ToUpper()) && (a.ResourceType == "Folder" || a.ResourceType == "WorkflowService")); } else { Environments.First().Filter(a => a.ResourceName.ToUpper().Contains(SearchText.ToUpper())); } } else { if (FilterByType) { Environments.First().Filter(a => a.ResourceType == "Folder" || a.ResourceType == "WorkflowService"); } } }
public ApplicationEnvironment GetDefaultEnvironment() { return(Environments.First(e => e.Name == DEFAULT_ENV_NAME)); }