public DeploymentActionResource ClearAllConditions() { Channels.Clear(); Environments.Clear(); TenantTags.Clear(); return(this); }
public void Dispose() { Log?.Clear(); Entities?.Clear(); Actions?.Clear(); CalculatedFields?.Clear(); Connections?.Clear(); Environments?.Clear(); Maps?.Clear(); Relationships?.Clear(); Scripts?.Clear(); SearchTypes?.Clear(); Templates?.Clear(); }
void LoadEnvironments() { Environments.Clear(); Environment.Fill(Environments); var env = Environments.Where(e => e.Id == Configuration.Instance.LocalSettings.LastEnvironmentId).FirstOrDefault(); if (env != null) { EnvList.SelectedItem = env; } else { EnvList.SelectedIndex = 0; } }
public void Bind_Enviroments_Dictionary() { var dic = new Dictionary <string, string> { { "Environments:Development", "Development" }, { "Environments:Staging", "Staging" }, { "Environments:Production", "Production" } }; var env = new Environments(); env.Clear(); var config = new ConfigurationBuilder().AddInMemoryCollection(dic).Build(); config.Bind(nameof(Environments), env); Assert.NotNull(env); }
private async Task LoadAsync() { try { ObservableCollection <Heritage> heritages = await HeritageAPIService.GetAsyncHeritages(CurrentUser.CompanyId); Heritages.Clear(); foreach (Heritage heritage in heritages) { Heritages.Add(heritage); } IsBusy = true; } catch (Exception ex) { DialogParameters param = new DialogParameters { { "Message", "Erro ao carregar patrimônios" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); Console.WriteLine($"Ocorreu um erro ao baixar os dados: {ex.Message}, Página: Patrimônios"); } finally { IsBusy = false; } try { ObservableCollection <Environment> environments = await HeritageAPIService.GetAsyncEnvironments(CurrentUser.CompanyId); Environments.Clear(); foreach (Environment environment in environments) { Environments.Add(environment); } IsBusy = true; } catch (Exception ex) { DialogParameters param = new DialogParameters { { "Message", "Erro ao carregar ambientes" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); Console.WriteLine($"Ocorreu um erro ao baixar os dados: {ex.Message}, Página: Ambientes"); } finally { IsBusy = false; } try { ObservableCollection <User> users = await HeritageAPIService.GetAsyncUsers(CurrentUser.CompanyId); Users.Clear(); foreach (User user in users) { if (user.UserLevel == 1) { user.UserLevelDescription = "Administrador"; } else if (user.UserLevel == 2) { user.UserLevelDescription = "Gerenciador"; } else if (user.UserLevel == 3) { user.UserLevelDescription = "Suporte"; } if (CurrentUser.Id != user.Id) { Users.Add(user); } } } catch (Exception ex) { DialogParameters param = new DialogParameters { { "Message", "Erro ao carregar usuários" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); Console.WriteLine($"Ocorreu um erro ao baixar os dados: {ex.Message}, Página: Usuários"); } finally { IsBusy = false; } }
public static IConfigurationBuilder AddAzureAppConfiguration( this IConfigurationBuilder configurationBuilder, string currentEnvironment, Action <AzureAppConfigConnectOptions, FiltersOptions, FeatureFlagOptions>?configureConnect = default, string sectionName = Sections.AzureAppConfig, bool throwExceptionOnStoreNotFound = false, string?envSectionName = null) { var configuration = configurationBuilder.Build(); return(configurationBuilder.AddAzureAppConfiguration( options => { var env = new Environments(); if (!string.IsNullOrEmpty(envSectionName)) { env.Clear(); configuration.Bind(envSectionName, env); } // create connection options var connectOptions = new AzureAppConfigConnectOptions(); configuration.Bind(sectionName, connectOptions); var filtersOptions = new FiltersOptions(); configuration.Bind($"{sectionName}:Filters", filtersOptions); var featuresOptions = new FeatureFlagOptions(); configuration.Bind($"{sectionName}:Features", featuresOptions); configureConnect?.Invoke(connectOptions, filtersOptions, featuresOptions); // configure features options.UseFeatureFlags(fo => { fo.CacheExpirationInterval = featuresOptions.CacheExpirationInterval; if (!string.IsNullOrEmpty(featuresOptions.Label)) { fo.Label = env[featuresOptions.Label]; } }); if (!string.IsNullOrEmpty(connectOptions.ConnectionString)) { options.Connect(connectOptions.ConnectionString); } else if (connectOptions.Endpoint != null && string.IsNullOrEmpty(connectOptions.ConnectionString)) { var credentials = new DefaultAzureCredential(); options.Connect(connectOptions.Endpoint, credentials); } options.ConfigureClientOptions(clientOptions => clientOptions.Retry.MaxRetries = connectOptions.MaxRetries); foreach (var section in filtersOptions.Sections) { // Load configuration values with no label, which means all of the configurations that are not specific to // Environment options.Select(section); // Override with any configuration values specific to current hosting env options.Select(section, env[currentEnvironment]); } foreach (var section in filtersOptions.RefresSections) { options.ConfigureRefresh(refresh => { refresh.Register(section, refreshAll: true); refresh.Register(section, env[currentEnvironment], refreshAll: true); refresh.SetCacheExpiration(filtersOptions.CacheExpirationTime); }); } }, throwExceptionOnStoreNotFound)); }