public async Task <Config> GetAsync()
        {
            ConfigSelector configSelector = ConfigSelector.Build();

            using (var client = CloudantClient())
            {
                var response = await client.PostAsync(_dbName + "/_find", new StringContent(JsonConvert.SerializeObject(configSelector), Encoding.UTF8, "application/json"));

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    JToken ob     = JObject.Parse(result);
                    JArray arr    = (JArray)ob.SelectToken("docs");
                    Config config = null;
                    if (arr != null && arr.Count > 0)
                    {
                        config = new Config()
                        {
                            environment    = (string)arr[0]["environment"],
                            superLotoTopic = (string)arr[0]["superLotoTopic"]
                        };
                        return(config);
                    }
                }
                string msg = "Failure to GET. Status Code: " + response.StatusCode + ". Reason: " + response.ReasonPhrase;
                Console.WriteLine(msg);
                return(null);
            }
        }
Exemplo n.º 2
0
        private void LinkEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var editedConfig = ConfigSelector.EditExistingConfig(SelectedUserConfig);

            if (editedConfig == null)
            {
                return;
            }

            comboConfigs.Items[comboConfigs.SelectedIndex] = editedConfig;
            comboConfigs.Refresh();
        }
Exemplo n.º 3
0
        private void LinkCreateNewProfile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var newConfig = ConfigSelector.CreateNewConfig();

            if (newConfig == null)
            {
                return;
            }

            SelectedUserConfig = newConfig;
            DialogResult       = DialogResult.OK;
            Close();
        }
 public AppContext(
     InstallationSettings installationSettings,
     string installedApplicationDirectory,
     string applicationFileName,
     string productCode,
     string installPackagesPath,
     string configSelectorPath,
     IEnumerable <EnvironmentType> environments)
 {
     _installationSettings       = installationSettings;
     _infoMessage                = new InfoMessage();
     _currentVersion             = new CurrentVersion(installedApplicationDirectory, applicationFileName, productCode);
     _installPackagesCollections = new InstallPackagesCollectionsDictionary(installPackagesPath, environments);
     _configSelector             = !string.IsNullOrWhiteSpace(configSelectorPath)
         ? new ConfigSelector(configSelectorPath)
         : null;
     ChangeState(new TestVersionSelected(0));
 }
        private static void ReLoadConfig()
        {
            var configReader = ConfigSelector.Get();

            _mediaDashboardConfig = configReader.ReadConfig();
        }