コード例 #1
0
ファイル: SetImagePath.cs プロジェクト: rene12188/Tourplaner
        public void Execute(object?parameter)
        {
            FolderBrowserDialog tmp = new FolderBrowserDialog();

            if (tmp.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show(tmp.SelectedPath);
                CFGManager.AddUpdateAppSettings("ImageFolder", tmp.SelectedPath);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Database.cs プロジェクト: rene12188/Tourplaner
 /// <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"));
 }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: Util.cs プロジェクト: rene12188/Tourplaner
        public void ConfigLoader_Test()
        {
            string config = CFGManager.ReadSetting("Host");

            Assert.AreEqual(config, "localhost", "Some useful error message");
        }