public void Execute(object?parameter) { FolderBrowserDialog tmp = new FolderBrowserDialog(); if (tmp.ShowDialog() == DialogResult.OK) { MessageBox.Show(tmp.SelectedPath); CFGManager.AddUpdateAppSettings("ImageFolder", tmp.SelectedPath); } }
public static async Task <string> GetJson(string from, string to) { string responseBody = null; try { HttpResponseMessage response = await client.GetAsync( $"http://open.mapquestapi.com/directions/v2/route?key=" + CFGManager.ReadSetting("MapKey") + $"&from={from}&to={to}"); response.EnsureSuccessStatusCode(); responseBody = response.Content.ReadAsStringAsync().Result; } catch (HttpRequestException e) { Console.WriteLine("\nException Caught!"); Console.WriteLine("Message :{0} ", e.Message); } return(responseBody); }
/// <summary> /// <para> /// Loads the CFGstring for the Connectionhandler /// </para> /// </summary> /// <returns> /// <br /> /// </returns> private static string LoadCFG() { return("Host=" + CFGManager.ReadSetting("Host") + ";Username="******"Username") + "; Password="******"Password") + ";Database=" + CFGManager.ReadSetting("Database")); }
public static async Task <Byte[]> GetPicture(string from, string to) { Byte[] responseBody = null; try { HttpResponseMessage response = await client.GetAsync( $"https://open.mapquestapi.com/staticmap/v5/map?start={from}&end={to}&size=@2x&key=" + CFGManager.ReadSetting("MapKey")); //response.EnsureSuccessStatusCode(); responseBody = await response.Content.ReadAsByteArrayAsync(); // Above three lines can be replaced with new helper method below // string responseBody = await client.GetStringAsync(uri); } catch (HttpRequestException e) { Console.WriteLine("\nException Caught!"); Console.WriteLine("Message :{0} ", e.Message); } return(responseBody); }
public void ConfigLoader_Test() { string config = CFGManager.ReadSetting("Host"); Assert.AreEqual(config, "localhost", "Some useful error message"); }