private static void DoStart(int port, string baseAddress) { HttpClient client = new HttpClient(); var response = client.GetAsync(baseAddress + "api/slevyr/getApiVersion").Result; if (response != null) { if (response.StatusCode == HttpStatusCode.OK) { Console.WriteLine("API version: {0}", response.Content.ReadAsStringAsync().Result); } else { Console.WriteLine("ERROR: status code {0}", response.StatusCode); } } else { Console.WriteLine("ERROR: Impossible to connect to service"); } Logger.Info($"\nWebApp Started on {baseAddress}\n"); Console.WriteLine("Stiskem klávesy se služba ukončí !\n"); Process.Start(baseAddress + "menu.html"); Console.ReadLine(); SlevyrService.ClosePort(); }
public bool ClosePort() { Logger.Info("+"); SlevyrService.ClosePort(); return(!SlevyrService.SerialPortIsOpen); }